Files
calendar/apps/web/lib/getBooking.tsx
T
Syed Ali ShahbazGitHubCarinaWollikodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>Carina Wollendorfer
20e9e9763a HOTFIX: Removes disabled state from reminder phone input (reschedule) (#4322)
* removes disabled state from reminder phone

* prefill phone number for sms reminder

Co-authored-by: CarinaWolli <wollencarina@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Carina Wollendorfer <30310907+CarinaWolli@users.noreply.github.com>
2022-09-09 15:01:37 -04:00

34 lines
808 B
TypeScript

import { Prisma, PrismaClient } from "@prisma/client";
async function getBooking(prisma: PrismaClient, uid: string) {
const booking = await prisma.booking.findFirst({
where: {
uid,
},
select: {
startTime: true,
description: true,
customInputs: true,
smsReminderNumber: true,
attendees: {
select: {
email: true,
name: true,
},
},
},
});
if (booking) {
// @NOTE: had to do this because Server side cant return [Object objects]
// probably fixable with json.stringify -> json.parse
booking["startTime"] = (booking?.startTime as Date)?.toISOString() as unknown as Date;
}
return booking;
}
export type GetBookingType = Prisma.PromiseReturnType<typeof getBooking>;
export default getBooking;