]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/middlewares/validators/logs.ts
Add ability to bulk delete comments
[github/Chocobozzz/PeerTube.git] / server / middlewares / validators / logs.ts
index 07f3f552f40bbe076f75cffb4a46439981d8de5d..70e4d0d99de196caf5af73910c9a905ecd7c901a 100644 (file)
@@ -24,8 +24,25 @@ const getLogsValidator = [
   }
 ]
 
+const getAuditLogsValidator = [
+  query('startDate')
+    .custom(isDateValid).withMessage('Should have a valid start date'),
+  query('endDate')
+    .optional()
+    .custom(isDateValid).withMessage('Should have a valid end date'),
+
+  (req: express.Request, res: express.Response, next: express.NextFunction) => {
+    logger.debug('Checking getAuditLogsValidator parameters.', { parameters: req.query })
+
+    if (areValidationErrors(req, res)) return
+
+    return next()
+  }
+]
+
 // ---------------------------------------------------------------------------
 
 export {
-  getLogsValidator
+  getLogsValidator,
+  getAuditLogsValidator
 }