fix appointment cancellation
This commit is contained in:
@@ -196,8 +196,9 @@ public class AppointmentService {
|
|||||||
throw new ResourceNotFoundException("Appointment not found");
|
throw new ResourceNotFoundException("Appointment not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!"Booked".equalsIgnoreCase(appointment.getAppointmentStatus())) {
|
String status = appointment.getAppointmentStatus();
|
||||||
throw new IllegalArgumentException("Only booked appointments can be cancelled");
|
if (!"Booked".equalsIgnoreCase(status) && !"Scheduled".equalsIgnoreCase(status)) {
|
||||||
|
throw new IllegalArgumentException("Only booked or scheduled appointments can be cancelled");
|
||||||
}
|
}
|
||||||
|
|
||||||
appointment.setAppointmentStatus("Cancelled");
|
appointment.setAppointmentStatus("Cancelled");
|
||||||
|
|||||||
Reference in New Issue
Block a user