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

@@ -0,0 +1,36 @@
import type { CreateTeamOutputPort } from '@core/racing/application/ports/output/CreateTeamOutputPort';
import type { CreateTeamOutputDTO } from '../dtos/CreateTeamOutputDTO';
export class CreateTeamPresenter {
private result: CreateTeamOutputDTO | null = null;
reset(): void {
this.result = null;
}
presentSuccess(output: CreateTeamOutputPort): void {
this.result = {
id: output.team.id,
success: true,
};
}
presentError(): void {
this.result = {
id: '',
success: false,
};
}
getViewModel(): CreateTeamOutputDTO | null {
return this.result;
}
get viewModel(): CreateTeamOutputDTO {
if (!this.result) {
throw new Error('Presenter not presented');
}
return this.result;
}
}