website refactor

This commit is contained in:
2026-01-16 01:00:03 +01:00
parent ce7be39155
commit a98e3e3166
286 changed files with 5522 additions and 5261 deletions

View File

@@ -1,6 +1,6 @@
import { RacesApiClient } from '@/lib/api/races/RacesApiClient';
import { Result } from '@/lib/contracts/Result';
import { DomainError } from '@/lib/contracts/services/Service';
import { DomainError, Service } from '@/lib/contracts/services/Service';
import { ConsoleLogger } from '@/lib/infrastructure/logging/ConsoleLogger';
import { ConsoleErrorReporter } from '@/lib/infrastructure/logging/ConsoleErrorReporter';
import { getWebsiteApiBaseUrl } from '@/lib/config/apiBaseUrl';
@@ -12,7 +12,7 @@ import { ApiError } from '@/lib/api/base/ApiError';
* Orchestration service for race results operations.
* Returns raw API DTOs. No ViewModels or UX logic.
*/
export class RaceResultsService {
export class RaceResultsService implements Service {
private apiClient: RacesApiClient;
constructor() {
@@ -28,11 +28,11 @@ export class RaceResultsService {
* Get race results detail
* Returns results for a specific race
*/
async getRaceResultsDetail(raceId: string): Promise<Result<any, DomainError>> {
async getRaceResultsDetail(raceId: string): Promise<Result<unknown, DomainError>> {
try {
const data = await this.apiClient.getResultsDetail(raceId);
return Result.ok(data);
} catch (error) {
} catch (error: unknown) {
if (error instanceof ApiError) {
return Result.err({
type: this.mapApiErrorType(error.type),
@@ -41,7 +41,7 @@ export class RaceResultsService {
}
return Result.err({
type: 'unknown',
message: 'Failed to fetch race results'
message: (error as Error).message || 'Failed to fetch race results'
});
}
}
@@ -50,11 +50,11 @@ export class RaceResultsService {
* Get race with strength of field
* Returns race data with SOF calculation
*/
async getWithSOF(raceId: string): Promise<Result<any, DomainError>> {
async getWithSOF(raceId: string): Promise<Result<unknown, DomainError>> {
try {
const data = await this.apiClient.getWithSOF(raceId);
return Result.ok(data);
} catch (error) {
} catch (error: unknown) {
if (error instanceof ApiError) {
return Result.err({
type: this.mapApiErrorType(error.type),
@@ -63,7 +63,7 @@ export class RaceResultsService {
}
return Result.err({
type: 'unknown',
message: 'Failed to fetch race SOF'
message: (error as Error).message || 'Failed to fetch race SOF'
});
}
}
@@ -84,4 +84,4 @@ export class RaceResultsService {
return 'unknown';
}
}
}
}