From 470c43befe7f940802fb471f38b7d296c4662446 Mon Sep 17 00:00:00 2001 From: Syed Ali Shahbaz Date: Sun, 12 Jun 2022 11:16:16 +0530 Subject: [PATCH 1/3] call webhook before sending booking response --- pages/api/bookings/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pages/api/bookings/index.ts b/pages/api/bookings/index.ts index fc0030b651..b99b3510d5 100644 --- a/pages/api/bookings/index.ts +++ b/pages/api/bookings/index.ts @@ -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); From bd88bec1d2015a83261ed5cdf14802b057475539 Mon Sep 17 00:00:00 2001 From: Syed Ali Shahbaz Date: Sun, 12 Jun 2022 11:24:38 +0530 Subject: [PATCH 2/3] fix prettier --- pages/api/bookings/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/pages/api/bookings/index.ts b/pages/api/bookings/index.ts index b99b3510d5..1bea4249b2 100644 --- a/pages/api/bookings/index.ts +++ b/pages/api/bookings/index.ts @@ -140,7 +140,6 @@ async function createOrlistAllBookings( await Promise.all(promises); res.status(201).json({ booking, message: "Booking created successfully" }); - } else (error: Error) => { console.log(error); From 935473cfcd040a178d25b7f813a5ce5acbb076d4 Mon Sep 17 00:00:00 2001 From: Syed Ali Shahbaz Date: Sun, 12 Jun 2022 11:25:53 +0530 Subject: [PATCH 3/3] removed comment --- pages/api/bookings/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/pages/api/bookings/index.ts b/pages/api/bookings/index.ts index 1bea4249b2..3336098d57 100644 --- a/pages/api/bookings/index.ts +++ b/pages/api/bookings/index.ts @@ -88,7 +88,6 @@ async function createOrlistAllBookings( const booking = schemaBookingReadPublic.parse(data); if (booking) { - // Create Calendar Event for webhook payload const eventType = await prisma.eventType .findUnique({ where: { id: booking.eventTypeId as number } }) .then((data) => schemaEventTypeReadPublic.parse(data))