From baa2e58951fc3de664a3db2c0f95a08a4e1717ec Mon Sep 17 00:00:00 2001 From: alext Date: Fri, 13 Apr 2018 14:54:50 +0200 Subject: [PATCH] The Appointments API endpoint must only return appointment records and no unavailabilities. --- src/application/controllers/api/v1/Appointments.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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) {