diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-27 09:07:38 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-27 17:10:52 +0200 |
commit | 29837f8885eb37fa300e4b80c90a6d03ab337084 (patch) | |
tree | a7a066c6604c9adec4cb21c1bd1965c5bf253b03 /server/middlewares | |
parent | 5d0095fde19d803bead7cbad0452bd09f3351adc (diff) | |
download | PeerTube-29837f8885eb37fa300e4b80c90a6d03ab337084.tar.gz PeerTube-29837f8885eb37fa300e4b80c90a6d03ab337084.tar.zst PeerTube-29837f8885eb37fa300e4b80c90a6d03ab337084.zip |
Add ability to search by host in server
Diffstat (limited to 'server/middlewares')
-rw-r--r-- | server/middlewares/validators/search.ts | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/server/middlewares/validators/search.ts b/server/middlewares/validators/search.ts index 7bbf81048..6bb335127 100644 --- a/server/middlewares/validators/search.ts +++ b/server/middlewares/validators/search.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { query } from 'express-validator' | 2 | import { query } from 'express-validator' |
3 | import { isSearchTargetValid } from '@server/helpers/custom-validators/search' | 3 | import { isSearchTargetValid } from '@server/helpers/custom-validators/search' |
4 | import { isHostValid } from '@server/helpers/custom-validators/servers' | ||
4 | import { isDateValid } from '../../helpers/custom-validators/misc' | 5 | import { isDateValid } from '../../helpers/custom-validators/misc' |
5 | import { logger } from '../../helpers/logger' | 6 | import { logger } from '../../helpers/logger' |
6 | import { areValidationErrors } from './shared' | 7 | import { areValidationErrors } from './shared' |
@@ -8,6 +9,10 @@ import { areValidationErrors } from './shared' | |||
8 | const videosSearchValidator = [ | 9 | const videosSearchValidator = [ |
9 | query('search').optional().not().isEmpty().withMessage('Should have a valid search'), | 10 | query('search').optional().not().isEmpty().withMessage('Should have a valid search'), |
10 | 11 | ||
12 | query('host') | ||
13 | .optional() | ||
14 | .custom(isHostValid).withMessage('Should have a valid host'), | ||
15 | |||
11 | query('startDate') | 16 | query('startDate') |
12 | .optional() | 17 | .optional() |
13 | .custom(isDateValid).withMessage('Should have a start date that conforms to ISO 8601'), | 18 | .custom(isDateValid).withMessage('Should have a start date that conforms to ISO 8601'), |