Skip to content

Commit

Permalink
userDonationById(): Get first and last name from keycloak token
Browse files Browse the repository at this point in the history
Needed in order to show the name of the donor on the certificate, if the donation is anonymous
  • Loading branch information
sashko9807 committed Nov 2, 2023
1 parent aea9be9 commit 82eb4a4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion apps/api/src/donations/donations.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,14 @@ export class DonationsController {

@Get('user/:id')
async userDonationById(@Param('id') id: string, @AuthenticatedUser() user: KeycloakTokenParsed) {
return await this.donationsService.getUserDonationById(id, user.sub, user.email)
const donation = await this.donationsService.getUserDonationById(id, user.sub, user.email)
return {
...donation,
person: {
firstName: user.given_name,
lastName: user.family_name,
},
}
}

@Post('payment-intent')
Expand Down

0 comments on commit 82eb4a4

Please sign in to comment.