backups: set label of backup and control it's retention
This commit is contained in:
@@ -50,6 +50,8 @@ exports = module.exports = {
|
||||
uploadFile,
|
||||
downloadFile,
|
||||
|
||||
updateBackup,
|
||||
|
||||
getLimits,
|
||||
|
||||
load
|
||||
@@ -798,6 +800,21 @@ async function listBackups(req, res, next) {
|
||||
next(new HttpSuccess(200, { backups: result }));
|
||||
}
|
||||
|
||||
async function updateBackup(req, res, next) {
|
||||
assert.strictEqual(typeof req.app, 'object');
|
||||
assert.strictEqual(typeof req.params.backupId, 'string');
|
||||
assert.strictEqual(typeof req.body, 'object');
|
||||
|
||||
const { label, preserveSecs } = req.body;
|
||||
if (typeof label !== 'string') return next(new HttpError(400, 'label must be a string'));
|
||||
if (typeof preserveSecs !== 'number') return next(new HttpError(400, 'preserveSecs must be a number'));
|
||||
|
||||
const [error] = await safe(apps.updateBackup(req.app, req.params.backupId, { label, preserveSecs }));
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
|
||||
next(new HttpSuccess(200, {}));
|
||||
}
|
||||
|
||||
async function uploadFile(req, res, next) {
|
||||
assert.strictEqual(typeof req.app, 'object');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user