Merge pull request #116 from calcom/fix/call-webhook-before-booking-response

call webhook before sending booking response
This commit is contained in:
Syed Ali Shahbaz
2022-06-12 11:19:02 +05:30
committed by GitHub
+3 -1
View File
@@ -88,7 +88,6 @@ async function createOrlistAllBookings(
const booking = schemaBookingReadPublic.parse(data);
if (booking) {
res.status(201).json({ booking, message: "Booking created successfully" });
// Create Calendar Event for webhook payload
const eventType = await prisma.eventType
.findUnique({ where: { id: booking.eventTypeId as number } })
@@ -139,6 +138,9 @@ async function createOrlistAllBookings(
})
);
await Promise.all(promises);
res.status(201).json({ booking, message: "Booking created successfully" });
} else
(error: Error) => {
console.log(error);