feat: enhance backup status display and tracking

Added a visual indicator for backups saved today in the admin interface. Updated the backup status type to include a boolean for today's backup existence, and modified relevant components to reflect this change. Enhanced tests to verify the new functionality.
This commit is contained in:
blake committed 2026-10-23 17:27:37 -05:00
1 parent 747e6e25e0
commit bf661673c9
6 files changed
+71 -7

No files matched your search

+5 -3
View File
@@ -48,6 +48,8 @@ export type BackupResult = {
export type BackupStatus = {
state: 'saved' | 'waiting' | 'behind';
text: string;
/** True only when a daily copy exists for today's Central Time date. */
savedToday: boolean;
};
/**
@@ -94,13 +96,13 @@ export function describeBackup(backupsDir: string, now: string): BackupStatus {
const clock = formatInstantInZone(now, BACKUP_ZONE);
if (!newest) {
const state = clock.time24 < BACKUP_LOCAL_TIME ? 'waiting' : 'behind';
return { state, text: 'No database backup has been saved yet.' };
return { state, text: 'No database backup has been saved yet.', savedToday: false };
}
const label = prettyDate(newest);
const savedToday = newest >= clock.date;
const savedYesterday = newest >= previousDate(clock.date) && clock.time24 < BACKUP_LOCAL_TIME;
if (savedToday || savedYesterday) return { state: 'saved', text: `Database backup saved ${label}.` };
return { state: 'behind', text: `Database backup is behind. The newest saved copy is ${label}.` };
if (savedToday || savedYesterday) return { state: 'saved', text: `Database backup saved ${label}.`, savedToday };
return { state: 'behind', text: `Database backup is behind. The newest saved copy is ${label}.`, savedToday: false };
}
export function startBackupRunner(