Wire prior archive cutoff through API
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user