refactor use cases

This commit is contained in:
2026-01-08 15:34:51 +01:00
parent d984ab24a8
commit 52e9a2f6a7
362 changed files with 5192 additions and 8409 deletions

View File

@@ -12,9 +12,9 @@ import type { ChampionshipStanding } from '@core/racing/domain/entities/champion
import { EventScoringService } from '@core/racing/domain/services/EventScoringService';
import { ChampionshipAggregator } from '@core/racing/domain/services/ChampionshipAggregator';
import type { UseCaseOutputPort, Logger } from '@core/shared/application';
import { Result } from '@core/shared/application/Result';
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
import type { Logger } from '@core/shared/application';
export type RecalculateChampionshipStandingsInput = {
leagueId: string;
@@ -40,8 +40,7 @@ export type RecalculateChampionshipStandingsErrorCode =
| 'REPOSITORY_ERROR';
export class RecalculateChampionshipStandingsUseCase {
constructor(
private readonly leagueRepository: ILeagueRepository,
constructor(private readonly leagueRepository: ILeagueRepository,
private readonly seasonRepository: ISeasonRepository,
private readonly leagueScoringConfigRepository: ILeagueScoringConfigRepository,
private readonly raceRepository: IRaceRepository,
@@ -50,9 +49,7 @@ export class RecalculateChampionshipStandingsUseCase {
private readonly championshipStandingRepository: IChampionshipStandingRepository,
private readonly eventScoringService: EventScoringService,
private readonly championshipAggregator: ChampionshipAggregator,
private readonly logger: Logger,
private readonly output: UseCaseOutputPort<RecalculateChampionshipStandingsResult>,
) {}
private readonly logger: Logger) {}
async execute(
input: RecalculateChampionshipStandingsInput,
@@ -135,8 +132,6 @@ export class RecalculateChampionshipStandingsUseCase {
})),
};
this.output.present(result);
return Result.ok(undefined);
} catch (error) {
const err = error as Error;