From 275dd78f7ebeedc35da6fd345905140b444440ef Mon Sep 17 00:00:00 2001 From: Slavcho Ivanov Date: Wed, 24 Jan 2024 00:48:09 +0200 Subject: [PATCH] Rename the post /invalidate-stripe-payment/:id to a patch /:id/invalidate to match the REST guidelines better. --- .../api/src/donations/donations.controller.ts | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/apps/api/src/donations/donations.controller.ts b/apps/api/src/donations/donations.controller.ts index 1864c46d..e7bf46fe 100644 --- a/apps/api/src/donations/donations.controller.ts +++ b/apps/api/src/donations/donations.controller.ts @@ -240,6 +240,16 @@ export class DonationsController { return this.donationsService.createUpdateBankPayment(bankPaymentDto) } + @Patch('/:id/invalidate') + @Roles({ + roles: [EditFinancialsRequests.role], + mode: RoleMatchingMode.ANY, + }) + invalidate(@Param('id') id: string) { + Logger.debug(`Invalidating donation with id ${id}`) + return this.donationsService.invalidate(id) + } + @Patch(':id') @Roles({ roles: [RealmViewSupporters.role, ViewSupporters.role], @@ -251,17 +261,9 @@ export class DonationsController { @Body() updatePaymentDto: UpdatePaymentDto, ) { - return this.donationsService.update(id, updatePaymentDto) - } + Logger.debug(`Updating donation with id ${id}`) - @Post('/invalidate-stripe-payment/:id') - @Roles({ - roles: [EditFinancialsRequests.role], - mode: RoleMatchingMode.ANY, - }) - invalidate(@Param('id') id: string) { - Logger.debug(`Invalidating donation with id ${id}`) - return this.donationsService.invalidate(id) + return this.donationsService.update(id, updatePaymentDto) } @Post('delete')