This commit is contained in:
2025-12-16 21:05:01 +01:00
parent f61e3a4e5a
commit 7532c7ed6d
207 changed files with 7861 additions and 2606 deletions

View File

@@ -1,23 +1,17 @@
import type { IRaceRepository } from '../../domain/repositories/IRaceRepository';
import type { ILeagueRepository } from '../../domain/repositories/ILeagueRepository';
import type {
IRacesPagePresenter,
RacesPageResultDTO,
RacesPageViewModel,
} from '@core/racing/application/presenters/IRacesPagePresenter';
import type { UseCase } from '@core/shared/application/UseCase';
import type { RacesPageResultDTO } from '@core/racing/application/presenters/IRacesPagePresenter';
import type { AsyncUseCase } from '@core/shared/application/AsyncUseCase';
import { Result } from '@core/shared/application/Result';
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
export class GetRacesPageDataUseCase
implements UseCase<void, RacesPageResultDTO, RacesPageViewModel, IRacesPagePresenter>
{
export class GetRacesPageDataUseCase implements AsyncUseCase<void, RacesPageResultDTO, 'NO_ERROR'> {
constructor(
private readonly raceRepository: IRaceRepository,
private readonly leagueRepository: ILeagueRepository,
) {}
async execute(_input: void, presenter: IRacesPagePresenter): Promise<void> {
presenter.reset();
async execute(): Promise<Result<RacesPageResultDTO, ApplicationErrorCode<'NO_ERROR'>>> {
const [allRaces, allLeagues] = await Promise.all([
this.raceRepository.findAll(),
this.leagueRepository.findAll(),
@@ -45,6 +39,6 @@ export class GetRacesPageDataUseCase
races,
};
presenter.present(dto);
return Result.ok(dto);
}
}