Add advanced search in client

This commit is contained in:
Chocobozzz 2018-07-20 18:31:49 +02:00
parent d525fc399a
commit 0b18f4aa80
21 changed files with 583 additions and 33 deletions

View file

@ -2,7 +2,7 @@ import * as express from 'express'
import { areValidationErrors } from './utils'
import { logger } from '../../helpers/logger'
import { query } from 'express-validator/check'
import { isNumberArray, isStringArray } from '../../helpers/custom-validators/search'
import { isNumberArray, isStringArray, isNSFWQueryValid } from '../../helpers/custom-validators/search'
import { isBooleanValid, isDateValid, toArray } from '../../helpers/custom-validators/misc'
const searchValidator = [
@ -46,8 +46,7 @@ const commonVideosFiltersValidator = [
.custom(isStringArray).withMessage('Should have a valid all of tags array'),
query('nsfw')
.optional()
.toBoolean()
.custom(isBooleanValid).withMessage('Should have a valid NSFW attribute'),
.custom(isNSFWQueryValid).withMessage('Should have a valid NSFW attribute'),
(req: express.Request, res: express.Response, next: express.NextFunction) => {
logger.debug('Checking commons video filters query', { parameters: req.query })