Display paginated reading sessions in the book metadata view (#2003)

Co-authored-by: acx10 <acx10@users.noreply.github.com>
This commit is contained in:
ACX
2025-12-26 16:44:44 -07:00
committed by GitHub
co-authored by acx10
parent 2c1e8a99e3
commit 4712f53b8e
13 changed files with 533 additions and 117 deletions
@@ -53,30 +53,33 @@ export interface PeakHoursResponse {
providedIn: 'root'
})
export class UserStatsService {
private readonly readingSessionsUrl = `${API_CONFIG.BASE_URL}/api/v1/reading-sessions`;
private readonly readingSessionsUrl = `${API_CONFIG.BASE_URL}/api/v1/user-stats`;
private http = inject(HttpClient);
getHeatmapForYear(year: number): Observable<ReadingSessionHeatmapResponse[]> {
return this.http.get<ReadingSessionHeatmapResponse[]>(
`${this.readingSessionsUrl}/heatmap/year/${year}`
`${this.readingSessionsUrl}/heatmap`,
{ params: { year: year.toString() } }
);
}
getTimelineForWeek(year: number, month: number, week: number): Observable<ReadingSessionTimelineResponse[]> {
return this.http.get<ReadingSessionTimelineResponse[]>(
`${this.readingSessionsUrl}/timeline/week/${year}/${month}/${week}`
`${this.readingSessionsUrl}/timeline`,
{ params: { year: year.toString(), month: month.toString(), week: week.toString() } }
);
}
getGenreStats(): Observable<GenreStatsResponse[]> {
return this.http.get<GenreStatsResponse[]>(
`${this.readingSessionsUrl}/stats/genres`
`${this.readingSessionsUrl}/genres`
);
}
getCompletionTimelineForYear(year: number): Observable<CompletionTimelineResponse[]> {
return this.http.get<CompletionTimelineResponse[]>(
`${this.readingSessionsUrl}/stats/completion-timeline/year/${year}`
`${this.readingSessionsUrl}/completion-timeline`,
{ params: { year: year.toString() } }
);
}
@@ -90,7 +93,7 @@ export class UserStatsService {
}
return this.http.get<FavoriteDaysResponse[]>(
`${this.readingSessionsUrl}/stats/favorite-days`,
`${this.readingSessionsUrl}/favorite-days`,
{params}
);
}
@@ -105,7 +108,7 @@ export class UserStatsService {
}
return this.http.get<PeakHoursResponse[]>(
`${this.readingSessionsUrl}/stats/peak-hours`,
`${this.readingSessionsUrl}/peak-hours`,
{params}
);
}