move retentionSecs inside retentionPolicy

part of #441
This commit is contained in:
Girish Ramakrishnan
2020-05-14 16:19:35 -07:00
parent 573da29a4d
commit 6a9fe1128f
5 changed files with 27 additions and 7 deletions

View File

@@ -97,7 +97,6 @@ function setBackupConfig(req, res, next) {
assert.strictEqual(typeof req.body, 'object');
if (typeof req.body.provider !== 'string') return next(new HttpError(400, 'provider is required'));
if (typeof req.body.retentionSecs !== 'number') return next(new HttpError(400, 'retentionSecs is required'));
if (typeof req.body.intervalSecs !== 'number') return next(new HttpError(400, 'intervalSecs is required'));
if ('password' in req.body && typeof req.body.password !== 'string') return next(new HttpError(400, 'password must be a string'));
if ('syncConcurrency' in req.body) {
@@ -107,6 +106,9 @@ function setBackupConfig(req, res, next) {
if (typeof req.body.format !== 'string') return next(new HttpError(400, 'format must be a string'));
if ('acceptSelfSignedCerts' in req.body && typeof req.body.acceptSelfSignedCerts !== 'boolean') return next(new HttpError(400, 'format must be a boolean'));
if (!req.body.retentionPolicy || typeof req.body.retentionPolicy !== 'object') return next(new HttpError(400, 'retentionPolicy is required'));
if (typeof req.body.retentionPolicy.keepWithin !== 'number') return next(400, 'keepWithin is required');
// testing the backup using put/del takes a bit of time at times
req.clearTimeout();