From 9f121ff4ebbaec9a0643111f96c5337b930ddd5b Mon Sep 17 00:00:00 2001 From: Joe Au-Yeung Date: Tue, 21 Feb 2023 22:23:42 -0500 Subject: [PATCH] Remove booking select object --- apps/web/lib/getBooking.tsx | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/apps/web/lib/getBooking.tsx b/apps/web/lib/getBooking.tsx index a671734f8d..b713b28506 100644 --- a/apps/web/lib/getBooking.tsx +++ b/apps/web/lib/getBooking.tsx @@ -1,6 +1,25 @@ import type { Prisma, PrismaClient } from "@prisma/client"; -async function getBooking(prisma: PrismaClient, uid: string) { +const bookingSelect = { + startTime: true, + description: true, + customInputs: true, + smsReminderNumber: true, + location: true, + attendees: { + select: { + email: true, + name: true, + }, + }, + user: { + select: { + id: true, + }, + }, +}; + +async function getBooking(prisma: PrismaClient, uid: string, seatReferenceUId?: string) { const booking = await prisma.booking.findFirst({ where: { uid, @@ -15,6 +34,12 @@ async function getBooking(prisma: PrismaClient, uid: string) { select: { email: true, name: true, + ...(seatReferenceUId && { bookingSeatsReference: true }), + }, + }, + user: { + select: { + id: true, }, }, },