fix(backups): показать отсутствие файлов и защитить удаление записей
This commit is contained in:
1 parent
e452e528e1
commit
6617b776bb
26 files changed
+420
-36
No files matched your search
@@ -38,9 +38,10 @@ export async function getBackupJob(baseUrl: string, jobId: string, options?: Req
|
||||
if (result.id !== jobId) throw new Error("Ответ относится к другой задаче резервного копирования")
|
||||
return result
|
||||
}
|
||||
export async function deleteBackup(baseUrl: string, id: string, options?: RequestInit): Promise<void> {
|
||||
const response = await requestBlob(baseUrl, "/api/backups/" + encodeURIComponent(id), backupOptions({ ...options, method: "DELETE" }))
|
||||
export async function deleteBackup(baseUrl: string, id: string, options?: RequestInit, recordOnly = false): Promise<void> {
|
||||
const response = await requestBlob(baseUrl, "/api/backups/" + encodeURIComponent(id) + (recordOnly ? "?recordOnly=true" : ""), backupOptions({ ...options, method: "DELETE" }))
|
||||
if (response.status !== 204) throw new Error("Удаление резервной копии не подтверждено: ожидается HTTP 204")
|
||||
if (recordOnly && response.headers.get("X-Backup-Delete-Mode") !== "record-only") throw new Error("Не подтверждено удаление только записи истории. Обновите данные перед повтором.")
|
||||
}
|
||||
export async function restoreBackup(baseUrl: string, id: string, options?: RequestInit, expectedServerId?: number) {
|
||||
const result = restoreBackupResponseSchema.parse(await backupJson(baseUrl, "/api/backups/" + encodeURIComponent(id) + "/restore", { ...options, method: "POST" }))
|
||||
|
||||
Reference in new issue
Block a user