diff options
Diffstat (limited to 'server/middlewares/validators')
-rw-r--r-- | server/middlewares/validators/search.ts | 18 |
1 files changed, 16 insertions, 2 deletions
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 = [ | |||
43 | 43 | ||
44 | const videoChannelsListSearchValidator = [ | 44 | const videoChannelsListSearchValidator = [ |
45 | query('search').not().isEmpty().withMessage('Should have a valid search'), | 45 | query('search').not().isEmpty().withMessage('Should have a valid search'), |
46 | query('searchTarget').optional().custom(isSearchTargetValid).withMessage('Should have a valid search target'), | 46 | |
47 | query('host') | ||
48 | .optional() | ||
49 | .custom(isHostValid).withMessage('Should have a valid host'), | ||
50 | |||
51 | query('searchTarget') | ||
52 | .optional() | ||
53 | .custom(isSearchTargetValid).withMessage('Should have a valid search target'), | ||
47 | 54 | ||
48 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 55 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
49 | logger.debug('Checking video channels search query', { parameters: req.query }) | 56 | logger.debug('Checking video channels search query', { parameters: req.query }) |
@@ -56,7 +63,14 @@ const videoChannelsListSearchValidator = [ | |||
56 | 63 | ||
57 | const videoPlaylistsListSearchValidator = [ | 64 | const videoPlaylistsListSearchValidator = [ |
58 | query('search').not().isEmpty().withMessage('Should have a valid search'), | 65 | query('search').not().isEmpty().withMessage('Should have a valid search'), |
59 | query('searchTarget').optional().custom(isSearchTargetValid).withMessage('Should have a valid search target'), | 66 | |
67 | query('host') | ||
68 | .optional() | ||
69 | .custom(isHostValid).withMessage('Should have a valid host'), | ||
70 | |||
71 | query('searchTarget') | ||
72 | .optional() | ||
73 | .custom(isSearchTargetValid).withMessage('Should have a valid search target'), | ||
60 | 74 | ||
61 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 75 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
62 | logger.debug('Checking video playlists search query', { parameters: req.query }) | 76 | logger.debug('Checking video playlists search query', { parameters: req.query }) |