25 lines
689 B
TypeScript
25 lines
689 B
TypeScript
import type { Presenter } from '@core/shared/presentation/Presenter';
|
|
import { CreatePrizeResultDTO } from '../dtos/CreatePrizeDTO';
|
|
|
|
export interface ICreatePrizePresenter extends Presenter<CreatePrizeResultDTO, CreatePrizeResultDTO> {}
|
|
|
|
export class CreatePrizePresenter implements ICreatePrizePresenter {
|
|
private result: CreatePrizeResultDTO | null = null;
|
|
|
|
reset() {
|
|
this.result = null;
|
|
}
|
|
|
|
present(dto: CreatePrizeResultDTO) {
|
|
this.result = dto;
|
|
}
|
|
|
|
getResponseModel(): CreatePrizeResultDTO | null {
|
|
return this.result;
|
|
}
|
|
|
|
get viewModel(): CreatePrizeResultDTO {
|
|
if (!this.result) throw new Error('Presenter not presented');
|
|
return this.result;
|
|
}
|
|
} |