Skip to content

Commit 784f81f

Browse files
committed
fix-type-issues
1 parent f41d110 commit 784f81f

2 files changed

Lines changed: 21 additions & 7 deletions

File tree

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,13 @@ const loadUsersByEventType = async (eventType: EventType): Promise<NewBookingEve
9191
});
9292

9393
return matchingHosts.map(({ user, isFixed, priority, weight, createdAt }) => ({
94-
...user,
95-
isFixed,
96-
priority,
97-
weight,
98-
createdAt,
99-
groupId: null, // Default value since findMatchingHostsWithEventSegment doesn't return groupId
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
100101
}));
101102
};
102103

packages/lib/bookings/findQualifiedHostsWithDelegationCredentials.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,22 @@ export class QualifiedHostsService {
114114
user: Omit<T, "credentials"> & { credentials: CredentialForCalendarService[] };
115115
}[];
116116
}> {
117+
// Transform hosts to proper BaseHost format if they exist
118+
const transformedEventType = eventType.hosts ? {
119+
...eventType,
120+
hosts: eventType.hosts.map(h => ({
121+
user: h.user, // Already a user object in this context
122+
isFixed: h.isFixed ?? false,
123+
priority: h.priority ?? null,
124+
weight: h.weight ?? null,
125+
createdAt: h.createdAt || new Date(),
126+
groupId: h.groupId ?? null
127+
}))
128+
} : eventType;
129+
117130
const { hosts: normalizedHosts, fallbackHosts: fallbackUsers } =
118131
await getNormalizedHostsWithDelegationCredentials({
119-
eventType,
132+
eventType: transformedEventType,
120133
});
121134
// not a team event type, or some other reason - segment matching isn't necessary.
122135
if (!normalizedHosts) {

0 commit comments

Comments
 (0)