Skip to content

Scheduling infrastructure for absolutely everyone.

Consider Pending/Accepted bookings only (#2479)

Hariom Balharace476bf90fe6
diff --git a/apps/web/pages/api/book/event.ts b/apps/web/pages/api/book/event.ts
index ec99dfcac20..79f7f43cff8 100644
--- a/apps/web/pages/api/book/event.ts
+++ b/apps/web/pages/api/book/event.ts
@@ -458,11 +458,26 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
});
const credentials = currentUser.credentials;
+
const calendarBusyTimes: EventBusyDate[] = await prisma.booking
.findMany({
where: {
- userId: currentUser.id,
- eventTypeId: eventTypeId,
+ AND: [
+ {
+ userId: currentUser.id,
+ eventTypeId: eventTypeId,
+ },
+ {
+ OR: [
+ {
+ status: "ACCEPTED",
+ },
+ {
+ status: "PENDING",
+ },
+ ],
+ },
+ ],
},
})
.then((bookings) => bookings.map((booking) => ({ end: booking.endTime, start: booking.startTime })));