fix: handle reschedule request for dynamic meetings (#12275)

This commit is contained in:
Manpreet Singh 2023-12-01 08:39:06 -08:00 committed by GitHub
parent 9ca2ad2d41
commit d13dedda9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -80,7 +80,7 @@ export const requestRescheduleHandler = async ({ ctx, input }: RequestReschedule
throw new TRPCError({ code: "FORBIDDEN", message: "Booking to reschedule doesn't have an owner" }); throw new TRPCError({ code: "FORBIDDEN", message: "Booking to reschedule doesn't have an owner" });
} }
if (!bookingToReschedule.eventType) { if (!bookingToReschedule.eventType && !bookingToReschedule.dynamicEventSlugRef) {
throw new TRPCError({ code: "FORBIDDEN", message: "EventType not found for current booking." }); throw new TRPCError({ code: "FORBIDDEN", message: "EventType not found for current booking." });
} }
@ -192,7 +192,7 @@ export const requestRescheduleHandler = async ({ ctx, input }: RequestReschedule
director.setBuilder(builder); director.setBuilder(builder);
director.setExistingBooking(bookingToReschedule); director.setExistingBooking(bookingToReschedule);
cancellationReason && director.setCancellationReason(cancellationReason); cancellationReason && director.setCancellationReason(cancellationReason);
if (event) { if (Object.keys(event).length) {
await director.buildForRescheduleEmail(); await director.buildForRescheduleEmail();
} else { } else {
await director.buildWithoutEventTypeForRescheduleEmail(); await director.buildWithoutEventTypeForRescheduleEmail();