diff --git a/src/main/java/com/vi/appointmentservice/api/calcom/service/CalComBookingService.java b/src/main/java/com/vi/appointmentservice/api/calcom/service/CalComBookingService.java index 99b753b..2ebb3b3 100644 --- a/src/main/java/com/vi/appointmentservice/api/calcom/service/CalComBookingService.java +++ b/src/main/java/com/vi/appointmentservice/api/calcom/service/CalComBookingService.java @@ -104,6 +104,13 @@ List enrichAskerResultSet(List bookings) { Optional calcomBookingAsker = calcomBookingToAskerRepository .findByCalcomBookingId( booking.getId()); + if (!calcomBookingAsker.isPresent()) { + log.warn("Inconsistent data. Asker not found for booking. Trying to fix consistency for bookingId " + booking.getId()); + recreateBookingToAskerRelation(booking); + calcomBookingAsker = calcomBookingToAskerRepository + .findByCalcomBookingId( + booking.getId()); + } if (!calcomBookingAsker.isPresent()) { log.error("Inconsistent data. Asker not found for booking + " + booking.getId()); continue;