presenter refactoring
This commit is contained in:
33
apps/api/src/domain/team/presenters/UpdateTeamPresenter.ts
Normal file
33
apps/api/src/domain/team/presenters/UpdateTeamPresenter.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import type { UpdateTeamOutputDTO } from '../dtos/UpdateTeamOutputDTO';
|
||||
|
||||
export class UpdateTeamPresenter {
|
||||
private result: UpdateTeamOutputDTO | null = null;
|
||||
|
||||
reset(): void {
|
||||
this.result = null;
|
||||
}
|
||||
|
||||
presentSuccess(): void {
|
||||
this.result = {
|
||||
success: true,
|
||||
};
|
||||
}
|
||||
|
||||
presentError(): void {
|
||||
this.result = {
|
||||
success: false,
|
||||
};
|
||||
}
|
||||
|
||||
getViewModel(): UpdateTeamOutputDTO | null {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
get viewModel(): UpdateTeamOutputDTO {
|
||||
if (!this.result) {
|
||||
throw new Error('Presenter not presented');
|
||||
}
|
||||
|
||||
return this.result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user