From 49f0468d44468528c2fb2c8b0efd19cdaeeec43d Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 5 May 2022 14:12:57 +0200 Subject: Add filter by start/end date overall stats in api --- server/middlewares/validators/videos/video-stats.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'server/middlewares/validators/videos') diff --git a/server/middlewares/validators/videos/video-stats.ts b/server/middlewares/validators/videos/video-stats.ts index 12509abde..f17fbcc09 100644 --- a/server/middlewares/validators/videos/video-stats.ts +++ b/server/middlewares/validators/videos/video-stats.ts @@ -10,6 +10,16 @@ import { areValidationErrors, checkUserCanManageVideo, doesVideoExist, isValidVi const videoOverallStatsValidator = [ isValidVideoIdParam('videoId'), + query('startDate') + .optional() + .custom(isDateValid) + .withMessage('Should have a valid start date'), + + query('endDate') + .optional() + .custom(isDateValid) + .withMessage('Should have a valid end date'), + async (req: express.Request, res: express.Response, next: express.NextFunction) => { logger.debug('Checking videoOverallStatsValidator parameters', { parameters: req.body }) -- cgit v1.2.3