fix: rr-host booked outside of availability (#12704)

* correctly query overlapping bookings

* remove console.log

* fix getting busy bookings for getAvailableSlots

---------

Co-authored-by: CarinaWolli <[email protected]>
This commit is contained in:
Carina WollendorferandCarinaWolli authored and GitHub committed 2023-12-08 01:31:02 +00:00
1 parent c53e891c8a
commit f87eac193f
3 files changed
+5 -5

No files matched your search

+3 -2
View File
@@ -83,9 +83,10 @@ export async function getBusyTimes(params: {
const endTimeDate =
rescheduleUid && duration ? dayjs(endTime).add(duration, "minute").toDate() : new Date(endTime);
// startTime is less than endTimeDate and endTime grater than startTimeDate
const sharedQuery = {
startTime: { gte: startTimeDate },
endTime: { lte: endTimeDate },
startTime: { lte: endTimeDate },
endTime: { gte: startTimeDate },
status: {
in: [BookingStatus.ACCEPTED],
},
@@ -328,8 +328,8 @@ export async function getAvailableSlots({ input, ctx }: GetScheduleOptions) {
input.rescheduleUid && durationToUse ? endTime.add(durationToUse, "minute").toDate() : endTime.toDate();
const sharedQuery = {
startTime: { gte: startTimeDate },
endTime: { lte: endTimeDate },
startTime: { lte: endTimeDate },
endTime: { gte: startTimeDate },
status: {
in: [BookingStatus.ACCEPTED],
},