feat: implement database backup and restore functionality with JSON support
All checks were successful
Publish Container / publish (push) Successful in 3m53s

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
Marco 2026-04-24 11:13:32 +02:00
commit e8bbae0496
8 changed files with 657 additions and 0 deletions

View file

@ -71,6 +71,7 @@ builder.Services.Configure<CouchbaseLiteOptions>(builder.Configuration.GetSectio
builder.Services.Configure<SingleUserOptions>(builder.Configuration.GetSection(SingleUserOptions.SectionName));
builder.Services.AddSingleton<CouchbaseLiteDatabaseProvider>();
builder.Services.AddScoped<IDatabaseBackupService, JsonDatabaseBackupService>();
builder.Services.AddScoped<IAppSettingsService, CouchbaseLiteAppSettingsService>();
builder.Services.AddScoped<AppThemeState>();
builder.Services.AddSingleton<IAuthService, CouchbaseLiteAuthService>();
@ -264,6 +265,14 @@ app.MapGet("/api/monthly-timesheet/{year:int}/{month:int}/excel", async (
return Results.File(file.Content, file.ContentType, file.FileName);
}).RequireAuthorization();
app.MapGet("/api/database-backup/export", async (
IDatabaseBackupService backupService,
CancellationToken cancellationToken) =>
{
var file = await backupService.ExportAsync(cancellationToken);
return Results.File(file.Content, file.ContentType, file.FileName);
}).RequireAuthorization();
// Development-only endpoint to reset the seeded Admin password (protected by secret in URL)
if (app.Environment.IsDevelopment())
{