fix: keep imported follow-ups out of current work

They stayed on the board when a non-prior deal was attached, even though the person was prior.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-15 12:34:40 +03:30
co-authored by Cursor
parent 6bc5e1bec7
commit 6bff9d2888
9 changed files with 102 additions and 16 deletions
+10 -3
View File
@@ -287,17 +287,24 @@ export class BillingService {
)
)
OR (
a."dealId" IS NULL
AND a."createdAt" < ${cutoff}
a."createdAt" < ${cutoff}
AND (
EXISTS (
SELECT 1 FROM "Person" AS p
WHERE p."id" = a."personId" AND p."importSource" = 'didar'
WHERE p."id" = a."personId"
AND (
p."importSource" = 'didar'
OR p."previousImportSource" = 'didar'
)
)
OR EXISTS (
SELECT 1 FROM "Company" AS c
WHERE c."id" = a."companyId" AND c."importSource" = 'didar'
)
OR EXISTS (
SELECT 1 FROM "Deal" AS d2
WHERE d2."id" = a."dealId" AND d2."importSource" = 'didar'
)
)
)
)