website cleanup

This commit is contained in:
2025-12-24 21:44:58 +01:00
parent 9b683a59d3
commit d78854a4c6
277 changed files with 6141 additions and 2693 deletions

View File

@@ -2,6 +2,7 @@ import { RacesApiClient } from '../../api/races/RacesApiClient';
import { RaceDetailViewModel } from '../../view-models/RaceDetailViewModel';
import { RacesPageViewModel } from '../../view-models/RacesPageViewModel';
import { RaceStatsViewModel } from '../../view-models/RaceStatsViewModel';
import type { FileProtestCommandDTO } from '../../types/generated/FileProtestCommandDTO';
import type { RaceStatsDTO } from '../../types/generated/RaceStatsDTO';
/**
* Race Service
@@ -33,6 +34,14 @@ export class RaceService {
return new RacesPageViewModel(dto);
}
/**
* Get races page data filtered by league
*/
async getLeagueRacesPageData(leagueId: string): Promise<RacesPageViewModel> {
const dto = await this.apiClient.getPageData(leagueId);
return new RacesPageViewModel(dto);
}
/**
* Get all races page data with view model transformation
* Currently same as getRacesPageData, but can be extended for different filtering
@@ -54,14 +63,14 @@ export class RaceService {
* Register for a race
*/
async registerForRace(raceId: string, leagueId: string, driverId: string): Promise<void> {
await this.apiClient.register(raceId, { leagueId, driverId });
await this.apiClient.register(raceId, { raceId, leagueId, driverId });
}
/**
* Withdraw from a race
*/
async withdrawFromRace(raceId: string, driverId: string): Promise<void> {
await this.apiClient.withdraw(raceId, { driverId });
await this.apiClient.withdraw(raceId, { raceId, driverId });
}
/**
@@ -85,6 +94,13 @@ export class RaceService {
await this.apiClient.reopen(raceId);
}
/**
* File a protest
*/
async fileProtest(input: FileProtestCommandDTO): Promise<void> {
await this.apiClient.fileProtest(input);
}
/**
* Find races by league ID
*
@@ -92,7 +108,8 @@ export class RaceService {
* so this method deliberately signals that the operation is unavailable instead of making
* assumptions about URL structure.
*/
async findByLeagueId(_leagueId: string): Promise<never> {
throw new Error('Finding races by league ID is not supported in this build');
async findByLeagueId(leagueId: string): Promise<RacesPageViewModel['races']> {
const page = await this.getLeagueRacesPageData(leagueId);
return page.races;
}
}
}