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/controllers | |
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/controllers')
-rw-r--r-- | server/controllers/api/videos/stats.ts | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/server/controllers/api/videos/stats.ts b/server/controllers/api/videos/stats.ts index 71452d9f0..30e2bb06c 100644 --- a/server/controllers/api/videos/stats.ts +++ b/server/controllers/api/videos/stats.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import express from 'express' | 1 | import express from 'express' |
2 | import { LocalVideoViewerModel } from '@server/models/view/local-video-viewer' | 2 | import { LocalVideoViewerModel } from '@server/models/view/local-video-viewer' |
3 | import { VideoStatsTimeserieMetric, VideoStatsTimeserieQuery } from '@shared/models' | 3 | import { VideoStatsOverallQuery, VideoStatsTimeserieMetric, VideoStatsTimeserieQuery } from '@shared/models' |
4 | import { | 4 | import { |
5 | asyncMiddleware, | 5 | asyncMiddleware, |
6 | authenticate, | 6 | authenticate, |
@@ -39,8 +39,13 @@ export { | |||
39 | 39 | ||
40 | async function getOverallStats (req: express.Request, res: express.Response) { | 40 | async function getOverallStats (req: express.Request, res: express.Response) { |
41 | const video = res.locals.videoAll | 41 | const video = res.locals.videoAll |
42 | const query = req.query as VideoStatsOverallQuery | ||
42 | 43 | ||
43 | const stats = await LocalVideoViewerModel.getOverallStats(video) | 44 | const stats = await LocalVideoViewerModel.getOverallStats({ |
45 | video, | ||
46 | startDate: query.startDate, | ||
47 | endDate: query.endDate | ||
48 | }) | ||
44 | 49 | ||
45 | return res.json(stats) | 50 | return res.json(stats) |
46 | } | 51 | } |