From 70d6091a6a8a1a3d532c7648d9af51cdf8735c94 Mon Sep 17 00:00:00 2001 From: Nicolai Ort Date: Fri, 20 Feb 2026 22:52:29 +0100 Subject: [PATCH] fix(RunnerSelfServiceController): Update getStationMe method to use req.stationId instead of header --- .../RunnerSelfServiceController.ts | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/controllers/RunnerSelfServiceController.ts b/src/controllers/RunnerSelfServiceController.ts index 7b2d5ef..b70299a 100644 --- a/src/controllers/RunnerSelfServiceController.ts +++ b/src/controllers/RunnerSelfServiceController.ts @@ -104,17 +104,21 @@ export class RunnerSelfServiceController { return responseScans; } - @Get('/stations/me') - @UseBefore(ScanAuth) - @ResponseSchema(ResponseScanStation) - @ResponseSchema(ScanStationNotFoundError, { statusCode: 404 }) - @OnUndefined(ScanStationNotFoundError) - @OpenAPI({ description: 'Lists basic information about the station whose token got provided.
This includes it\'s associated track.', security: [{ "StationApiToken": [] }] }) - async getStationMe(@Req() req: Request) { - let scan = await this.stationRepository.findOne({ id: parseInt(req.headers["station_id"].toString()) }, { relations: ['track'] }) - if (!scan) { throw new ScanStationNotFoundError(); } - return scan.toResponse(); - } + @Get('/stations/me') + @UseBefore(ScanAuth) + @ResponseSchema(ResponseScanStation) + @ResponseSchema(ScanStationNotFoundError, { statusCode: 404 }) + @OnUndefined(ScanStationNotFoundError) + @OpenAPI({ description: 'Lists basic information about the station whose token got provided.
This includes it\'s associated track.', security: [{ "StationApiToken": [] }] }) + async getStationMe(@Req() req: Request) { + // ScanAuth middleware sets req.stationId (not a header) + if (!req.stationId) { + throw new ScanStationNotFoundError(); + } + let scan = await this.stationRepository.findOne({ id: req.stationId }, { relations: ['track'] }) + if (!scan) { throw new ScanStationNotFoundError(); } + return scan.toResponse(); + } @Post('/runners/login') @ResponseSchema(RunnerNotFoundError, { statusCode: 404 })