aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/search.ts
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2021-05-31 19:47:14 +0200
committerRigel Kent <sendmemail@rigelk.eu>2021-05-31 19:47:24 +0200
commit70330f63236a3200829f2ba76c10cca88326b858 (patch)
tree4f5de29d0960ca05fa92db541a577eb051e8828a /server/middlewares/validators/search.ts
parent732c95cc979c7aabaf1a0bf436b512bab3ea0426 (diff)
downloadPeerTube-70330f63236a3200829f2ba76c10cca88326b858.tar.gz
PeerTube-70330f63236a3200829f2ba76c10cca88326b858.tar.zst
PeerTube-70330f63236a3200829f2ba76c10cca88326b858.zip
improve api param message for dates
Diffstat (limited to 'server/middlewares/validators/search.ts')
-rw-r--r--server/middlewares/validators/search.ts18
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'
8const videosSearchValidator = [ 8const 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'),