fix: rescheduling dynamic booking (#10597)
Co-authored-by: Omar López <zomars@me.com> Co-authored-by: Keith Williams <keithwillcode@gmail.com>pull/10593/head^2
parent
0d1ab6ade9
commit
382cbe0a86
|
@ -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({
|
||||
const theBooking = await prisma.booking.findFirst({
|
||||
where: {
|
||||
uid,
|
||||
},
|
||||
select: {
|
||||
eventTypeId: true,
|
||||
id: true,
|
||||
},
|
||||
})
|
||||
)?.eventTypeId || null;
|
||||
});
|
||||
|
||||
// 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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue