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,30 @@
import { NextRequest, NextResponse } from "next/server";
import { backupService } from "@/services/backup.service";
export async function GET() {
try {
const settings = await backupService.getSettings();
return NextResponse.json({ success: true, data: settings });
} catch (error) {
console.error("Error fetching backup settings:", error);
return NextResponse.json(
{ success: false, error: "Failed to fetch settings" },
{ status: 500 }
);
}
}
export async function PUT(request: NextRequest) {
try {
const body = await request.json();
const settings = await backupService.updateSettings(body);
return NextResponse.json({ success: true, data: settings });
} catch (error) {
console.error("Error updating backup settings:", error);
return NextResponse.json(
{ success: false, error: "Failed to update settings" },
{ status: 500 }
);
}
}