view models
This commit is contained in:
@@ -1,10 +1,19 @@
|
||||
import { BaseApiClient } from '../base/BaseApiClient';
|
||||
import type {
|
||||
DriversLeaderboardDto,
|
||||
DriverRegistrationStatusDto,
|
||||
} from '../../dtos';
|
||||
// Import generated types
|
||||
import type { DriverDTO, CompleteOnboardingInputDTO, CompleteOnboardingOutputDTO } from '../../types/api-helpers';
|
||||
import type { CompleteOnboardingInputDTO, CompleteOnboardingOutputDTO, DriverRegistrationStatusDTO, DriverLeaderboardItemDTO } from '../../types/generated';
|
||||
|
||||
// TODO: Create proper DriverDTO in generated types
|
||||
type DriverDTO = {
|
||||
id: string;
|
||||
name: string;
|
||||
avatarUrl?: string;
|
||||
iracingId?: string;
|
||||
rating?: number;
|
||||
};
|
||||
|
||||
type DriversLeaderboardDto = {
|
||||
drivers: DriverLeaderboardItemDTO[];
|
||||
};
|
||||
|
||||
/**
|
||||
* Drivers API Client
|
||||
@@ -19,16 +28,16 @@ export class DriversApiClient extends BaseApiClient {
|
||||
|
||||
/** Complete driver onboarding */
|
||||
completeOnboarding(input: CompleteOnboardingInputDTO): Promise<CompleteOnboardingOutputDTO> {
|
||||
return this.post<CompleteOnboardingOutputDto>('/drivers/complete-onboarding', input);
|
||||
return this.post<CompleteOnboardingOutputDTO>('/drivers/complete-onboarding', input);
|
||||
}
|
||||
|
||||
/** Get current driver (based on session) */
|
||||
getCurrent(): Promise<DriverDTO | null> {
|
||||
return this.get<DriverDto | null>('/drivers/current');
|
||||
return this.get<DriverDTO | null>('/drivers/current');
|
||||
}
|
||||
|
||||
/** Get driver registration status for a specific race */
|
||||
getRegistrationStatus(driverId: string, raceId: string): Promise<DriverRegistrationStatusDto> {
|
||||
return this.get<DriverRegistrationStatusDto>(`/drivers/${driverId}/races/${raceId}/registration-status`);
|
||||
getRegistrationStatus(driverId: string, raceId: string): Promise<DriverRegistrationStatusDTO> {
|
||||
return this.get<DriverRegistrationStatusDTO>(`/drivers/${driverId}/races/${raceId}/registration-status`);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user