feature/#34-backup-&-import #57
1 changed files with 3 additions and 4 deletions
|
@ -21,8 +21,7 @@ export type BackupSectionRefered = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export type BackupFileContent = { [key in BackupSection]?: BackupFileContentSection } & {
|
export type BackupFileContent = { [key in BackupSection]?: BackupFileContentSection } & {
|
||||||
collectIds: boolean;
|
backup_file_details: { collectIds: boolean; createdAt: Date; version: 1 };
|
||||||
version: 1;
|
|
||||||
};
|
};
|
||||||
export type BackupFileContentSection = Array<any> | { [key: string]: Array<any> };
|
export type BackupFileContentSection = Array<any> | { [key: string]: Array<any> };
|
||||||
|
|
||||||
|
@ -90,7 +89,7 @@ export default abstract class BackupHelper {
|
||||||
filename = new Date().toISOString().split("T")[0];
|
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) {
|
for (const section of this.backupSection) {
|
||||||
json[section.type] = await this.getSectionData(section.type, collectIds);
|
json[section.type] = await this.getSectionData(section.type, collectIds);
|
||||||
}
|
}
|
||||||
|
@ -131,7 +130,7 @@ export default abstract class BackupHelper {
|
||||||
for (const section of sections
|
for (const section of sections
|
||||||
.filter((s) => Object.keys(backup).includes(s.type))
|
.filter((s) => Object.keys(backup).includes(s.type))
|
||||||
.sort((a, b) => a.orderOnInsert - b.orderOnInsert)) {
|
.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;
|
this.transactionManager = undefined;
|
||||||
|
|
Loading…
Add table
Reference in a new issue