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,18 +1,20 @@
import { SeasonScheduleGenerator } from '../../domain/services/SeasonScheduleGenerator';
import type { LeagueSchedulePreviewDTO, LeagueScheduleDTO } from '../dto/LeagueScheduleDTO';
import { scheduleDTOToSeasonSchedule } from '../dto/LeagueScheduleDTO';
import type { ILeagueSchedulePreviewPresenter } from '../presenters/ILeagueSchedulePreviewPresenter';
interface PreviewLeagueScheduleQueryParams {
schedule: LeagueScheduleDTO;
maxRounds?: number;
}
export class PreviewLeagueScheduleQuery {
export class PreviewLeagueScheduleUseCase {
constructor(
private readonly scheduleGenerator: typeof SeasonScheduleGenerator = SeasonScheduleGenerator,
private readonly presenter: ILeagueSchedulePreviewPresenter,
) {}
execute(params: PreviewLeagueScheduleQueryParams): LeagueSchedulePreviewDTO {
execute(params: PreviewLeagueScheduleQueryParams): void {
const seasonSchedule = scheduleDTOToSeasonSchedule(params.schedule);
const maxRounds =
@@ -30,10 +32,10 @@ export class PreviewLeagueScheduleQuery {
const summary = this.buildSummary(params.schedule, rounds);
return {
this.presenter.present({
rounds,
summary,
};
});
}
private buildSummary(