diff options
author | Chocobozzz <me@florianbigard.com> | 2022-05-05 14:12:57 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-05-05 14:13:14 +0200 |
commit | 49f0468d44468528c2fb2c8b0efd19cdaeeec43d (patch) | |
tree | 4fd07d5da74506729a1cbbe67548bfd9c6c76849 /server/middlewares/validators/videos/video-stats.ts | |
parent | f18a060a83d7053897173b2a24fb7984893131c7 (diff) | |
download | PeerTube-49f0468d44468528c2fb2c8b0efd19cdaeeec43d.tar.gz PeerTube-49f0468d44468528c2fb2c8b0efd19cdaeeec43d.tar.zst PeerTube-49f0468d44468528c2fb2c8b0efd19cdaeeec43d.zip |
Add filter by start/end date overall stats in api
Diffstat (limited to 'server/middlewares/validators/videos/video-stats.ts')
-rw-r--r-- | server/middlewares/validators/videos/video-stats.ts | 10 |
1 files changed, 10 insertions, 0 deletions
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 | |||
10 | const videoOverallStatsValidator = [ | 10 | const videoOverallStatsValidator = [ |
11 | isValidVideoIdParam('videoId'), | 11 | isValidVideoIdParam('videoId'), |
12 | 12 | ||
13 | query('startDate') | ||
14 | .optional() | ||
15 | .custom(isDateValid) | ||
16 | .withMessage('Should have a valid start date'), | ||
17 | |||
18 | query('endDate') | ||
19 | .optional() | ||
20 | .custom(isDateValid) | ||
21 | .withMessage('Should have a valid end date'), | ||
22 | |||
13 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 23 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
14 | logger.debug('Checking videoOverallStatsValidator parameters', { parameters: req.body }) | 24 | logger.debug('Checking videoOverallStatsValidator parameters', { parameters: req.body }) |
15 | 25 | ||