Add per-app notes feature

This commit is contained in:
Johannes Zellner
2024-04-10 17:02:32 +02:00
parent 0fa1ec44b1
commit 87ae95aa4f
8 changed files with 158 additions and 5 deletions
+13
View File
@@ -23,6 +23,7 @@ exports = module.exports = {
setCrontab,
setLabel,
setTags,
setNotes,
setIcon,
setTurn,
setRedis,
@@ -257,6 +258,18 @@ async function setTags(req, res, next) {
next(new HttpSuccess(200, {}));
}
async function setNotes(req, res, next) {
assert.strictEqual(typeof req.body, 'object');
assert.strictEqual(typeof req.app, 'object');
if (typeof req.body.notes !== 'string') return next(new HttpError(400, 'notes must be a string'));
const [error] = await safe(apps.setNotes(req.app, req.body.notes, AuditSource.fromRequest(req)));
if (error) return next(BoxError.toHttpError(error));
next(new HttpSuccess(200, {}));
}
async function setIcon(req, res, next) {
assert.strictEqual(typeof req.body, 'object');
assert.strictEqual(typeof req.app, 'object');