Files
gridpilot.gg/apps/api/src/domain/team/presenters/CreateTeamPresenter.ts
2026-01-16 22:32:55 +01:00

31 lines
834 B
TypeScript

import type { CreateTeamResult } from '@core/racing/application/use-cases/CreateTeamUseCase';
import type { UseCaseOutputPort } from '@core/shared/application/UseCaseOutputPort/UseCaseOutputPort/UseCaseOutputPort_TEMP_TEMP';
import type { CreateTeamOutputDTO } from '../dtos/CreateTeamOutputDTO';
export class CreateTeamPresenter implements UseCaseOutputPort<CreateTeamResult> {
private model: CreateTeamOutputDTO | null = null;
reset(): void {
this.model = null;
}
present(result: CreateTeamResult): void {
this.model = {
id: result.team.id,
success: true,
};
}
getResponseModel(): CreateTeamOutputDTO | null {
return this.model;
}
get responseModel(): CreateTeamOutputDTO {
if (!this.model) {
throw new Error('Presenter not presented');
}
return this.model;
}
}