Skip to content

Scheduling infrastructure for absolutely everyone.

fix: rescheduling dynamic booking (#10597)

Leo Giovanetti382cbe0a862a
diff --git a/packages/features/bookings/lib/get-booking.ts b/packages/features/bookings/lib/get-booking.ts
index 13fa92b6c0d..de59f57c263 100644
--- a/packages/features/bookings/lib/get-booking.ts
+++ b/packages/features/bookings/lib/get-booking.ts
@@ -109,24 +109,20 @@ export const getBookingWithResponses = <
export default getBooking;
export const getBookingForReschedule = async (uid: string) => {
- let eventTypeId: number | null = null;
let rescheduleUid: string | null = null;
- eventTypeId =
- (
- await prisma.booking.findFirst({
- where: {
- uid,
- },
- select: {
- eventTypeId: true,
- },
- })
- )?.eventTypeId || null;
+ const theBooking = await prisma.booking.findFirst({
+ where: {
+ uid,
+ },
+ select: {
+ id: true,
+ },
+ });
// If no booking is found via the uid, it's probably a booking seat,
// which we query next.
let attendeeEmail: string | null = null;
- if (!eventTypeId) {
+ if (!theBooking) {
const bookingSeat = await prisma.bookingSeat.findFirst({
where: {
referenceUid: uid,
@@ -154,7 +150,7 @@ export const getBookingForReschedule = async (uid: string) => {
// If we don't have a booking and no rescheduleUid, the ID is invalid,
// and we return null here.
- if (!eventTypeId && !rescheduleUid) return null;
+ if (!theBooking && !rescheduleUid) return null;
const booking = await getBooking(prisma, rescheduleUid || uid);