code quality
Some checks failed
CI / lint-typecheck (pull_request) Failing after 12s
CI / tests (pull_request) Has been skipped
CI / contract-tests (pull_request) Has been skipped
CI / e2e-tests (pull_request) Has been skipped
CI / comment-pr (pull_request) Has been skipped
CI / commit-types (pull_request) Has been skipped
Some checks failed
CI / lint-typecheck (pull_request) Failing after 12s
CI / tests (pull_request) Has been skipped
CI / contract-tests (pull_request) Has been skipped
CI / e2e-tests (pull_request) Has been skipped
CI / comment-pr (pull_request) Has been skipped
CI / commit-types (pull_request) Has been skipped
This commit is contained in:
@@ -5,6 +5,9 @@ import { ApiError } from '@/lib/gateways/api/base/ApiError';
|
||||
import { PenaltiesApiClient } from '@/lib/gateways/api/penalties/PenaltiesApiClient';
|
||||
import { ProtestsApiClient } from '@/lib/gateways/api/protests/ProtestsApiClient';
|
||||
import { RacesApiClient } from '@/lib/gateways/api/races/RacesApiClient';
|
||||
import type { LeagueAdminProtestsDTO } from '@/lib/types/generated/LeagueAdminProtestsDTO';
|
||||
import type { RaceDTO } from '@/lib/types/generated/RaceDTO';
|
||||
import type { DriverDTO } from '@/lib/types/generated/DriverDTO';
|
||||
import { ConsoleErrorReporter } from '@/lib/infrastructure/logging/ConsoleErrorReporter';
|
||||
import { ConsoleLogger } from '@/lib/infrastructure/logging/ConsoleLogger';
|
||||
import { RaceStewardingViewModel } from '@/lib/view-models/RaceStewardingViewModel';
|
||||
@@ -54,7 +57,7 @@ export class RaceStewardingService implements Service {
|
||||
* Get race stewarding data
|
||||
* Returns protests and penalties for a race
|
||||
*/
|
||||
async getRaceStewarding(raceId: string, driverId: string = ''): Promise<Result<unknown, DomainError>> {
|
||||
async getRaceStewarding(raceId: string, driverId: string = ''): Promise<Result<LeagueAdminProtestsDTO, DomainError>> {
|
||||
try {
|
||||
// Fetch data in parallel
|
||||
const [raceDetail, protests, penalties] = await Promise.all([
|
||||
@@ -67,8 +70,12 @@ export class RaceStewardingService implements Service {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const protestsData = protests.protests.map((p: any) => ({
|
||||
id: p.id,
|
||||
leagueId: p.leagueId,
|
||||
raceId: p.raceId,
|
||||
protestingDriverId: p.protestingDriverId,
|
||||
accusedDriverId: p.accusedDriverId,
|
||||
description: p.description,
|
||||
submittedAt: p.submittedAt,
|
||||
incident: {
|
||||
lap: p.lap,
|
||||
description: p.description,
|
||||
@@ -97,6 +104,8 @@ export class RaceStewardingService implements Service {
|
||||
pendingCount: pendingProtests.length,
|
||||
resolvedCount: resolvedProtests.length,
|
||||
penaltiesCount: penalties.penalties.length,
|
||||
racesById: raceDetail.race ? { [raceId]: raceDetail.race as unknown as RaceDTO } : {},
|
||||
driversById: { ...protests.driverMap, ...penalties.driverMap } as unknown as Record<string, DriverDTO>,
|
||||
};
|
||||
|
||||
return Result.ok(data);
|
||||
|
||||
Reference in New Issue
Block a user