handle gracefully and log error (#17310)

This commit is contained in:
sean-brydon
2024-10-24 21:59:42 +00:00
committed by GitHub
parent b6cef49ee6
commit 52e1a58904
@@ -56,10 +56,19 @@ export const getRoundRobinHostsToReassign = async ({ ctx, input }: GetRoundRobin
// Get event type
const eventType = await getEventTypesFromDB(booking.eventType.id);
if (!eventType || !eventType.teamId) {
if (!eventType) {
throw new Error("Event type not found");
}
if (!eventType.teamId) {
gettingRoundRobinHostsToReassignLogger.warn("Booking with event type that has no teamId", {
bookingId: input.bookingId,
eventTypeId: eventType.id,
teamId: eventType.teamId ?? -1,
});
return [];
}
const availableEventTypeUsers = eventType.hosts
.filter((h) => !h.isFixed && h.user.id !== booking.userId)
.map((host) => ({