Consider Pending/Accepted bookings only (#2479)

Co-authored-by: Bailey Pumfleet <pumfleet@hey.com>
This commit is contained in:
Hariom Balhara
2022-04-13 10:22:27 -07:00
committed by GitHub
co-authored by Bailey Pumfleet
parent b0d8eac2a2
commit ce476bf90f
+17 -2
View File
@@ -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 })));