feat(auth): Implement caching for scanauth

This commit is contained in:
2026-02-20 19:27:00 +01:00
parent 778f159405
commit 526738e487
4 changed files with 169 additions and 43 deletions

View File

@@ -80,9 +80,8 @@ export class ScanController {
@ResponseSchema(RunnerNotFoundError, { statusCode: 404 })
@OpenAPI({ description: 'Create a new track scan (for "normal" scans use /scans instead). <br> Please remember that to provide the scan\'s card\'s station\'s id.', security: [{ "StationApiToken": [] }, { "AuthToken": [] }, { "RefreshTokenCookie": [] }] })
async postTrackScans(@Body({ validate: true }) createScan: CreateTrackScan, @Req() req: Request) {
const station_id = req.headers["station_id"];
if (station_id) {
createScan.station = parseInt(station_id.toString());
if (req.isStationAuth) {
createScan.station = req.stationId;
}
let scan = await createScan.toEntity();
scan = await this.trackScanRepository.save(scan);