apps: add crontab
crontab is a text field, so we can have comments part of #793
This commit is contained in:
@@ -20,6 +20,7 @@ exports = module.exports = {
|
||||
|
||||
setAccessRestriction,
|
||||
setOperators,
|
||||
setCrontab,
|
||||
setLabel,
|
||||
setTags,
|
||||
setIcon,
|
||||
@@ -196,6 +197,18 @@ async function setOperators(req, res, next) {
|
||||
next(new HttpSuccess(200, {}));
|
||||
}
|
||||
|
||||
async function setCrontab(req, res, next) {
|
||||
assert.strictEqual(typeof req.body, 'object');
|
||||
assert.strictEqual(typeof req.app, 'object');
|
||||
|
||||
if (req.body.crontab !== null && typeof req.body.crontab !== 'string') return next(new HttpError(400, 'crontab must be a string'));
|
||||
|
||||
const [error] = await safe(apps.setCrontab(req.app, req.body.crontab, auditSource.fromRequest(req)));
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
|
||||
next(new HttpSuccess(200, {}));
|
||||
}
|
||||
|
||||
async function setLabel(req, res, next) {
|
||||
assert.strictEqual(typeof req.body, 'object');
|
||||
assert.strictEqual(typeof req.app, 'object');
|
||||
|
||||
Reference in New Issue
Block a user