diff options
author | Chocobozzz <me@florianbigard.com> | 2019-12-11 14:14:01 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-12-11 14:14:01 +0100 |
commit | 566c125d6eee3bd907404523d94e1e0b5e403a46 (patch) | |
tree | c477cdd2ba745015d80052968c37927b1bca1254 /server/middlewares | |
parent | 92e0f42e8ce5f1ab5e4023900b8194627231a11b (diff) | |
download | PeerTube-566c125d6eee3bd907404523d94e1e0b5e403a46.tar.gz PeerTube-566c125d6eee3bd907404523d94e1e0b5e403a46.tar.zst PeerTube-566c125d6eee3bd907404523d94e1e0b5e403a46.zip |
Serve audit logs to client
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 | } |