Consider Pending/Accepted bookings only (#2479)
Co-authored-by: Bailey Pumfleet <pumfleet@hey.com>
This commit is contained in:
parent
b0d8eac2a2
commit
ce476bf90f
1 changed files with 17 additions and 2 deletions
|
@ -458,12 +458,27 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
|||
});
|
||||
|
||||
const credentials = currentUser.credentials;
|
||||
|
||||
const calendarBusyTimes: EventBusyDate[] = await prisma.booking
|
||||
.findMany({
|
||||
where: {
|
||||
AND: [
|
||||
{
|
||||
userId: currentUser.id,
|
||||
eventTypeId: eventTypeId,
|
||||
},
|
||||
{
|
||||
OR: [
|
||||
{
|
||||
status: "ACCEPTED",
|
||||
},
|
||||
{
|
||||
status: "PENDING",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
})
|
||||
.then((bookings) => bookings.map((booking) => ({ end: booking.endTime, start: booking.startTime })));
|
||||
|
||||
|
|
Loading…
Reference in a new issue