aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/videos
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-05-05 14:12:57 +0200
committerChocobozzz <me@florianbigard.com>2022-05-05 14:13:14 +0200
commit49f0468d44468528c2fb2c8b0efd19cdaeeec43d (patch)
tree4fd07d5da74506729a1cbbe67548bfd9c6c76849 /server/controllers/api/videos
parentf18a060a83d7053897173b2a24fb7984893131c7 (diff)
downloadPeerTube-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/api/videos')
-rw-r--r--server/controllers/api/videos/stats.ts9
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 @@
1import express from 'express' 1import express from 'express'
2import { LocalVideoViewerModel } from '@server/models/view/local-video-viewer' 2import { LocalVideoViewerModel } from '@server/models/view/local-video-viewer'
3import { VideoStatsTimeserieMetric, VideoStatsTimeserieQuery } from '@shared/models' 3import { VideoStatsOverallQuery, VideoStatsTimeserieMetric, VideoStatsTimeserieQuery } from '@shared/models'
4import { 4import {
5 asyncMiddleware, 5 asyncMiddleware,
6 authenticate, 6 authenticate,
@@ -39,8 +39,13 @@ export {
39 39
40async function getOverallStats (req: express.Request, res: express.Response) { 40async 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}