feat: date range overhaul (#9802)

Co-authored-by: CarinaWolli <[email protected]>
Co-authored-by: Carina Wollendorfer <[email protected]>
Co-authored-by: zomars <[email protected]>
Co-authored-by: Hariom Balhara <[email protected]>
Co-authored-by: Peer Richelsen <[email protected]>
This commit is contained in:
authored and GitHub committed 2023-07-05 09:47:41 -07:00
1 parent 9c2e15f016
commit 7b1fbd2853
10 files changed
+793 -179

No files matched your search

@@ -345,11 +345,7 @@ async function ensureAvailableUsers(
const availableUsers: IsFixedAwareUser[] = [];
/** Let's start checking for availability */
for (const user of eventType.users) {
const {
busy: bufferedBusyTimes,
workingHours,
dateOverrides,
} = await getUserAvailability(
const { dateRanges, busy: bufferedBusyTimes } = await getUserAvailability(
{
userId: user.id,
eventTypeId: eventType.id,
@@ -358,18 +354,7 @@ async function ensureAvailableUsers(
{ user, eventType }
);
// check if time slot is outside of schedule.
if (
!isWithinAvailableHours(
{ start: input.dateFrom, end: input.dateTo },
{
workingHours,
dateOverrides,
organizerTimeZone: eventType.timeZone || eventType?.schedule?.timeZone || user.timeZone,
inviteeTimeZone: input.timeZone,
}
)
) {
if (!dateRanges.length) {
// user does not have availability at this time, skip user.
continue;
}