Adjust checklist item api to support audits trail
This commit is contained in:
+6
-5
@@ -24,7 +24,6 @@ exports = module.exports = {
|
||||
setLabel,
|
||||
setTags,
|
||||
setNotes,
|
||||
setChecklist,
|
||||
setIcon,
|
||||
setTurn,
|
||||
setRedis,
|
||||
@@ -43,6 +42,8 @@ exports = module.exports = {
|
||||
setMounts,
|
||||
setUpstreamUri,
|
||||
|
||||
setChecklistItem,
|
||||
|
||||
stop,
|
||||
start,
|
||||
restart,
|
||||
@@ -271,16 +272,16 @@ async function setNotes(req, res, next) {
|
||||
next(new HttpSuccess(200, {}));
|
||||
}
|
||||
|
||||
async function setChecklist(req, res, next) {
|
||||
async function setChecklistItem(req, res, next) {
|
||||
assert.strictEqual(typeof req.body, 'object');
|
||||
assert.strictEqual(typeof req.app, 'object');
|
||||
|
||||
if (typeof req.body.checklist !== 'object') return next(new HttpError(400, 'checklist must be an object'));
|
||||
if (typeof req.body.done !== 'boolean') return next(new HttpError(400, 'done must be a boolean'));
|
||||
|
||||
const [error] = await safe(apps.setChecklist(req.app, req.body.checklist, AuditSource.fromRequest(req)));
|
||||
const [error] = await safe(apps.setChecklistItem(req.app, req.params.key, req.body.done, AuditSource.fromRequest(req)));
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
|
||||
next(new HttpSuccess(200, {}));
|
||||
next(new HttpSuccess(202, {}));
|
||||
}
|
||||
|
||||
async function setIcon(req, res, next) {
|
||||
|
||||
Reference in New Issue
Block a user