diff options
author | Chocobozzz <me@florianbigard.com> | 2018-07-20 18:31:49 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-07-24 14:04:05 +0200 |
commit | 0b18f4aa80df8868bf34605423c7a298dffbb2aa (patch) | |
tree | 25299da5d94fc73e88b21e87aeb2c156999c6fcd /server/middlewares/validators/search.ts | |
parent | d525fc399a14a8b16eaad6d4c0bc0a9c4093c3c9 (diff) | |
download | PeerTube-0b18f4aa80df8868bf34605423c7a298dffbb2aa.tar.gz PeerTube-0b18f4aa80df8868bf34605423c7a298dffbb2aa.tar.zst PeerTube-0b18f4aa80df8868bf34605423c7a298dffbb2aa.zip |
Add advanced search in client
Diffstat (limited to 'server/middlewares/validators/search.ts')
-rw-r--r-- | server/middlewares/validators/search.ts | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/server/middlewares/validators/search.ts b/server/middlewares/validators/search.ts index fb2148eb3..a97f5b581 100644 --- a/server/middlewares/validators/search.ts +++ b/server/middlewares/validators/search.ts | |||
@@ -2,7 +2,7 @@ import * as express from 'express' | |||
2 | import { areValidationErrors } from './utils' | 2 | import { areValidationErrors } from './utils' |
3 | import { logger } from '../../helpers/logger' | 3 | import { logger } from '../../helpers/logger' |
4 | import { query } from 'express-validator/check' | 4 | import { query } from 'express-validator/check' |
5 | import { isNumberArray, isStringArray } from '../../helpers/custom-validators/search' | 5 | import { isNumberArray, isStringArray, isNSFWQueryValid } from '../../helpers/custom-validators/search' |
6 | import { isBooleanValid, isDateValid, toArray } from '../../helpers/custom-validators/misc' | 6 | import { isBooleanValid, isDateValid, toArray } from '../../helpers/custom-validators/misc' |
7 | 7 | ||
8 | const searchValidator = [ | 8 | const searchValidator = [ |
@@ -46,8 +46,7 @@ const commonVideosFiltersValidator = [ | |||
46 | .custom(isStringArray).withMessage('Should have a valid all of tags array'), | 46 | .custom(isStringArray).withMessage('Should have a valid all of tags array'), |
47 | query('nsfw') | 47 | query('nsfw') |
48 | .optional() | 48 | .optional() |
49 | .toBoolean() | 49 | .custom(isNSFWQueryValid).withMessage('Should have a valid NSFW attribute'), |
50 | .custom(isBooleanValid).withMessage('Should have a valid NSFW attribute'), | ||
51 | 50 | ||
52 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 51 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
53 | logger.debug('Checking commons video filters query', { parameters: req.query }) | 52 | logger.debug('Checking commons video filters query', { parameters: req.query }) |