Skip to content

Commit

Permalink
refactor(be): departures count limit
Browse files Browse the repository at this point in the history
  • Loading branch information
krystxf committed Nov 14, 2024
1 parent b272ece commit 05de903
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions apps/backend/src/modules/departure/departure.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,24 @@ export class DepartureService {
return [];
}

const endpoint = `/v2/pid/departureboards`;
const searchParams = new URLSearchParams(
allPlatformIds
.map((id) => ["ids", id])
.concat([
["skip", "canceled"],
["mode", "departures"],
["order", "real"],
]),
.concat(
Object.entries({
skip: "canceled",
mode: "departures",
order: "real",
minutesBefore: String(5),
minutesAfter: String(24 * 60),
limit: String(1_000), // default limit is 20 which is too low, 1000 should be the maximum
}),
),
);

const res = await this.golemioService.getGolemioData(
`/v2/pid/departureboards?minutesAfter=600&${searchParams.toString()}`,
`${endpoint}?${searchParams}`,
);

if (!res.ok) {
Expand Down

0 comments on commit 05de903

Please sign in to comment.