backups: add stop_integrity_check route

This commit is contained in:
Girish Ramakrishnan
2026-02-09 21:58:40 +01:00
parent 26a3cf79c5
commit 93a0063941
6 changed files with 58 additions and 14 deletions
+12 -2
View File
@@ -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, {}));
}