diff options
Diffstat (limited to 'server/middlewares/validators')
-rw-r--r-- | server/middlewares/validators/search.ts | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/server/middlewares/validators/search.ts b/server/middlewares/validators/search.ts index 5a3c83f2c..b4faa8894 100644 --- a/server/middlewares/validators/search.ts +++ b/server/middlewares/validators/search.ts | |||
@@ -3,6 +3,7 @@ import { areValidationErrors } from './utils' | |||
3 | import { logger } from '../../helpers/logger' | 3 | import { logger } from '../../helpers/logger' |
4 | import { query } from 'express-validator' | 4 | import { query } from 'express-validator' |
5 | import { isDateValid } from '../../helpers/custom-validators/misc' | 5 | import { isDateValid } from '../../helpers/custom-validators/misc' |
6 | import { isSearchTargetValid } from '@server/helpers/custom-validators/search' | ||
6 | 7 | ||
7 | const videosSearchValidator = [ | 8 | const videosSearchValidator = [ |
8 | query('search').optional().not().isEmpty().withMessage('Should have a valid search'), | 9 | query('search').optional().not().isEmpty().withMessage('Should have a valid search'), |
@@ -16,6 +17,8 @@ const videosSearchValidator = [ | |||
16 | query('durationMin').optional().isInt().withMessage('Should have a valid min duration'), | 17 | query('durationMin').optional().isInt().withMessage('Should have a valid min duration'), |
17 | query('durationMax').optional().isInt().withMessage('Should have a valid max duration'), | 18 | query('durationMax').optional().isInt().withMessage('Should have a valid max duration'), |
18 | 19 | ||
20 | query('searchTarget').optional().custom(isSearchTargetValid).withMessage('Should have a valid search target'), | ||
21 | |||
19 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 22 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
20 | logger.debug('Checking videos search query', { parameters: req.query }) | 23 | logger.debug('Checking videos search query', { parameters: req.query }) |
21 | 24 | ||
@@ -27,6 +30,7 @@ const videosSearchValidator = [ | |||
27 | 30 | ||
28 | const videoChannelsSearchValidator = [ | 31 | const videoChannelsSearchValidator = [ |
29 | query('search').not().isEmpty().withMessage('Should have a valid search'), | 32 | query('search').not().isEmpty().withMessage('Should have a valid search'), |
33 | query('searchTarget').optional().custom(isSearchTargetValid).withMessage('Should have a valid search target'), | ||
30 | 34 | ||
31 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 35 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
32 | logger.debug('Checking video channels search query', { parameters: req.query }) | 36 | logger.debug('Checking video channels search query', { parameters: req.query }) |