wip
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user