From fa47956ecf51a6d5d10aeb25d2e4db3da90c7d58 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 28 Jul 2021 10:32:40 +0200 Subject: Filter host for channels and playlists search --- server/middlewares/validators/search.ts | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'server/middlewares') diff --git a/server/middlewares/validators/search.ts b/server/middlewares/validators/search.ts index 6bb335127..ea6a490b2 100644 --- a/server/middlewares/validators/search.ts +++ b/server/middlewares/validators/search.ts @@ -43,7 +43,14 @@ const videosSearchValidator = [ const videoChannelsListSearchValidator = [ query('search').not().isEmpty().withMessage('Should have a valid search'), - query('searchTarget').optional().custom(isSearchTargetValid).withMessage('Should have a valid search target'), + + query('host') + .optional() + .custom(isHostValid).withMessage('Should have a valid host'), + + query('searchTarget') + .optional() + .custom(isSearchTargetValid).withMessage('Should have a valid search target'), (req: express.Request, res: express.Response, next: express.NextFunction) => { logger.debug('Checking video channels search query', { parameters: req.query }) @@ -56,7 +63,14 @@ const videoChannelsListSearchValidator = [ const videoPlaylistsListSearchValidator = [ query('search').not().isEmpty().withMessage('Should have a valid search'), - query('searchTarget').optional().custom(isSearchTargetValid).withMessage('Should have a valid search target'), + + query('host') + .optional() + .custom(isHostValid).withMessage('Should have a valid host'), + + query('searchTarget') + .optional() + .custom(isSearchTargetValid).withMessage('Should have a valid search target'), (req: express.Request, res: express.Response, next: express.NextFunction) => { logger.debug('Checking video playlists search query', { parameters: req.query }) -- cgit v1.2.3