From 05de9038a84dbc82fdfb7a69abee1e4d491e5617 Mon Sep 17 00:00:00 2001 From: Krystof Date: Thu, 14 Nov 2024 02:57:24 +0100 Subject: [PATCH] refactor(be): departures count limit --- .../src/modules/departure/departure.service.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/apps/backend/src/modules/departure/departure.service.ts b/apps/backend/src/modules/departure/departure.service.ts index cb422fe0..eb1452a2 100644 --- a/apps/backend/src/modules/departure/departure.service.ts +++ b/apps/backend/src/modules/departure/departure.service.ts @@ -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) {