mirror of
https://github.com/apricote/Listory.git
synced 2026-01-13 21:21: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,
|
isSameMonth,
|
||||||
isSameWeek,
|
isSameWeek,
|
||||||
isSameYear,
|
isSameYear,
|
||||||
parseISO,
|
|
||||||
parseJSON,
|
parseJSON,
|
||||||
startOfDay,
|
startOfDay,
|
||||||
sub,
|
sub,
|
||||||
|
|
@ -69,12 +68,11 @@ export class ReportsService {
|
||||||
|
|
||||||
const interval = this.getIntervalFromPreset(timePreset);
|
const interval = this.getIntervalFromPreset(timePreset);
|
||||||
|
|
||||||
const { items: listens } = await this.listensService.getListens({
|
const listens = await this.listensService
|
||||||
user,
|
.getScopedQueryBuilder()
|
||||||
filter: { time: interval },
|
.byUser(user)
|
||||||
page: 1,
|
.duringInterval(interval)
|
||||||
limit: PAGINATION_LIMIT_UNLIMITED,
|
.getMany();
|
||||||
});
|
|
||||||
|
|
||||||
const { eachOfInterval, isSame } = timeframeToDateFns[timeFrame];
|
const { eachOfInterval, isSame } = timeframeToDateFns[timeFrame];
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue