From 9a1f4a298577ca5c2a66c38f5e1f413dac0ca464 Mon Sep 17 00:00:00 2001 From: Julian Krauser Date: Fri, 31 Jan 2025 11:10:08 +0100 Subject: [PATCH] extend backup file with file details --- src/helpers/backupHelper.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/helpers/backupHelper.ts b/src/helpers/backupHelper.ts index a7fbc1d..4507542 100644 --- a/src/helpers/backupHelper.ts +++ b/src/helpers/backupHelper.ts @@ -21,8 +21,7 @@ export type BackupSectionRefered = { }; export type BackupFileContent = { [key in BackupSection]?: BackupFileContentSection } & { - collectIds: boolean; - version: 1; + backup_file_details: { collectIds: boolean; createdAt: Date; version: 1 }; }; export type BackupFileContentSection = Array | { [key: string]: Array }; @@ -90,7 +89,7 @@ export default abstract class BackupHelper { filename = new Date().toISOString().split("T")[0]; } - let json: BackupFileContent = { collectIds, version: 1 }; + let json: BackupFileContent = { backup_file_details: { collectIds, createdAt: new Date(), version: 1 } }; for (const section of this.backupSection) { json[section.type] = await this.getSectionData(section.type, collectIds); } @@ -131,7 +130,7 @@ export default abstract class BackupHelper { for (const section of sections .filter((s) => Object.keys(backup).includes(s.type)) .sort((a, b) => a.orderOnInsert - b.orderOnInsert)) { - await this.setSectionData(section.type, backup[section.type], backup.collectIds ?? false); + await this.setSectionData(section.type, backup[section.type], backup.backup_file_details.collectIds ?? false); } this.transactionManager = undefined;