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 --- shared/models/videos/stats/index.ts | 1 + shared/models/videos/stats/video-stats-overall-query.model.ts | 4 ++++ shared/server-commands/videos/video-stats-command.ts | 4 ++++ 3 files changed, 9 insertions(+) create mode 100644 shared/models/videos/stats/video-stats-overall-query.model.ts (limited to 'shared') diff --git a/shared/models/videos/stats/index.ts b/shared/models/videos/stats/index.ts index 4a6fdaa71..a9b203f58 100644 --- a/shared/models/videos/stats/index.ts +++ b/shared/models/videos/stats/index.ts @@ -1,3 +1,4 @@ +export * from './video-stats-overall-query.model' export * from './video-stats-overall.model' export * from './video-stats-retention.model' export * from './video-stats-timeserie-query.model' diff --git a/shared/models/videos/stats/video-stats-overall-query.model.ts b/shared/models/videos/stats/video-stats-overall-query.model.ts new file mode 100644 index 000000000..6b4c2164f --- /dev/null +++ b/shared/models/videos/stats/video-stats-overall-query.model.ts @@ -0,0 +1,4 @@ +export interface VideoStatsOverallQuery { + startDate?: string + endDate?: string +} diff --git a/shared/server-commands/videos/video-stats-command.ts b/shared/server-commands/videos/video-stats-command.ts index bd4808f63..b9b99bfb5 100644 --- a/shared/server-commands/videos/video-stats-command.ts +++ b/shared/server-commands/videos/video-stats-command.ts @@ -6,6 +6,8 @@ export class VideoStatsCommand extends AbstractCommand { getOverallStats (options: OverrideCommandOptions & { videoId: number | string + startDate?: string + endDate?: string }) { const path = '/api/v1/videos/' + options.videoId + '/stats/overall' @@ -13,6 +15,8 @@ export class VideoStatsCommand extends AbstractCommand { ...options, path, + query: pick(options, [ 'startDate', 'endDate' ]), + implicitToken: true, defaultExpectedStatus: HttpStatusCode.OK_200 }) -- cgit v1.2.3