refactor dtos to ports
This commit is contained in:
@@ -11,10 +11,8 @@ 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 {
|
||||
ChampionshipStandingsDTO,
|
||||
ChampionshipStandingsRowDTO,
|
||||
} from '../dto/ChampionshipStandingsDTO';
|
||||
import type { ChampionshipStandingsOutputPort } from '../ports/output/ChampionshipStandingsOutputPort';
|
||||
import type { ChampionshipStandingsRowOutputPort } from '../ports/output/ChampionshipStandingsRowOutputPort';
|
||||
|
||||
import type { AsyncUseCase } from '@core/shared/application/AsyncUseCase';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
@@ -31,7 +29,7 @@ type RecalculateChampionshipStandingsErrorCode =
|
||||
| 'CHAMPIONSHIP_CONFIG_NOT_FOUND';
|
||||
|
||||
export class RecalculateChampionshipStandingsUseCase
|
||||
implements AsyncUseCase<RecalculateChampionshipStandingsParams, ChampionshipStandingsDTO, RecalculateChampionshipStandingsErrorCode>
|
||||
implements AsyncUseCase<RecalculateChampionshipStandingsParams, ChampionshipStandingsOutputPort, RecalculateChampionshipStandingsErrorCode>
|
||||
{
|
||||
constructor(
|
||||
private readonly seasonRepository: ISeasonRepository,
|
||||
@@ -44,7 +42,7 @@ export class RecalculateChampionshipStandingsUseCase
|
||||
private readonly championshipAggregator: ChampionshipAggregator,
|
||||
) {}
|
||||
|
||||
async execute(params: RecalculateChampionshipStandingsParams): Promise<Result<ChampionshipStandingsDTO, ApplicationErrorCode<RecalculateChampionshipStandingsErrorCode>>> {
|
||||
async execute(params: RecalculateChampionshipStandingsParams): Promise<Result<ChampionshipStandingsOutputPort, ApplicationErrorCode<RecalculateChampionshipStandingsErrorCode>>> {
|
||||
const { seasonId, championshipId } = params;
|
||||
|
||||
const season = await this.seasonRepository.findById(seasonId);
|
||||
@@ -107,7 +105,7 @@ export class RecalculateChampionshipStandingsUseCase
|
||||
resultsDropped: s.resultsDropped.toNumber(),
|
||||
}));
|
||||
|
||||
const dto: ChampionshipStandingsDTO = {
|
||||
const dto: ChampionshipStandingsOutputPort = {
|
||||
seasonId,
|
||||
championshipId: championship.id,
|
||||
championshipName: championship.name,
|
||||
|
||||
Reference in New Issue
Block a user