refactor: modularize application domains

This commit is contained in:
kkfluous
2026-08-13 12:03:34 +08:00
parent d610e4b841
commit 06fe75b4c7
142 changed files with 14645 additions and 8885 deletions
@@ -292,11 +292,14 @@ export async function getOrGenerateDailyMileageReport(reportDate: string): Promi
return generateDailyMileageReport(reportDate, 'PREVIEW', 'LIVE');
}
export async function archiveDailyMileageReport(reportDate: string): Promise<DailyMileageReport> {
export async function archiveDailyMileageReport(
reportDate: string,
options: { replace?: boolean } = {},
): Promise<DailyMileageReport> {
const existing = await getDailyReportSnapshot(reportDate);
if (existing) return existing;
if (existing && !options.replace) return existing;
const report = await generateDailyMileageReport(reportDate, 'ARCHIVED', 'AUTO');
await saveDailyReportSnapshot(report, 'AUTO');
await saveDailyReportSnapshot(report, 'AUTO', { replace: options.replace });
return report;
}