call webhook before sending booking response

pull/9078/head
Syed Ali Shahbaz 2022-06-12 11:16:16 +05:30
parent a4185582f5
commit 470c43befe
1 changed files with 3 additions and 1 deletions

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);