mirror of
https://github.com/immich-app/immich.git
synced 2025-12-21 17:25:35 +03:00
feat: download backups from list
This commit is contained in:
@@ -26,7 +26,7 @@ import {
|
||||
SetMaintenanceModeDto,
|
||||
} from 'src/dtos/maintenance.dto';
|
||||
import { ApiTag, ImmichCookie, MaintenanceAction, Permission } from 'src/enum';
|
||||
import { Auth, Authenticated, GetLoginDetails } from 'src/middleware/auth.guard';
|
||||
import { Auth, Authenticated, FileResponse, GetLoginDetails } from 'src/middleware/auth.guard';
|
||||
import { LoginDetails } from 'src/services/auth.service';
|
||||
import { MaintenanceService } from 'src/services/maintenance.service';
|
||||
import { respondWithCookie } from 'src/utils/response';
|
||||
@@ -92,6 +92,19 @@ export class MaintenanceController {
|
||||
return this.service.listBackups();
|
||||
}
|
||||
|
||||
@Get('backups/:filename')
|
||||
@FileResponse()
|
||||
@Endpoint({
|
||||
summary: 'Download backup',
|
||||
description: 'Downloads the database backup file',
|
||||
history: new HistoryBuilder().added('v9.9.9').alpha('v9.9.9'),
|
||||
})
|
||||
@Authenticated({ permission: Permission.Maintenance, admin: true })
|
||||
async downloadBackup(@Param() { filename }: FilenameParamDto, @Res() res: Response) {
|
||||
res.header('Content-Disposition', 'attachment');
|
||||
res.sendFile(this.service.getBackupPath(filename));
|
||||
}
|
||||
|
||||
@Delete('backups/:filename')
|
||||
@Endpoint({
|
||||
summary: 'Delete backup',
|
||||
|
||||
Reference in New Issue
Block a user