From 396f6f0140b0f76162e2378fd5a61e2f888673ed Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 17 Aug 2022 14:27:04 +0200 Subject: Cleanup useless express validator messages --- server/middlewares/validators/blocklist.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'server/middlewares/validators/blocklist.ts') diff --git a/server/middlewares/validators/blocklist.ts b/server/middlewares/validators/blocklist.ts index 12980ced4..3de614522 100644 --- a/server/middlewares/validators/blocklist.ts +++ b/server/middlewares/validators/blocklist.ts @@ -13,7 +13,8 @@ import { ServerBlocklistModel } from '../../models/server/server-blocklist' import { areValidationErrors, doesAccountNameWithHostExist } from './shared' const blockAccountValidator = [ - body('accountName').exists().withMessage('Should have an account name with host'), + body('accountName') + .exists(), async (req: express.Request, res: express.Response, next: express.NextFunction) => { logger.debug('Checking blockAccountByAccountValidator parameters', { parameters: req.body }) @@ -37,7 +38,8 @@ const blockAccountValidator = [ ] const unblockAccountByAccountValidator = [ - param('accountName').exists().withMessage('Should have an account name with host'), + param('accountName') + .exists(), async (req: express.Request, res: express.Response, next: express.NextFunction) => { logger.debug('Checking unblockAccountByAccountValidator parameters', { parameters: req.params }) @@ -54,7 +56,8 @@ const unblockAccountByAccountValidator = [ ] const unblockAccountByServerValidator = [ - param('accountName').exists().withMessage('Should have an account name with host'), + param('accountName') + .exists(), async (req: express.Request, res: express.Response, next: express.NextFunction) => { logger.debug('Checking unblockAccountByServerValidator parameters', { parameters: req.params }) @@ -71,7 +74,8 @@ const unblockAccountByServerValidator = [ ] const blockServerValidator = [ - body('host').custom(isHostValid).withMessage('Should have a valid host'), + body('host') + .custom(isHostValid), async (req: express.Request, res: express.Response, next: express.NextFunction) => { logger.debug('Checking serverGetValidator parameters', { parameters: req.body }) @@ -96,7 +100,8 @@ const blockServerValidator = [ ] const unblockServerByAccountValidator = [ - param('host').custom(isHostValid).withMessage('Should have an account name with host'), + param('host') + .custom(isHostValid), async (req: express.Request, res: express.Response, next: express.NextFunction) => { logger.debug('Checking unblockServerByAccountValidator parameters', { parameters: req.params }) @@ -111,7 +116,8 @@ const unblockServerByAccountValidator = [ ] const unblockServerByServerValidator = [ - param('host').custom(isHostValid).withMessage('Should have an account name with host'), + param('host') + .custom(isHostValid), async (req: express.Request, res: express.Response, next: express.NextFunction) => { logger.debug('Checking unblockServerByServerValidator parameters', { parameters: req.params }) -- cgit v1.2.3