Consider Pending/Accepted bookings only (#2479)

Co-authored-by: Bailey Pumfleet <pumfleet@hey.com>
This commit is contained in:
Hariom Balhara 2022-04-13 22:52:27 +05:30 committed by GitHub
parent b0d8eac2a2
commit ce476bf90f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -458,11 +458,26 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
}); });
const credentials = currentUser.credentials; const credentials = currentUser.credentials;
const calendarBusyTimes: EventBusyDate[] = await prisma.booking const calendarBusyTimes: EventBusyDate[] = await prisma.booking
.findMany({ .findMany({
where: { where: {
userId: currentUser.id, AND: [
eventTypeId: eventTypeId, {
userId: currentUser.id,
eventTypeId: eventTypeId,
},
{
OR: [
{
status: "ACCEPTED",
},
{
status: "PENDING",
},
],
},
],
}, },
}) })
.then((bookings) => bookings.map((booking) => ({ end: booking.endTime, start: booking.startTime }))); .then((bookings) => bookings.map((booking) => ({ end: booking.endTime, start: booking.startTime })));