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/controllers/api/videos/stats.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'server/controllers') 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 @@ import express from 'express' import { LocalVideoViewerModel } from '@server/models/view/local-video-viewer' -import { VideoStatsTimeserieMetric, VideoStatsTimeserieQuery } from '@shared/models' +import { VideoStatsOverallQuery, VideoStatsTimeserieMetric, VideoStatsTimeserieQuery } from '@shared/models' import { asyncMiddleware, authenticate, @@ -39,8 +39,13 @@ export { async function getOverallStats (req: express.Request, res: express.Response) { const video = res.locals.videoAll + const query = req.query as VideoStatsOverallQuery - const stats = await LocalVideoViewerModel.getOverallStats(video) + const stats = await LocalVideoViewerModel.getOverallStats({ + video, + startDate: query.startDate, + endDate: query.endDate + }) return res.json(stats) } -- cgit v1.2.3