53 lines
1.2 KiB
TypeScript
53 lines
1.2 KiB
TypeScript
import { ProtestDetailViewData } from '@/lib/view-data/ProtestDetailViewData';
|
|
|
|
interface ProtestDetailApiDto {
|
|
id: string;
|
|
leagueId: string;
|
|
status: string;
|
|
submittedAt: string;
|
|
incident: {
|
|
lap: number;
|
|
description: string;
|
|
};
|
|
protestingDriver: {
|
|
id: string;
|
|
name: string;
|
|
};
|
|
accusedDriver: {
|
|
id: string;
|
|
name: string;
|
|
};
|
|
race: {
|
|
id: string;
|
|
name: string;
|
|
scheduledAt: string;
|
|
};
|
|
penaltyTypes: Array<{
|
|
type: string;
|
|
label: string;
|
|
description: string;
|
|
}>;
|
|
}
|
|
|
|
import { ViewDataBuilder } from "../../contracts/builders/ViewDataBuilder";
|
|
|
|
export class ProtestDetailViewDataBuilder implements ViewDataBuilder<any, any> {
|
|
build(input: any): any {
|
|
return ProtestDetailViewDataBuilder.build(input);
|
|
}
|
|
|
|
static build(
|
|
static build(apiDto: ProtestDetailApiDto): ProtestDetailViewData {
|
|
return {
|
|
protestId: apiDto.id,
|
|
leagueId: apiDto.leagueId,
|
|
status: apiDto.status,
|
|
submittedAt: apiDto.submittedAt,
|
|
incident: apiDto.incident,
|
|
protestingDriver: apiDto.protestingDriver,
|
|
accusedDriver: apiDto.accusedDriver,
|
|
race: apiDto.race,
|
|
penaltyTypes: apiDto.penaltyTypes,
|
|
};
|
|
}
|
|
} |