backups: add remotePath

the main motivation is that id can be used in REST API routes. previously,
the id was a path and this had a "/" in it. This made /api/v1/backups/:backupId
not work.
This commit is contained in:
Girish Ramakrishnan
2022-04-04 14:13:27 -07:00
parent 54934c41a7
commit 452a4d9a75
15 changed files with 234 additions and 157 deletions

View File

@@ -19,7 +19,8 @@ describe('backups', function () {
after(cleanup);
const boxBackup = {
id: 'backup-box',
id: null,
remotePath: 'backup-box',
encryptionVersion: 2,
packageVersion: '1.0.0',
type: backups.BACKUP_TYPE_BOX,
@@ -33,7 +34,8 @@ describe('backups', function () {
};
const appBackup = {
id: 'app_appid_123',
id: null,
remotePath: 'app_appid_123',
encryptionVersion: null,
packageVersion: '1.0.0',
type: backups.BACKUP_TYPE_APP,
@@ -47,11 +49,11 @@ describe('backups', function () {
};
it('add succeeds', async function () {
await backups.add(boxBackup.id, boxBackup);
boxBackup.id = await backups.add(boxBackup);
});
it('fails with duplicating id', async function () {
const [error] = await safe(backups.add(boxBackup.id, boxBackup));
it('fails with duplicate path', async function () {
const [error] = await safe(backups.add(boxBackup));
expect(error.reason).to.be(BoxError.ALREADY_EXISTS);
});
@@ -87,7 +89,7 @@ describe('backups', function () {
});
it('add app backup succeeds', async function () {
await backups.add(appBackup.id, appBackup);
appBackup.id = await backups.add(appBackup);
});
it('get app backup succeeds', async function () {