backups: set label of backup and control it's retention
This commit is contained in:
13
src/apps.js
13
src/apps.js
@@ -54,6 +54,7 @@ exports = module.exports = {
|
||||
|
||||
backup,
|
||||
listBackups,
|
||||
updateBackup,
|
||||
|
||||
getTask,
|
||||
getLogPaths,
|
||||
@@ -2452,6 +2453,18 @@ async function listBackups(app, page, perPage) {
|
||||
return await backups.getByIdentifierAndStatePaged(app.id, backups.BACKUP_STATE_NORMAL, page, perPage);
|
||||
}
|
||||
|
||||
async function updateBackup(app, backupId, data) {
|
||||
assert.strictEqual(typeof app, 'object');
|
||||
assert.strictEqual(typeof backupId, 'string');
|
||||
assert.strictEqual(typeof data, 'object');
|
||||
|
||||
const backup = await backups.get(backupId);
|
||||
if (!backup) throw new BoxError(BoxError.NOT_FOUND, 'Backup not found');
|
||||
if (backup.identifier !== app.id) throw new BoxError(BoxError.NOT_FOUND, 'Backup not found'); // some other app's backup
|
||||
|
||||
await backups.update(backupId, data);
|
||||
}
|
||||
|
||||
async function restoreInstalledApps(options, auditSource) {
|
||||
assert.strictEqual(typeof options, 'object');
|
||||
assert.strictEqual(typeof auditSource, 'object');
|
||||
|
||||
Reference in New Issue
Block a user