wip
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import type { IRaceRegistrationRepository } from '@gridpilot/racing/domain/repositories/IRaceRegistrationRepository';
|
||||
|
||||
export interface IsDriverRegisteredForRaceQueryParams {
|
||||
raceId: string;
|
||||
driverId: string;
|
||||
}
|
||||
|
||||
export class IsDriverRegisteredForRaceQuery {
|
||||
constructor(
|
||||
private readonly registrationRepository: IRaceRegistrationRepository,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Read-only wrapper around IRaceRegistrationRepository.isRegistered.
|
||||
* Mirrors legacy isRegistered behavior.
|
||||
*/
|
||||
async execute(params: IsDriverRegisteredForRaceQueryParams): Promise<boolean> {
|
||||
const { raceId, driverId } = params;
|
||||
return this.registrationRepository.isRegistered(raceId, driverId);
|
||||
}
|
||||
}
|
||||
|
||||
export interface GetRaceRegistrationsQueryParams {
|
||||
raceId: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Query object returning registered driver IDs for a race.
|
||||
* Mirrors legacy getRegisteredDrivers behavior.
|
||||
*/
|
||||
export class GetRaceRegistrationsQuery {
|
||||
constructor(
|
||||
private readonly registrationRepository: IRaceRegistrationRepository,
|
||||
) {}
|
||||
|
||||
async execute(params: GetRaceRegistrationsQueryParams): Promise<string[]> {
|
||||
const { raceId } = params;
|
||||
return this.registrationRepository.getRegisteredDrivers(raceId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user