mirror of
https://github.com/apricote/Listory.git
synced 2026-01-13 13:11:02 +00:00
fix(server): improve listens report response time
Do not unnecessarily join too many relations
This commit is contained in:
parent
67ea28aec7
commit
fb9b83d440
1 changed files with 5 additions and 7 deletions
|
|
@ -10,7 +10,6 @@ import {
|
|||
isSameMonth,
|
||||
isSameWeek,
|
||||
isSameYear,
|
||||
parseISO,
|
||||
parseJSON,
|
||||
startOfDay,
|
||||
sub,
|
||||
|
|
@ -69,12 +68,11 @@ export class ReportsService {
|
|||
|
||||
const interval = this.getIntervalFromPreset(timePreset);
|
||||
|
||||
const { items: listens } = await this.listensService.getListens({
|
||||
user,
|
||||
filter: { time: interval },
|
||||
page: 1,
|
||||
limit: PAGINATION_LIMIT_UNLIMITED,
|
||||
});
|
||||
const listens = await this.listensService
|
||||
.getScopedQueryBuilder()
|
||||
.byUser(user)
|
||||
.duringInterval(interval)
|
||||
.getMany();
|
||||
|
||||
const { eachOfInterval, isSame } = timeframeToDateFns[timeFrame];
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue