diff --git a/src/application/controllers/api/v1/Appointments.php b/src/application/controllers/api/v1/Appointments.php index 644348a3..a26c1d55 100644 --- a/src/application/controllers/api/v1/Appointments.php +++ b/src/application/controllers/api/v1/Appointments.php @@ -50,8 +50,16 @@ class Appointments extends API_V1_Controller { { try { - $condition = $id !== NULL ? 'id = ' . $id : NULL; - $appointments = $this->appointments_model->get_batch($condition, array_key_exists('aggregates', $_GET)); + $conditions = [ + 'is_unavailable' => FALSE + ]; + + if ($id !== NULL) + { + $conditions['id'] = $id; + } + + $appointments = $this->appointments_model->get_batch($conditions, array_key_exists('aggregates', $_GET)); if ($id !== NULL && count($appointments) === 0) {