feat: expand backup to all data and add automatic scheduled backups
Backend Image / build-and-push (push) Successful in 2m16s
Frontend Image / build-and-push (push) Successful in 1m56s

Backup export/import now covers Role, User, RolePermission,
Notification, AuditLog and Document (with actual file content), not
just business data - matching "wirklich alle Daten". Role/User use
natural keys (role.key, resource+action) so a bundle restores cleanly
into a different database.

Adds BackupSchedulerService (@nestjs/schedule) for cron-based automatic
backups to a local path (BACKUP_STORAGE_PATH), with retention pruning
and a file-mtime guard against duplicate runs across replicas. New
GET /backup/schedule and POST /backup/schedule/run-now endpoints, plus
a status card and manual trigger in the frontend Backup settings page.
This commit is contained in:
Nick Szaunig committed 2026-09-03 11:33:48 +02:00
1 parent d998f611e2
commit 7b23862a41
13 files changed
+853 -68

No files matched your search

+12 -2
View File
@@ -1,5 +1,5 @@
import { apiFetchBlob, apiFetchFormData, BlobDownload } from "@/lib/auth/api-client";
import { BackupImportSummary } from "./types";
import { apiFetch, apiFetchBlob, apiFetchFormData, BlobDownload } from "@/lib/auth/api-client";
import { BackupImportSummary, BackupScheduleStatus } from "./types";
export function exportBackup(): Promise<BlobDownload> {
return apiFetchBlob("/backup/export", "apicore-backup.json");
@@ -10,3 +10,13 @@ export function importBackup(file: File): Promise<BackupImportSummary> {
formData.append("file", file);
return apiFetchFormData<BackupImportSummary>("/backup/import", formData);
}
export function getBackupSchedule(): Promise<BackupScheduleStatus> {
return apiFetch<BackupScheduleStatus>("/backup/schedule");
}
export function runBackupNow(): Promise<{ filePath: string }> {
return apiFetch<{ filePath: string }>("/backup/schedule/run-now", {
method: "POST",
});
}
+8
View File
@@ -1,3 +1,11 @@
export interface BackupImportSummary {
imported: Record<string, number>;
}
export interface BackupScheduleStatus {
enabled: boolean;
path: string | null;
cronSchedule: string | null;
retentionCount: number | null;
lastRunAt: string | null;
}