From f40712abbbb74e51f06037ef02757c42736bccf8 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 6 May 2022 14:23:02 +0200 Subject: Add ability to filter overall video stats by date --- client/src/app/+stats/video/video-stats.service.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'client/src/app/+stats/video/video-stats.service.ts') diff --git a/client/src/app/+stats/video/video-stats.service.ts b/client/src/app/+stats/video/video-stats.service.ts index 712d03971..e019c87f7 100644 --- a/client/src/app/+stats/video/video-stats.service.ts +++ b/client/src/app/+stats/video/video-stats.service.ts @@ -17,8 +17,18 @@ export class VideoStatsService { private restExtractor: RestExtractor ) { } - getOverallStats (videoId: string) { - return this.authHttp.get(VideoService.BASE_VIDEO_URL + '/' + videoId + '/stats/overall') + getOverallStats (options: { + videoId: string + startDate?: Date + endDate?: Date + }) { + const { videoId, startDate, endDate } = options + + let params = new HttpParams() + if (startDate) params = params.append('startDate', startDate.toISOString()) + if (endDate) params = params.append('endDate', endDate.toISOString()) + + return this.authHttp.get(VideoService.BASE_VIDEO_URL + '/' + videoId + '/stats/overall', { params }) .pipe(catchError(err => this.restExtractor.handleError(err))) } -- cgit v1.2.3