This commit is contained in:
2025-12-21 19:53:22 +01:00
parent f2d8a23583
commit 3c64f328e2
105 changed files with 3191 additions and 1706 deletions

View File

@@ -1,21 +1,22 @@
import { DriverStatsDTO } from '../dtos/DriverStatsDTO';
import type { TotalDriversOutputPort } from '../../../../../core/racing/application/ports/output/TotalDriversOutputPort';
import type {
GetTotalDriversResult,
} from '@core/racing/application/use-cases/GetTotalDriversUseCase';
import type { UseCaseOutputPort } from '@core/shared/application/UseCaseOutputPort';
export class DriverStatsPresenter {
private result: DriverStatsDTO | null = null;
export class DriverStatsPresenter
implements UseCaseOutputPort<GetTotalDriversResult>
{
private responseModel: DriverStatsDTO | null = null;
reset() {
this.result = null;
}
present(output: TotalDriversOutputPort) {
this.result = {
totalDrivers: output.totalDrivers,
present(result: GetTotalDriversResult): void {
this.responseModel = {
totalDrivers: result.totalDrivers,
};
}
get viewModel(): DriverStatsDTO {
if (!this.result) throw new Error('Presenter not presented');
return this.result;
getResponseModel(): DriverStatsDTO {
if (!this.responseModel) throw new Error('Presenter not presented');
return this.responseModel;
}
}