22 lines
1002 B
TypeScript
22 lines
1002 B
TypeScript
import type { IRaceRegistrationRepository } from '@gridpilot/racing/domain/repositories/IRaceRegistrationRepository';
|
|
import type { IsDriverRegisteredForRaceQueryParamsDTO } from '../dto/RaceRegistrationQueryDTO';
|
|
import type { IDriverRegistrationStatusPresenter } from '../presenters/IDriverRegistrationStatusPresenter';
|
|
|
|
/**
|
|
* Use Case: IsDriverRegisteredForRaceUseCase
|
|
*
|
|
* Checks if a driver is registered for a specific race.
|
|
* Orchestrates domain logic and delegates presentation to the presenter.
|
|
*/
|
|
export class IsDriverRegisteredForRaceUseCase {
|
|
constructor(
|
|
private readonly registrationRepository: IRaceRegistrationRepository,
|
|
public readonly presenter: IDriverRegistrationStatusPresenter,
|
|
) {}
|
|
|
|
async execute(params: IsDriverRegisteredForRaceQueryParamsDTO): Promise<void> {
|
|
const { raceId, driverId } = params;
|
|
const isRegistered = await this.registrationRepository.isRegistered(raceId, driverId);
|
|
this.presenter.present(isRegistered, raceId, driverId);
|
|
}
|
|
} |