This commit is contained in:
2025-12-10 18:28:32 +01:00
parent 6d61be9c51
commit 1303a14493
108 changed files with 3366 additions and 1559 deletions

View File

@@ -1,17 +1,22 @@
import type { IRaceRegistrationRepository } from '@gridpilot/racing/domain/repositories/IRaceRegistrationRepository';
import type { IsDriverRegisteredForRaceQueryParamsDTO } from '../dto/RaceRegistrationQueryDTO';
import type { IDriverRegistrationStatusPresenter } from '../presenters/IDriverRegistrationStatusPresenter';
/**
* Read-only wrapper around IRaceRegistrationRepository.isRegistered.
* Mirrors legacy isRegistered behavior.
* Use Case: IsDriverRegisteredForRaceUseCase
*
* Checks if a driver is registered for a specific race.
* Orchestrates domain logic and delegates presentation to the presenter.
*/
export class IsDriverRegisteredForRaceQuery {
export class IsDriverRegisteredForRaceUseCase {
constructor(
private readonly registrationRepository: IRaceRegistrationRepository,
public readonly presenter: IDriverRegistrationStatusPresenter,
) {}
async execute(params: IsDriverRegisteredForRaceQueryParamsDTO): Promise<boolean> {
async execute(params: IsDriverRegisteredForRaceQueryParamsDTO): Promise<void> {
const { raceId, driverId } = params;
return this.registrationRepository.isRegistered(raceId, driverId);
const isRegistered = await this.registrationRepository.isRegistered(raceId, driverId);
this.presenter.present(isRegistered, raceId, driverId);
}
}