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