presenter refactoring

This commit is contained in:
2025-12-20 17:06:11 +01:00
parent 92be9d2e1b
commit e9d6f90bb2
109 changed files with 4159 additions and 1283 deletions

View File

@@ -1,8 +1,8 @@
import { Injectable, Inject } from '@nestjs/common';
import { plainToClass } from 'class-transformer';
import { DashboardOverviewUseCase } from '@core/racing/application/use-cases/DashboardOverviewUseCase';
import type { DashboardOverviewOutputPort } from '@core/racing/application/ports/output/DashboardOverviewOutputPort';
import { DashboardOverviewDTO } from './dtos/DashboardOverviewDTO';
import { DashboardOverviewPresenter } from './presenters/DashboardOverviewPresenter';
// Core imports
import type { Logger } from '@core/shared/application/Logger';
@@ -64,7 +64,7 @@ export class DashboardService {
);
}
async getDashboardOverview(driverId: string): Promise<DashboardOverviewDTO> {
async getDashboardOverview(driverId: string): Promise<DashboardOverviewPresenter> {
this.logger.debug('[DashboardService] Getting dashboard overview:', { driverId });
const result = await this.dashboardOverviewUseCase.execute({ driverId });
@@ -73,6 +73,8 @@ export class DashboardService {
throw new Error(result.error?.message || 'Failed to get dashboard overview');
}
return plainToClass(DashboardOverviewDTO, result.value);
const presenter = new DashboardOverviewPresenter();
presenter.present(result.value as DashboardOverviewOutputPort);
return presenter;
}
}