auto-complete scheduled appointments

This commit is contained in:
2026-04-20 08:24:28 -06:00
parent c346c9036f
commit 7977380c16
2 changed files with 6 additions and 2 deletions

View File

@@ -48,7 +48,7 @@ public interface AppointmentRepository extends JpaRepository<Appointment, Long>
@Query("SELECT a FROM Appointment a JOIN FETCH a.service WHERE a.employee.id IN :employeeIds AND a.appointmentDate = :date AND LOWER(a.appointmentStatus) NOT IN ('cancelled', 'missed')")
List<Appointment> findByEmployeeIdInAndAppointmentDate(@Param("employeeIds") List<Long> employeeIds, @Param("date") LocalDate date);
@Query("SELECT a FROM Appointment a WHERE (a.appointmentDate < :currentDate OR (a.appointmentDate = :currentDate AND a.appointmentTime < :currentTime)) AND LOWER(a.appointmentStatus) = 'booked'")
@Query("SELECT a FROM Appointment a WHERE (a.appointmentDate < :currentDate OR (a.appointmentDate = :currentDate AND a.appointmentTime < :currentTime)) AND LOWER(a.appointmentStatus) IN ('booked', 'scheduled')")
List<Appointment> findPastBookedAppointments(@Param("currentDate") LocalDate currentDate, @Param("currentTime") LocalTime currentTime);
List<Appointment> findByPet_Id(Long petId);

View File

@@ -279,8 +279,12 @@ public class AppointmentService {
LocalDate tomorrow = currentDate.plusDays(1);
List<Appointment> tomorrowAppointments = appointmentRepository
List<Appointment> tomorrowBooked = appointmentRepository
.findByAppointmentDateAndAppointmentStatusIgnoreCase(tomorrow, "Booked");
List<Appointment> tomorrowScheduled = appointmentRepository
.findByAppointmentDateAndAppointmentStatusIgnoreCase(tomorrow, "Scheduled");
List<Appointment> tomorrowAppointments = new java.util.ArrayList<>(tomorrowBooked);
tomorrowAppointments.addAll(tomorrowScheduled);
for (Appointment appointment : tomorrowAppointments) {
eventPublisher.publishEvent(new AppointmentReminderEvent(appointment.getAppointmentId()));
}