add statistic service & add new stats to home page

This commit is contained in:
X4Lo committed 2024-07-06 21:41:18 +01:00
1 parent 90e3f936fc
commit 1b36bc66fe
7 files changed
+213 -210

No files matched your search

@@ -46,9 +46,4 @@ export class EntrySeenService {
);
}
getYearlyStats(year: number) {
return this.http.get<any>(
`${this.backend_apiUrl}/${this.apiAction}/stats-year/${year}`
);
}
}
@@ -60,9 +60,4 @@ export class EpisodeSeenService {
);
}
getYearlyStats(year: number) {
return this.http.get<any>(
`${this.backend_apiUrl}/${this.apiAction}/stats-year/${year}`
);
}
}
@@ -0,0 +1,32 @@
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { environment } from '../../../environments/environment.prod';
@Injectable({
providedIn: 'root',
})
export class StatisticsService {
private backend_apiUrl = environment.API_URL;
private apiAction = 'statistics';
constructor(private http: HttpClient) {}
fetchYearlyWatchCount(year: number) {
return this.http.get<any>(
`${this.backend_apiUrl}/${this.apiAction}/watch-count/year/${year}`
);
}
fetchAllTimeTotalWatchTime() {
return this.http.get<any>(
`${this.backend_apiUrl}/${this.apiAction}/watch-time`
);
}
fetchYearlyTotalWatchTime(year: number) {
return this.http.get<any>(
`${this.backend_apiUrl}/${this.apiAction}/watch-time/year/${year}`
);
}
}