presenter refactoring
This commit is contained in:
@@ -12,7 +12,8 @@ export class PaymentsController {
|
||||
@ApiOperation({ summary: 'Get payments based on filters' })
|
||||
@ApiResponse({ status: 200, description: 'List of payments', type: GetPaymentsOutput })
|
||||
async getPayments(@Query() query: GetPaymentsQuery): Promise<GetPaymentsOutput> {
|
||||
return this.paymentsService.getPayments(query);
|
||||
const presenter = await this.paymentsService.getPayments(query);
|
||||
return presenter.viewModel;
|
||||
}
|
||||
|
||||
@Post()
|
||||
@@ -20,21 +21,24 @@ export class PaymentsController {
|
||||
@ApiOperation({ summary: 'Create a new payment' })
|
||||
@ApiResponse({ status: 201, description: 'Payment created', type: CreatePaymentOutput })
|
||||
async createPayment(@Body() input: CreatePaymentInput): Promise<CreatePaymentOutput> {
|
||||
return this.paymentsService.createPayment(input);
|
||||
const presenter = await this.paymentsService.createPayment(input);
|
||||
return presenter.viewModel;
|
||||
}
|
||||
|
||||
@Patch('status')
|
||||
@ApiOperation({ summary: 'Update the status of a payment' })
|
||||
@ApiResponse({ status: 200, description: 'Payment status updated', type: UpdatePaymentStatusOutput })
|
||||
async updatePaymentStatus(@Body() input: UpdatePaymentStatusInput): Promise<UpdatePaymentStatusOutput> {
|
||||
return this.paymentsService.updatePaymentStatus(input);
|
||||
const presenter = await this.paymentsService.updatePaymentStatus(input);
|
||||
return presenter.viewModel;
|
||||
}
|
||||
|
||||
@Get('membership-fees')
|
||||
@ApiOperation({ summary: 'Get membership fees and member payments' })
|
||||
@ApiResponse({ status: 200, description: 'Membership fee configuration and member payments', type: GetMembershipFeesOutput })
|
||||
async getMembershipFees(@Query() query: GetMembershipFeesQuery): Promise<GetMembershipFeesOutput> {
|
||||
return this.paymentsService.getMembershipFees(query);
|
||||
const presenter = await this.paymentsService.getMembershipFees(query);
|
||||
return presenter.viewModel;
|
||||
}
|
||||
|
||||
@Post('membership-fees')
|
||||
@@ -42,20 +46,23 @@ export class PaymentsController {
|
||||
@ApiOperation({ summary: 'Create or update membership fee configuration' })
|
||||
@ApiResponse({ status: 201, description: 'Membership fee configuration created or updated', type: UpsertMembershipFeeOutput })
|
||||
async upsertMembershipFee(@Body() input: UpsertMembershipFeeInput): Promise<UpsertMembershipFeeOutput> {
|
||||
return this.paymentsService.upsertMembershipFee(input);
|
||||
const presenter = await this.paymentsService.upsertMembershipFee(input);
|
||||
return presenter.viewModel;
|
||||
}
|
||||
|
||||
@Patch('membership-fees/member-payment')
|
||||
@ApiOperation({ summary: 'Record or update a member payment' })
|
||||
@ApiResponse({ status: 200, description: 'Member payment recorded or updated', type: UpdateMemberPaymentOutput })
|
||||
async updateMemberPayment(@Body() input: UpdateMemberPaymentInput): Promise<UpdateMemberPaymentOutput> {
|
||||
return this.paymentsService.updateMemberPayment(input);
|
||||
const presenter = await this.paymentsService.updateMemberPayment(input);
|
||||
return presenter.viewModel;
|
||||
}
|
||||
@Get('prizes')
|
||||
@ApiOperation({ summary: 'Get prizes for a league or season' })
|
||||
@ApiResponse({ status: 200, description: 'List of prizes', type: GetPrizesOutput })
|
||||
async getPrizes(@Query() query: GetPrizesQuery): Promise<GetPrizesOutput> {
|
||||
return this.paymentsService.getPrizes(query);
|
||||
const presenter = await this.paymentsService.getPrizes(query);
|
||||
return presenter.viewModel;
|
||||
}
|
||||
|
||||
@Post('prizes')
|
||||
@@ -63,27 +70,31 @@ export class PaymentsController {
|
||||
@ApiOperation({ summary: 'Create a new prize' })
|
||||
@ApiResponse({ status: 201, description: 'Prize created', type: CreatePrizeOutput })
|
||||
async createPrize(@Body() input: CreatePrizeInput): Promise<CreatePrizeOutput> {
|
||||
return this.paymentsService.createPrize(input);
|
||||
const presenter = await this.paymentsService.createPrize(input);
|
||||
return presenter.viewModel;
|
||||
}
|
||||
|
||||
@Patch('prizes/award')
|
||||
@ApiOperation({ summary: 'Award a prize to a driver' })
|
||||
@ApiResponse({ status: 200, description: 'Prize awarded', type: AwardPrizeOutput })
|
||||
async awardPrize(@Body() input: AwardPrizeInput): Promise<AwardPrizeOutput> {
|
||||
return this.paymentsService.awardPrize(input);
|
||||
const presenter = await this.paymentsService.awardPrize(input);
|
||||
return presenter.viewModel;
|
||||
}
|
||||
|
||||
@Delete('prizes')
|
||||
@ApiOperation({ summary: 'Delete a prize' })
|
||||
@ApiResponse({ status: 200, description: 'Prize deleted', type: DeletePrizeOutput })
|
||||
async deletePrize(@Query() query: DeletePrizeInput): Promise<DeletePrizeOutput> {
|
||||
return this.paymentsService.deletePrize(query);
|
||||
const presenter = await this.paymentsService.deletePrize(query);
|
||||
return presenter.viewModel;
|
||||
}
|
||||
@Get('wallets')
|
||||
@ApiOperation({ summary: 'Get wallet information and transactions' })
|
||||
@ApiResponse({ status: 200, description: 'Wallet and transaction data', type: GetWalletOutput })
|
||||
async getWallet(@Query() query: GetWalletQuery): Promise<GetWalletOutput> {
|
||||
return this.paymentsService.getWallet(query);
|
||||
const presenter = await this.paymentsService.getWallet(query);
|
||||
return presenter.viewModel;
|
||||
}
|
||||
|
||||
@Post('wallets/transactions')
|
||||
@@ -91,6 +102,7 @@ export class PaymentsController {
|
||||
@ApiOperation({ summary: 'Process a wallet transaction (deposit or withdrawal)' })
|
||||
@ApiResponse({ status: 201, description: 'Wallet transaction processed', type: ProcessWalletTransactionOutput })
|
||||
async processWalletTransaction(@Body() input: ProcessWalletTransactionInput): Promise<ProcessWalletTransactionOutput> {
|
||||
return this.paymentsService.processWalletTransaction(input);
|
||||
const presenter = await this.paymentsService.processWalletTransaction(input);
|
||||
return presenter.viewModel;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user