diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2021-05-31 19:47:14 +0200 |
---|---|---|
committer | Rigel Kent <sendmemail@rigelk.eu> | 2021-05-31 19:47:24 +0200 |
commit | 70330f63236a3200829f2ba76c10cca88326b858 (patch) | |
tree | 4f5de29d0960ca05fa92db541a577eb051e8828a /server/middlewares/validators/logs.ts | |
parent | 732c95cc979c7aabaf1a0bf436b512bab3ea0426 (diff) | |
download | PeerTube-70330f63236a3200829f2ba76c10cca88326b858.tar.gz PeerTube-70330f63236a3200829f2ba76c10cca88326b858.tar.zst PeerTube-70330f63236a3200829f2ba76c10cca88326b858.zip |
improve api param message for dates
Diffstat (limited to 'server/middlewares/validators/logs.ts')
-rw-r--r-- | server/middlewares/validators/logs.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/server/middlewares/validators/logs.ts b/server/middlewares/validators/logs.ts index 70e4d0d99..ba817d9a9 100644 --- a/server/middlewares/validators/logs.ts +++ b/server/middlewares/validators/logs.ts | |||
@@ -7,13 +7,13 @@ import { isValidLogLevel } from '../../helpers/custom-validators/logs' | |||
7 | 7 | ||
8 | const getLogsValidator = [ | 8 | const getLogsValidator = [ |
9 | query('startDate') | 9 | query('startDate') |
10 | .custom(isDateValid).withMessage('Should have a valid start date'), | 10 | .custom(isDateValid).withMessage('Should have a start date that conforms to ISO 8601'), |
11 | query('level') | 11 | query('level') |
12 | .optional() | 12 | .optional() |
13 | .custom(isValidLogLevel).withMessage('Should have a valid level'), | 13 | .custom(isValidLogLevel).withMessage('Should have a valid level'), |
14 | query('endDate') | 14 | query('endDate') |
15 | .optional() | 15 | .optional() |
16 | .custom(isDateValid).withMessage('Should have a valid end date'), | 16 | .custom(isDateValid).withMessage('Should have an end date that conforms to ISO 8601'), |
17 | 17 | ||
18 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 18 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
19 | logger.debug('Checking getLogsValidator parameters.', { parameters: req.query }) | 19 | logger.debug('Checking getLogsValidator parameters.', { parameters: req.query }) |
@@ -26,10 +26,10 @@ const getLogsValidator = [ | |||
26 | 26 | ||
27 | const getAuditLogsValidator = [ | 27 | const getAuditLogsValidator = [ |
28 | query('startDate') | 28 | query('startDate') |
29 | .custom(isDateValid).withMessage('Should have a valid start date'), | 29 | .custom(isDateValid).withMessage('Should have a start date that conforms to ISO 8601'), |
30 | query('endDate') | 30 | query('endDate') |
31 | .optional() | 31 | .optional() |
32 | .custom(isDateValid).withMessage('Should have a valid end date'), | 32 | .custom(isDateValid).withMessage('Should have a end date that conforms to ISO 8601'), |
33 | 33 | ||
34 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 34 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
35 | logger.debug('Checking getAuditLogsValidator parameters.', { parameters: req.query }) | 35 | logger.debug('Checking getAuditLogsValidator parameters.', { parameters: req.query }) |