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
+3 -5
View File
@@ -257,17 +257,15 @@ export class BillingService {
select: { priorArchiveEnabledAt: true },
});
const enablePrior = cleaned.includes('prior_data_archive');
const cutoff = prev?.priorArchiveEnabledAt ?? new Date();
await this.prisma.organization.update({
where: { id: organizationId },
data: {
enabledModules: cleaned,
...(enablePrior && !prev?.priorArchiveEnabledAt
? { priorArchiveEnabledAt: cutoff }
: {}),
},
});
if (enablePrior) await this.backfillPriorActivities(organizationId, cutoff);
if (enablePrior && prev?.priorArchiveEnabledAt) {
await this.backfillPriorActivities(organizationId, prev.priorArchiveEnabledAt);
}
return cleaned;
}