perf: getAvailableSlots improvements (#18382)
This commit is contained in:
@@ -114,10 +114,8 @@ describe("filterHostByLeadThreshold", () => {
|
||||
where: {
|
||||
OR: [
|
||||
{
|
||||
user: {
|
||||
id: {
|
||||
in: [2],
|
||||
},
|
||||
userId: {
|
||||
in: [2],
|
||||
},
|
||||
OR: [
|
||||
{
|
||||
|
||||
@@ -44,10 +44,8 @@ const buildWhereClauseForActiveBookings = ({
|
||||
}): Prisma.BookingWhereInput => ({
|
||||
OR: [
|
||||
{
|
||||
user: {
|
||||
id: {
|
||||
in: users.map((user) => user.id),
|
||||
},
|
||||
userId: {
|
||||
in: users.map((user) => user.id),
|
||||
},
|
||||
OR: [
|
||||
{
|
||||
|
||||
@@ -986,22 +986,18 @@ const calculateHostsAndAvailabilities = async ({
|
||||
};
|
||||
|
||||
const allUserIds = usersWithCredentials.map((user) => user.id);
|
||||
const currentBookingsAllUsers = await monitorCallbackAsync(
|
||||
getExistingBookings,
|
||||
startTimeDate,
|
||||
endTimeDate,
|
||||
eventType,
|
||||
sharedQuery,
|
||||
usersWithCredentials,
|
||||
allUserIds
|
||||
);
|
||||
|
||||
const outOfOfficeDaysAllUsers = await monitorCallbackAsync(
|
||||
getOOODates,
|
||||
startTimeDate,
|
||||
endTimeDate,
|
||||
allUserIds
|
||||
);
|
||||
const [currentBookingsAllUsers, outOfOfficeDaysAllUsers] = await Promise.all([
|
||||
monitorCallbackAsync(
|
||||
getExistingBookings,
|
||||
startTimeDate,
|
||||
endTimeDate,
|
||||
eventType,
|
||||
sharedQuery,
|
||||
usersWithCredentials,
|
||||
allUserIds
|
||||
),
|
||||
monitorCallbackAsync(getOOODates, startTimeDate, endTimeDate, allUserIds),
|
||||
]);
|
||||
|
||||
const bookingLimits = parseBookingLimit(eventType?.bookingLimits);
|
||||
const durationLimits = parseDurationLimit(eventType?.durationLimits);
|
||||
|
||||
Reference in New Issue
Block a user