services refactor
This commit is contained in:
@@ -1,14 +1,27 @@
|
||||
import { api as api } from '../../api';
|
||||
import { presentDriverRegistrationStatus } from '../../presenters';
|
||||
import { DriverRegistrationStatusViewModel } from '../../view-models';
|
||||
import type { DriversApiClient } from '../../api/drivers/DriversApiClient';
|
||||
import type { DriverRegistrationStatusPresenter } from '../../presenters/DriverRegistrationStatusPresenter';
|
||||
import type { DriverRegistrationStatusViewModel } from '../../view-models';
|
||||
|
||||
export async function getDriverRegistrationStatus(driverId: string): Promise<DriverRegistrationStatusViewModel> {
|
||||
// TODO: implement API call
|
||||
const dto = { driverId, status: 'pending' };
|
||||
return presentDriverRegistrationStatus(dto);
|
||||
}
|
||||
/**
|
||||
* Driver Registration Service
|
||||
*
|
||||
* Orchestrates driver registration status operations by coordinating API calls and presentation logic.
|
||||
* All dependencies are injected via constructor.
|
||||
*/
|
||||
export class DriverRegistrationService {
|
||||
constructor(
|
||||
private readonly apiClient: DriversApiClient,
|
||||
private readonly statusPresenter: DriverRegistrationStatusPresenter
|
||||
) {}
|
||||
|
||||
export async function registerDriver(input: any): Promise<any> {
|
||||
// TODO: implement
|
||||
return {};
|
||||
/**
|
||||
* Get driver registration status for a specific race
|
||||
*/
|
||||
async getDriverRegistrationStatus(
|
||||
driverId: string,
|
||||
raceId: string
|
||||
): Promise<DriverRegistrationStatusViewModel> {
|
||||
const dto = await this.apiClient.getRegistrationStatus(driverId, raceId);
|
||||
return this.statusPresenter.present(dto);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user