Skip to content

Commit 4819029

Browse files
committed
fix-types
1 parent 784f81f commit 4819029

File tree

2 files changed

+33
-13
lines changed

2 files changed

+33
-13
lines changed

packages/features/bookings/lib/handleNewBooking/loadUsers.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,7 @@ const loadUsersByEventType = async (eventType: EventType): Promise<NewBookingEve
9090
})),
9191
});
9292

93-
return matchingHosts.map(({ user, isFixed, priority, weight, createdAt }) => ({
94-
user,
95-
isFixed: isFixed ?? false,
96-
priority: priority ?? null,
97-
weight: weight ?? null,
98-
createdAt: createdAt || new Date(), // Provide default if missing
99-
groupId: null, // Always provide groupId
100-
weightAdjustment: null
101-
}));
93+
return matchingHosts.map(({ user }) => user);
10294
};
10395

10496
const loadDynamicUsers = async (dynamicUserList: string[], currentOrgDomain: string | null) => {

packages/lib/bookings/findQualifiedHostsWithDelegationCredentials.ts

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,22 @@ export class QualifiedHostsService {
133133
});
134134
// not a team event type, or some other reason - segment matching isn't necessary.
135135
if (!normalizedHosts) {
136-
const fixedHosts = fallbackUsers.filter(isFixedHost);
137-
const roundRobinHosts = fallbackUsers.filter(isRoundRobinHost);
136+
const fixedHosts = fallbackUsers.filter(isFixedHost).map((h) => ({
137+
isFixed: true,
138+
user: h.user,
139+
priority: h.priority ?? null,
140+
weight: h.weight ?? null,
141+
createdAt: h.createdAt ?? null,
142+
groupId: h.groupId ?? null,
143+
}));
144+
const roundRobinHosts = fallbackUsers.filter(isRoundRobinHost).map((h) => ({
145+
isFixed: false,
146+
user: h.user,
147+
priority: h.priority ?? null,
148+
weight: h.weight ?? null,
149+
createdAt: h.createdAt ?? null,
150+
groupId: h.groupId ?? null,
151+
}));
138152
return { qualifiedRRHosts: roundRobinHosts, fixedHosts };
139153
}
140154

@@ -144,8 +158,22 @@ export class QualifiedHostsService {
144158
isFixed: host.isFixed ?? false,
145159
}));
146160

147-
const fixedHosts = normalizedHostsWithFixedBoolean.filter(isFixedHost);
148-
const roundRobinHosts = normalizedHostsWithFixedBoolean.filter(isRoundRobinHost);
161+
const fixedHosts = normalizedHostsWithFixedBoolean.filter(isFixedHost).map((h) => ({
162+
isFixed: true,
163+
user: h.user,
164+
priority: h.priority ?? null,
165+
weight: h.weight ?? null,
166+
createdAt: h.createdAt ?? null,
167+
groupId: h.groupId ?? null,
168+
}));
169+
const roundRobinHosts = normalizedHostsWithFixedBoolean.filter(isRoundRobinHost).map((h) => ({
170+
isFixed: false,
171+
user: h.user,
172+
priority: h.priority ?? null,
173+
weight: h.weight ?? null,
174+
createdAt: h.createdAt ?? null,
175+
groupId: h.groupId ?? null,
176+
}));
149177

150178
// If it is rerouting, we should not force reschedule with same host.
151179
const hostsAfterRescheduleWithSameRoundRobinHost = applyFilterWithFallback(

0 commit comments

Comments
 (0)