presenter refactoring
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user