backups: add stop_integrity_check route
This commit is contained in:
+12
-2
@@ -7,7 +7,8 @@ exports = module.exports = {
|
||||
get,
|
||||
update,
|
||||
|
||||
checkIntegrity
|
||||
startIntegrityCheck,
|
||||
stopIntegrityCheck
|
||||
};
|
||||
|
||||
const assert = require('node:assert'),
|
||||
@@ -62,7 +63,7 @@ async function update(req, res, next) {
|
||||
next(new HttpSuccess(200, {}));
|
||||
}
|
||||
|
||||
async function checkIntegrity(req, res, next) {
|
||||
async function startIntegrityCheck(req, res, next) {
|
||||
assert.strictEqual(typeof req.body, 'object');
|
||||
|
||||
const [error, taskId] = await safe(backups.startIntegrityCheck(req.resources.backup, AuditSource.fromRequest(req)));
|
||||
@@ -70,3 +71,12 @@ async function checkIntegrity(req, res, next) {
|
||||
|
||||
next(new HttpSuccess(201, { taskId }));
|
||||
}
|
||||
|
||||
async function stopIntegrityCheck(req, res, next) {
|
||||
assert.strictEqual(typeof req.body, 'object');
|
||||
|
||||
const [error] = await safe(backups.stopIntegrityCheck(req.resources.backup, AuditSource.fromRequest(req)));
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
|
||||
next(new HttpSuccess(204, {}));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user