diff options
Diffstat (limited to 'server/middlewares')
-rw-r--r-- | server/middlewares/validators/logs.ts | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/server/middlewares/validators/logs.ts b/server/middlewares/validators/logs.ts index 07f3f552f..70e4d0d99 100644 --- a/server/middlewares/validators/logs.ts +++ b/server/middlewares/validators/logs.ts | |||
@@ -24,8 +24,25 @@ const getLogsValidator = [ | |||
24 | } | 24 | } |
25 | ] | 25 | ] |
26 | 26 | ||
27 | const getAuditLogsValidator = [ | ||
28 | query('startDate') | ||
29 | .custom(isDateValid).withMessage('Should have a valid start date'), | ||
30 | query('endDate') | ||
31 | .optional() | ||
32 | .custom(isDateValid).withMessage('Should have a valid end date'), | ||
33 | |||
34 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | ||
35 | logger.debug('Checking getAuditLogsValidator parameters.', { parameters: req.query }) | ||
36 | |||
37 | if (areValidationErrors(req, res)) return | ||
38 | |||
39 | return next() | ||
40 | } | ||
41 | ] | ||
42 | |||
27 | // --------------------------------------------------------------------------- | 43 | // --------------------------------------------------------------------------- |
28 | 44 | ||
29 | export { | 45 | export { |
30 | getLogsValidator | 46 | getLogsValidator, |
47 | getAuditLogsValidator | ||
31 | } | 48 | } |