diff options
Diffstat (limited to 'server/middlewares/validators/search.ts')
-rw-r--r-- | server/middlewares/validators/search.ts | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/server/middlewares/validators/search.ts b/server/middlewares/validators/search.ts index 78213c70d..d2f527750 100644 --- a/server/middlewares/validators/search.ts +++ b/server/middlewares/validators/search.ts | |||
@@ -8,11 +8,19 @@ import { isSearchTargetValid } from '@server/helpers/custom-validators/search' | |||
8 | const videosSearchValidator = [ | 8 | const videosSearchValidator = [ |
9 | query('search').optional().not().isEmpty().withMessage('Should have a valid search'), | 9 | query('search').optional().not().isEmpty().withMessage('Should have a valid search'), |
10 | 10 | ||
11 | query('startDate').optional().custom(isDateValid).withMessage('Should have a valid start date'), | 11 | query('startDate') |
12 | query('endDate').optional().custom(isDateValid).withMessage('Should have a valid end date'), | 12 | .optional() |
13 | 13 | .custom(isDateValid).withMessage('Should have a start date that conforms to ISO 8601'), | |
14 | query('originallyPublishedStartDate').optional().custom(isDateValid).withMessage('Should have a valid published start date'), | 14 | query('endDate') |
15 | query('originallyPublishedEndDate').optional().custom(isDateValid).withMessage('Should have a valid published end date'), | 15 | .optional() |
16 | .custom(isDateValid).withMessage('Should have a end date that conforms to ISO 8601'), | ||
17 | |||
18 | query('originallyPublishedStartDate') | ||
19 | .optional() | ||
20 | .custom(isDateValid).withMessage('Should have a published start date that conforms to ISO 8601'), | ||
21 | query('originallyPublishedEndDate') | ||
22 | .optional() | ||
23 | .custom(isDateValid).withMessage('Should have a published end date that conforms to ISO 8601'), | ||
16 | 24 | ||
17 | query('durationMin').optional().isInt().withMessage('Should have a valid min duration'), | 25 | query('durationMin').optional().isInt().withMessage('Should have a valid min duration'), |
18 | query('durationMax').optional().isInt().withMessage('Should have a valid max duration'), | 26 | query('durationMax').optional().isInt().withMessage('Should have a valid max duration'), |