aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-27 09:07:38 +0200
committerChocobozzz <me@florianbigard.com>2021-07-27 17:10:52 +0200
commit29837f8885eb37fa300e4b80c90a6d03ab337084 (patch)
treea7a066c6604c9adec4cb21c1bd1965c5bf253b03 /server/middlewares/validators
parent5d0095fde19d803bead7cbad0452bd09f3351adc (diff)
downloadPeerTube-29837f8885eb37fa300e4b80c90a6d03ab337084.tar.gz
PeerTube-29837f8885eb37fa300e4b80c90a6d03ab337084.tar.zst
PeerTube-29837f8885eb37fa300e4b80c90a6d03ab337084.zip
Add ability to search by host in server
Diffstat (limited to 'server/middlewares/validators')
-rw-r--r--server/middlewares/validators/search.ts5
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 @@
1import * as express from 'express' 1import * as express from 'express'
2import { query } from 'express-validator' 2import { query } from 'express-validator'
3import { isSearchTargetValid } from '@server/helpers/custom-validators/search' 3import { isSearchTargetValid } from '@server/helpers/custom-validators/search'
4import { isHostValid } from '@server/helpers/custom-validators/servers'
4import { isDateValid } from '../../helpers/custom-validators/misc' 5import { isDateValid } from '../../helpers/custom-validators/misc'
5import { logger } from '../../helpers/logger' 6import { logger } from '../../helpers/logger'
6import { areValidationErrors } from './shared' 7import { areValidationErrors } from './shared'
@@ -8,6 +9,10 @@ import { areValidationErrors } from './shared'
8const videosSearchValidator = [ 9const 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'),