From 20df8af8a3c6e001307791bbbef8a013936877d2 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Mon, 18 Dec 2023 20:24:52 +0200 Subject: [PATCH] src/donations: Remove person relation from user/:id response Donor's names will be claimed by the session token. --- apps/api/src/donations/donations.controller.ts | 8 +------- apps/api/src/donations/donations.service.ts | 13 +------------ 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/apps/api/src/donations/donations.controller.ts b/apps/api/src/donations/donations.controller.ts index 90e004cee..6ad0c7efd 100644 --- a/apps/api/src/donations/donations.controller.ts +++ b/apps/api/src/donations/donations.controller.ts @@ -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') diff --git a/apps/api/src/donations/donations.service.ts b/apps/api/src/donations/donations.service.ts index 6160f51de..ab2328245 100644 --- a/apps/api/src/donations/donations.service.ts +++ b/apps/api/src/donations/donations.service.ts @@ -461,7 +461,7 @@ export class DonationsService { id: string, keycloakId: string, email?: string, - ): Promise<(Donation & { person: Person | null }) | null> { + ): Promise { return await this.prisma.donation.findFirst({ where: { id, @@ -469,17 +469,6 @@ export class DonationsService { 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,