backup: move appConfig to backups table

this is useful for clone also to copy notes, operators, checklist
of the time when the backup was made (as opposed to current)

at this point, it's not clear why we need a archives table. it's
an optimization to not have to store icon for every backup.
This commit is contained in:
Girish Ramakrishnan
2024-12-10 20:52:29 +01:00
parent 98058f600e
commit 41bc08a07e
14 changed files with 58 additions and 38 deletions
+4 -3
View File
@@ -27,15 +27,15 @@ describe('Archives API', function () {
format: 'tgz',
preserveSecs: 0,
label: '',
appConfig: { loc: 'loc1' }
};
const appConfig = { loc: 'loc1' };
let archiveId;
before(async function () {
await setup();
appBackup.id = await backups.add(appBackup);
archiveId = await archives.add(appBackup.id, { appConfig }, auditSource);
archiveId = await archives.add(appBackup.id, {}, auditSource);
});
after(cleanup);
@@ -45,13 +45,14 @@ describe('Archives API', function () {
expect(response.statusCode).to.equal(200);
expect(response.body.archives.length).to.be(1);
expect(response.body.archives[0].id).to.be(archiveId);
expect(response.body.archives[0].appConfig).to.eql(appBackup.appConfig);
});
it('get valid archive', async function () {
const response = await superagent.get(`${serverUrl}/api/v1/archives/${archiveId}`)
.query({ access_token: owner.token });
expect(response.statusCode).to.equal(200);
expect(response.body.appConfig).to.eql(appConfig);
expect(response.body.appConfig).to.eql(appBackup.appConfig);
});
it('cannot get invalid archive', async function () {