refactor dashboard module
This commit is contained in:
@@ -7,14 +7,15 @@ import { DashboardOverviewPresenter } from './presenters/DashboardOverviewPresen
|
||||
import type { Logger } from '@core/shared/application/Logger';
|
||||
|
||||
// Tokens
|
||||
import { DASHBOARD_OVERVIEW_OUTPUT_PORT_TOKEN, DASHBOARD_OVERVIEW_USE_CASE_TOKEN, LOGGER_TOKEN } from './DashboardProviders';
|
||||
import { DASHBOARD_OVERVIEW_USE_CASE_TOKEN, LOGGER_TOKEN } from './DashboardProviders';
|
||||
|
||||
@Injectable()
|
||||
export class DashboardService {
|
||||
private readonly presenter = new DashboardOverviewPresenter();
|
||||
|
||||
constructor(
|
||||
@Inject(LOGGER_TOKEN) private readonly logger: Logger,
|
||||
@Inject(DASHBOARD_OVERVIEW_USE_CASE_TOKEN) private readonly dashboardOverviewUseCase: DashboardOverviewUseCase,
|
||||
@Inject(DASHBOARD_OVERVIEW_OUTPUT_PORT_TOKEN) private readonly dashboardOverviewPresenter: DashboardOverviewPresenter, // TODO no presenter injection
|
||||
) {}
|
||||
|
||||
async getDashboardOverview(driverId: string): Promise<DashboardOverviewDTO> {
|
||||
@@ -26,6 +27,8 @@ export class DashboardService {
|
||||
throw new Error(result.unwrapErr().details?.message ?? 'Failed to get dashboard overview');
|
||||
}
|
||||
|
||||
return this.dashboardOverviewPresenter.getResponseModel();
|
||||
this.presenter.present(result);
|
||||
|
||||
return this.presenter.getResponseModel();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user