refactor core presenters

This commit is contained in:
2025-12-19 19:42:19 +01:00
parent 8116fe888f
commit 94fc538f44
228 changed files with 2817 additions and 3097 deletions

View File

@@ -1,6 +1,6 @@
import type { IStandingRepository } from '../../domain/repositories/IStandingRepository';
import type { IDriverRepository } from '../../domain/repositories/IDriverRepository';
import type { LeagueStandingsViewModel } from '../presenters/ILeagueStandingsPresenter';
import type { LeagueStandingsOutputPort } from '../ports/output/LeagueStandingsOutputPort';
import { Result } from '@core/shared/application/Result';
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
@@ -19,7 +19,7 @@ export class GetLeagueStandingsUseCase {
async execute(
params: GetLeagueStandingsUseCaseParams,
): Promise<Result<LeagueStandingsViewModel, ApplicationErrorCode<'REPOSITORY_ERROR'>>> {
): Promise<Result<LeagueStandingsOutputPort, ApplicationErrorCode<'REPOSITORY_ERROR'>>> {
try {
const standings = await this.standingRepository.findByLeagueId(params.leagueId);
const driverIds = [...new Set(standings.map(s => s.driverId))];
@@ -27,7 +27,7 @@ export class GetLeagueStandingsUseCase {
const driverResults = await Promise.all(driverPromises);
const drivers = driverResults.filter((d): d is NonNullable<typeof d> => d !== null);
const driverMap = new Map(drivers.map(d => [d.id, { id: d.id, name: d.name }]));
const viewModel: LeagueStandingsViewModel = {
const viewModel: LeagueStandingsOutputPort = {
standings: standings.map(s => ({
driverId: s.driverId,
driver: driverMap.get(s.driverId)!,