Wire prior archive cutoff through API

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-17 16:52:20 +03:30
co-authored by Cursor
parent 02841a5b8c
commit 79ba146118
11 changed files with 74 additions and 34 deletions
+2 -6
View File
@@ -48,9 +48,7 @@ import {
} from './ask-count';
import {
activityPriorWhere,
companyPriorWhere,
dealPriorWhere,
personPriorWhere,
} from '../common/prior-archive';
type CatalogItem = AskMentoSourceDto;
@@ -325,13 +323,11 @@ Rules:
where: {
...shared,
...(intent.mood ? { mood: intent.mood } : {}),
...(intent.personSource ? {} : personPriorWhere(actor.priorLens)),
},
})
: await this.prisma.company.count({
where: {
...shared,
...(intent.personSource ? {} : companyPriorWhere(actor.priorLens)),
},
});
const who = intent.entity === 'person' ? 'مشتری' : 'شرکت';
@@ -372,7 +368,7 @@ Rules:
? { status: 'open' as const, OR: [{ isStale: true }, { isRotten: true }] }
: {}),
},
dealPriorWhere(actor.priorLens),
dealPriorWhere(actor.priorLens, actor.priorCutoff),
],
};
const n = await this.prisma.deal.count({ where });
@@ -406,7 +402,7 @@ Rules:
organizationId: orgId,
...assigneeWhere(actor),
...created,
...activityPriorWhere(actor.priorLens, new Date(), actor.priorCutoff),
...activityPriorWhere(actor.priorLens, actor.priorCutoff),
},
}),
ticket: () =>