feat: separate prior records behind an owner switch and count last-period questions
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -12,6 +12,7 @@ import { Prisma } from '@prisma/client';
|
||||
import { PrismaService } from '../prisma/prisma.service';
|
||||
import type { Actor } from '../common/record-scope';
|
||||
import { dealAccessWhere, resolveOwnerId } from '../common/record-scope';
|
||||
import { dealPriorWhere } from '../common/prior-archive';
|
||||
import { asCustomFields, toJsonCustomFields } from '../common/custom-fields';
|
||||
import { normalizePhone } from '../contacts/normalize';
|
||||
import {
|
||||
@@ -110,7 +111,11 @@ export class DealsExcelService {
|
||||
async export(actor: Actor): Promise<Buffer> {
|
||||
const [rows, defs] = await Promise.all([
|
||||
this.prisma.deal.findMany({
|
||||
where: { organizationId: actor.organizationId, ...dealAccessWhere(actor) },
|
||||
where: {
|
||||
organizationId: actor.organizationId,
|
||||
...dealAccessWhere(actor),
|
||||
...dealPriorWhere(actor.priorLens),
|
||||
},
|
||||
include: {
|
||||
person: {
|
||||
select: {
|
||||
|
||||
Reference in New Issue
Block a user