fix(routines): keep the daily desk for internal team work

Customer-linked tasks stay on their record and no longer appear in today, calendar, score, or reminders.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-29 20:53:26 +03:30
co-authored by Cursor
parent 99d686fefb
commit a17c7dbabc
11 changed files with 115 additions and 90 deletions
+26
View File
@@ -0,0 +1,26 @@
import { Prisma, type RoutineTaskSource } from '@prisma/client';
/**
* کارهای روتین فقط کار داخلی تیم است.
* پیگیری، لید، مشتری و معامله روی پرونده خودشان می‌مانند و وارد میز روتین نمی‌شوند.
*/
export const internalRoutineTaskWhere: Prisma.RoutineTaskWhereInput = {
source: { in: ['routine', 'manual'] },
leadId: null,
personId: null,
companyId: null,
dealId: null,
invoiceId: null,
activityId: null,
};
/** فیلتر میز روتین. منبع مشتری حتی اگر صریحاً خواسته شود وارد لیست نمی‌شود. */
export function deskRoutineTaskWhere(
source?: RoutineTaskSource | null,
): Prisma.RoutineTaskWhereInput {
if (source === 'routine' || source === 'manual') {
return { ...internalRoutineTaskWhere, source };
}
if (source) return { AND: [internalRoutineTaskWhere, { source }] };
return internalRoutineTaskWhere;
}