From c158a5faabb8ef0bc5d121fda4522d63603e8bc5 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 12 May 2021 14:51:17 +0200 Subject: Refactor a little bit controllers --- server/controllers/api/config.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'server/controllers/api/config.ts') diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts index 2ddb73519..5ce7adc35 100644 --- a/server/controllers/api/config.ts +++ b/server/controllers/api/config.ts @@ -18,6 +18,7 @@ const configRouter = express.Router() const auditLogger = auditLoggerFactory('config') configRouter.get('/about', getAbout) + configRouter.get('/', asyncMiddleware(getConfig) ) @@ -27,12 +28,14 @@ configRouter.get('/custom', ensureUserHasRight(UserRight.MANAGE_CONFIGURATION), getCustomConfig ) + configRouter.put('/custom', authenticate, ensureUserHasRight(UserRight.MANAGE_CONFIGURATION), customConfigUpdateValidator, asyncMiddleware(updateCustomConfig) ) + configRouter.delete('/custom', authenticate, ensureUserHasRight(UserRight.MANAGE_CONFIGURATION), @@ -67,13 +70,13 @@ function getAbout (req: express.Request, res: express.Response) { } } - return res.json(about).end() + return res.json(about) } function getCustomConfig (req: express.Request, res: express.Response) { const data = customConfig() - return res.json(data).end() + return res.json(data) } async function deleteCustomConfig (req: express.Request, res: express.Response) { -- cgit v1.2.3