From b033851fb54241bb703f86add025229e68cc6f59 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 29 Jul 2021 10:27:24 +0200 Subject: Search channels against handles and not names --- server/middlewares/validators/search.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'server/middlewares/validators') diff --git a/server/middlewares/validators/search.ts b/server/middlewares/validators/search.ts index cde300968..27d0e541d 100644 --- a/server/middlewares/validators/search.ts +++ b/server/middlewares/validators/search.ts @@ -2,7 +2,7 @@ import * as express from 'express' import { query } from 'express-validator' import { isSearchTargetValid } from '@server/helpers/custom-validators/search' import { isHostValid } from '@server/helpers/custom-validators/servers' -import { areUUIDsValid, isDateValid, toCompleteUUIDs } from '../../helpers/custom-validators/misc' +import { areUUIDsValid, isDateValid, isNotEmptyStringArray, toCompleteUUIDs } from '../../helpers/custom-validators/misc' import { logger } from '../../helpers/logger' import { areValidationErrors } from './shared' @@ -64,9 +64,10 @@ const videoChannelsListSearchValidator = [ .optional() .custom(isSearchTargetValid).withMessage('Should have a valid search target'), - query('names') + query('handles') .optional() - .toArray(), + .toArray() + .custom(isNotEmptyStringArray).withMessage('Should have valid handles'), (req: express.Request, res: express.Response, next: express.NextFunction) => { logger.debug('Checking video channels search query', { parameters: req.query }) -- cgit v1.2.3