refactor
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import type {
|
||||
IAwardPrizePresenter,
|
||||
AwardPrizeResultDTO,
|
||||
AwardPrizeViewModel,
|
||||
} from '@gridpilot/payments/application/presenters/IAwardPrizePresenter';
|
||||
|
||||
export class AwardPrizePresenter implements IAwardPrizePresenter {
|
||||
private result: AwardPrizeViewModel | null = null;
|
||||
|
||||
reset() {
|
||||
this.result = null;
|
||||
}
|
||||
|
||||
present(dto: AwardPrizeResultDTO) {
|
||||
this.result = dto;
|
||||
}
|
||||
|
||||
getViewModel(): AwardPrizeViewModel | null {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
get viewModel(): AwardPrizeViewModel {
|
||||
if (!this.result) throw new Error('Presenter not presented');
|
||||
return this.result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import type {
|
||||
ICreatePaymentPresenter,
|
||||
CreatePaymentResultDTO,
|
||||
CreatePaymentViewModel,
|
||||
} from '@gridpilot/payments/application/presenters/ICreatePaymentPresenter';
|
||||
|
||||
export class CreatePaymentPresenter implements ICreatePaymentPresenter {
|
||||
private result: CreatePaymentViewModel | null = null;
|
||||
|
||||
reset() {
|
||||
this.result = null;
|
||||
}
|
||||
|
||||
present(dto: CreatePaymentResultDTO) {
|
||||
this.result = dto;
|
||||
}
|
||||
|
||||
getViewModel(): CreatePaymentViewModel | null {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
get viewModel(): CreatePaymentViewModel {
|
||||
if (!this.result) throw new Error('Presenter not presented');
|
||||
return this.result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import type {
|
||||
ICreatePrizePresenter,
|
||||
CreatePrizeResultDTO,
|
||||
CreatePrizeViewModel,
|
||||
} from '@gridpilot/payments/application/presenters/ICreatePrizePresenter';
|
||||
|
||||
export class CreatePrizePresenter implements ICreatePrizePresenter {
|
||||
private result: CreatePrizeViewModel | null = null;
|
||||
|
||||
reset() {
|
||||
this.result = null;
|
||||
}
|
||||
|
||||
present(dto: CreatePrizeResultDTO) {
|
||||
this.result = dto;
|
||||
}
|
||||
|
||||
getViewModel(): CreatePrizeViewModel | null {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
get viewModel(): CreatePrizeViewModel {
|
||||
if (!this.result) throw new Error('Presenter not presented');
|
||||
return this.result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import type {
|
||||
IDeletePrizePresenter,
|
||||
DeletePrizeResultDTO,
|
||||
DeletePrizeViewModel,
|
||||
} from '@gridpilot/payments/application/presenters/IDeletePrizePresenter';
|
||||
|
||||
export class DeletePrizePresenter implements IDeletePrizePresenter {
|
||||
private result: DeletePrizeViewModel | null = null;
|
||||
|
||||
reset() {
|
||||
this.result = null;
|
||||
}
|
||||
|
||||
present(dto: DeletePrizeResultDTO) {
|
||||
this.result = dto;
|
||||
}
|
||||
|
||||
getViewModel(): DeletePrizeViewModel | null {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
get viewModel(): DeletePrizeViewModel {
|
||||
if (!this.result) throw new Error('Presenter not presented');
|
||||
return this.result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import type {
|
||||
IGetMembershipFeesPresenter,
|
||||
GetMembershipFeesResultDTO,
|
||||
GetMembershipFeesViewModel,
|
||||
} from '@gridpilot/payments/application/presenters/IGetMembershipFeesPresenter';
|
||||
|
||||
export class GetMembershipFeesPresenter implements IGetMembershipFeesPresenter {
|
||||
private result: GetMembershipFeesViewModel | null = null;
|
||||
|
||||
reset() {
|
||||
this.result = null;
|
||||
}
|
||||
|
||||
present(dto: GetMembershipFeesResultDTO) {
|
||||
this.result = dto;
|
||||
}
|
||||
|
||||
getViewModel(): GetMembershipFeesViewModel | null {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
get viewModel(): GetMembershipFeesViewModel {
|
||||
if (!this.result) throw new Error('Presenter not presented');
|
||||
return this.result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import type {
|
||||
IGetPaymentsPresenter,
|
||||
GetPaymentsResultDTO,
|
||||
GetPaymentsViewModel,
|
||||
} from '@gridpilot/payments/application/presenters/IGetPaymentsPresenter';
|
||||
|
||||
export class GetPaymentsPresenter implements IGetPaymentsPresenter {
|
||||
private result: GetPaymentsViewModel | null = null;
|
||||
|
||||
reset() {
|
||||
this.result = null;
|
||||
}
|
||||
|
||||
present(dto: GetPaymentsResultDTO) {
|
||||
this.result = dto;
|
||||
}
|
||||
|
||||
getViewModel(): GetPaymentsViewModel | null {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
get viewModel(): GetPaymentsViewModel {
|
||||
if (!this.result) throw new Error('Presenter not presented');
|
||||
return this.result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import type {
|
||||
IGetPrizesPresenter,
|
||||
GetPrizesResultDTO,
|
||||
GetPrizesViewModel,
|
||||
} from '@gridpilot/payments/application/presenters/IGetPrizesPresenter';
|
||||
|
||||
export class GetPrizesPresenter implements IGetPrizesPresenter {
|
||||
private result: GetPrizesViewModel | null = null;
|
||||
|
||||
reset() {
|
||||
this.result = null;
|
||||
}
|
||||
|
||||
present(dto: GetPrizesResultDTO) {
|
||||
this.result = dto;
|
||||
}
|
||||
|
||||
getViewModel(): GetPrizesViewModel | null {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
get viewModel(): GetPrizesViewModel {
|
||||
if (!this.result) throw new Error('Presenter not presented');
|
||||
return this.result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import type {
|
||||
IGetWalletPresenter,
|
||||
GetWalletResultDTO,
|
||||
GetWalletViewModel,
|
||||
} from '@gridpilot/payments/application/presenters/IGetWalletPresenter';
|
||||
|
||||
export class GetWalletPresenter implements IGetWalletPresenter {
|
||||
private result: GetWalletViewModel | null = null;
|
||||
|
||||
reset() {
|
||||
this.result = null;
|
||||
}
|
||||
|
||||
present(dto: GetWalletResultDTO) {
|
||||
this.result = dto;
|
||||
}
|
||||
|
||||
getViewModel(): GetWalletViewModel | null {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
get viewModel(): GetWalletViewModel {
|
||||
if (!this.result) throw new Error('Presenter not presented');
|
||||
return this.result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import type {
|
||||
IProcessWalletTransactionPresenter,
|
||||
ProcessWalletTransactionResultDTO,
|
||||
ProcessWalletTransactionViewModel,
|
||||
} from '@gridpilot/payments/application/presenters/IProcessWalletTransactionPresenter';
|
||||
|
||||
export class ProcessWalletTransactionPresenter implements IProcessWalletTransactionPresenter {
|
||||
private result: ProcessWalletTransactionViewModel | null = null;
|
||||
|
||||
reset() {
|
||||
this.result = null;
|
||||
}
|
||||
|
||||
present(dto: ProcessWalletTransactionResultDTO) {
|
||||
this.result = dto;
|
||||
}
|
||||
|
||||
getViewModel(): ProcessWalletTransactionViewModel | null {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
get viewModel(): ProcessWalletTransactionViewModel {
|
||||
if (!this.result) throw new Error('Presenter not presented');
|
||||
return this.result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import type {
|
||||
IUpdateMemberPaymentPresenter,
|
||||
UpdateMemberPaymentResultDTO,
|
||||
UpdateMemberPaymentViewModel,
|
||||
} from '@gridpilot/payments/application/presenters/IUpdateMemberPaymentPresenter';
|
||||
|
||||
export class UpdateMemberPaymentPresenter implements IUpdateMemberPaymentPresenter {
|
||||
private result: UpdateMemberPaymentViewModel | null = null;
|
||||
|
||||
reset() {
|
||||
this.result = null;
|
||||
}
|
||||
|
||||
present(dto: UpdateMemberPaymentResultDTO) {
|
||||
this.result = dto;
|
||||
}
|
||||
|
||||
getViewModel(): UpdateMemberPaymentViewModel | null {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
get viewModel(): UpdateMemberPaymentViewModel {
|
||||
if (!this.result) throw new Error('Presenter not presented');
|
||||
return this.result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import type {
|
||||
IUpdatePaymentStatusPresenter,
|
||||
UpdatePaymentStatusResultDTO,
|
||||
UpdatePaymentStatusViewModel,
|
||||
} from '@gridpilot/payments/application/presenters/IUpdatePaymentStatusPresenter';
|
||||
|
||||
export class UpdatePaymentStatusPresenter implements IUpdatePaymentStatusPresenter {
|
||||
private result: UpdatePaymentStatusViewModel | null = null;
|
||||
|
||||
reset() {
|
||||
this.result = null;
|
||||
}
|
||||
|
||||
present(dto: UpdatePaymentStatusResultDTO) {
|
||||
this.result = dto;
|
||||
}
|
||||
|
||||
getViewModel(): UpdatePaymentStatusViewModel | null {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
get viewModel(): UpdatePaymentStatusViewModel {
|
||||
if (!this.result) throw new Error('Presenter not presented');
|
||||
return this.result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import type {
|
||||
IUpsertMembershipFeePresenter,
|
||||
UpsertMembershipFeeResultDTO,
|
||||
UpsertMembershipFeeViewModel,
|
||||
} from '@gridpilot/payments/application/presenters/IUpsertMembershipFeePresenter';
|
||||
|
||||
export class UpsertMembershipFeePresenter implements IUpsertMembershipFeePresenter {
|
||||
private result: UpsertMembershipFeeViewModel | null = null;
|
||||
|
||||
reset() {
|
||||
this.result = null;
|
||||
}
|
||||
|
||||
present(dto: UpsertMembershipFeeResultDTO) {
|
||||
this.result = dto;
|
||||
}
|
||||
|
||||
getViewModel(): UpsertMembershipFeeViewModel | null {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
get viewModel(): UpsertMembershipFeeViewModel {
|
||||
if (!this.result) throw new Error('Presenter not presented');
|
||||
return this.result;
|
||||
}
|
||||
}
|
||||
12
apps/api/src/modules/payments/presenters/index.ts
Normal file
12
apps/api/src/modules/payments/presenters/index.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
export * from './GetPaymentsPresenter';
|
||||
export * from './CreatePaymentPresenter';
|
||||
export * from './UpdatePaymentStatusPresenter';
|
||||
export * from './GetMembershipFeesPresenter';
|
||||
export * from './UpsertMembershipFeePresenter';
|
||||
export * from './UpdateMemberPaymentPresenter';
|
||||
export * from './GetPrizesPresenter';
|
||||
export * from './CreatePrizePresenter';
|
||||
export * from './AwardPrizePresenter';
|
||||
export * from './DeletePrizePresenter';
|
||||
export * from './GetWalletPresenter';
|
||||
export * from './ProcessWalletTransactionPresenter';
|
||||
Reference in New Issue
Block a user