Consider Pending/Accepted bookings only (#2479)

Co-authored-by: Bailey Pumfleet <pumfleet@hey.com>
pull/2468/head^2
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
1 changed files with 17 additions and 2 deletions

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