feat: add BackupCard component and corresponding Backup model to enhance settings functionality and data management

This commit is contained in:
Julien Froidefond
2025-11-30 07:50:47 +01:00
parent f17b83fb95
commit 7cb1d5f433
15 changed files with 1102 additions and 1 deletions

View File

@@ -0,0 +1,38 @@
import { NextRequest, NextResponse } from "next/server";
import { backupService } from "@/services/backup.service";
export async function POST(_request: NextRequest) {
try {
// Check if automatic backup should run
const shouldRun = await backupService.shouldRunAutomaticBackup();
if (!shouldRun) {
return NextResponse.json({
success: true,
skipped: true,
message: "Backup not due yet",
});
}
// Create backup
const backup = await backupService.createBackup();
return NextResponse.json({
success: true,
data: backup,
message: backup.skipped
? "Backup skipped - no changes detected"
: "Automatic backup created",
});
} catch (error) {
console.error("Error creating automatic backup:", error);
return NextResponse.json(
{
success: false,
error: error instanceof Error ? error.message : "Failed to create automatic backup",
},
{ status: 500 }
);
}
}