Skip to content

Commit

Permalink
src/donations: Remove person relation from user/:id response
Browse files Browse the repository at this point in the history
Donor's names will be claimed by the session token.
  • Loading branch information
sashko9807 committed Dec 18, 2023
1 parent 80ac1f3 commit 20df8af
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 19 deletions.
8 changes: 1 addition & 7 deletions apps/api/src/donations/donations.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,7 @@ export class DonationsController {
@Get('user/:id')
async userDonationById(@Param('id') id: string, @AuthenticatedUser() user: KeycloakTokenParsed) {
const donation = await this.donationsService.getUserDonationById(id, user.sub, user.email)
return {
...donation,
person: {
firstName: user.given_name,
lastName: user.family_name,
},
}
return donation
}

@Post('payment-intent')
Expand Down
13 changes: 1 addition & 12 deletions apps/api/src/donations/donations.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -461,25 +461,14 @@ export class DonationsService {
id: string,
keycloakId: string,
email?: string,
): Promise<(Donation & { person: Person | null }) | null> {
): Promise<Donation | null> {
return await this.prisma.donation.findFirst({
where: {
id,
status: DonationStatus.succeeded,
OR: [{ billingEmail: email }, { person: { keycloakId } }],
},
include: {
person: {
select: {
id: true,
firstName: true,
lastName: true,
company: { select: { companyName: true } },
},
},
affiliate: {
select: { company: { select: { companyName: true } } },
},
targetVault: {
select: {
id: true,
Expand Down

0 comments on commit 20df8af

Please sign in to comment.