From e5ba174ce346a227e90e6a480b18039d458b8c3e Mon Sep 17 00:00:00 2001 From: Clemens Neubauer Date: Wed, 14 Aug 2024 15:06:06 +0000 Subject: [PATCH 1/7] extend api response of "services" of data of field "color" --- application/models/Services_model.php | 1 + 1 file changed, 1 insertion(+) diff --git a/application/models/Services_model.php b/application/models/Services_model.php index e8191cf136..434e982e67 100644 --- a/application/models/Services_model.php +++ b/application/models/Services_model.php @@ -413,6 +413,7 @@ public function api_encode(array &$service): void 'duration' => (int) $service['duration'], 'price' => (float) $service['price'], 'currency' => $service['currency'], + 'color' => $service['color'], 'description' => $service['description'], 'location' => $service['location'], 'availabilitiesType' => $service['availabilities_type'], From 91b75ed70687115dbe9dbcd2eb360149730e4521 Mon Sep 17 00:00:00 2001 From: Clemens Neubauer Date: Fri, 16 Aug 2024 13:25:03 +0000 Subject: [PATCH 2/7] update openapi.yml --- openapi.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/openapi.yml b/openapi.yml index d5916fba49..f86fcaed35 100644 --- a/openapi.yml +++ b/openapi.yml @@ -2022,6 +2022,8 @@ components: format: float currency: type: string + color: + type: string location: type: string description: @@ -2040,6 +2042,7 @@ components: duration: 30 price: 10 currency: USD + color: #a1b2c3 location: Test Street 1A, 12345 Some State, Some Place description: This is a test service. availabilitiesType: flexible @@ -2057,6 +2060,8 @@ components: type: number currency: type: string + color: + type: string location: type: string description: @@ -2074,6 +2079,7 @@ components: duration: 30 price: 10 currency: USD + color: #a1b2c3 location: Test Street 1A, 12345 Some State, Some Place description: This is a test service. availabilitiesType: flexible From 95988a5c8ec677f37548f0f3eeb8127fa27b7d54 Mon Sep 17 00:00:00 2001 From: Clemens Neubauer Date: Fri, 16 Aug 2024 13:33:59 +0000 Subject: [PATCH 3/7] fix function api_decode --- application/models/Services_model.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/application/models/Services_model.php b/application/models/Services_model.php index 434e982e67..3662484387 100644 --- a/application/models/Services_model.php +++ b/application/models/Services_model.php @@ -456,6 +456,10 @@ public function api_decode(array &$service, array $base = null): void $decoded_resource['currency'] = $service['currency']; } + if (array_key_exists('color', $service)) { + $decoded_resource['color'] = $service['color']; + } + if (array_key_exists('description', $service)) { $decoded_resource['description'] = $service['description']; } From ff77e8243cdb518033e1e4b938c4c161309a079a Mon Sep 17 00:00:00 2001 From: Clemens Neubauer Date: Fri, 16 Aug 2024 13:43:38 +0000 Subject: [PATCH 4/7] fix openapi.yml --- openapi.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openapi.yml b/openapi.yml index f86fcaed35..a39d81edce 100644 --- a/openapi.yml +++ b/openapi.yml @@ -2042,7 +2042,7 @@ components: duration: 30 price: 10 currency: USD - color: #a1b2c3 + color: '#123456' location: Test Street 1A, 12345 Some State, Some Place description: This is a test service. availabilitiesType: flexible @@ -2079,7 +2079,7 @@ components: duration: 30 price: 10 currency: USD - color: #a1b2c3 + color: '#123456' location: Test Street 1A, 12345 Some State, Some Place description: This is a test service. availabilitiesType: flexible From 42ca307687efae6d0ca1fb0a4c6963a33904e6df Mon Sep 17 00:00:00 2001 From: Clemens Neubauer Date: Fri, 16 Aug 2024 13:44:35 +0000 Subject: [PATCH 5/7] add color in appointments_model - api_decode --- application/models/Appointments_model.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/application/models/Appointments_model.php b/application/models/Appointments_model.php index 6c4644c14e..ef04e7f22d 100644 --- a/application/models/Appointments_model.php +++ b/application/models/Appointments_model.php @@ -616,6 +616,10 @@ public function api_decode(array &$appointment, array $base = null): void $decoded_request['id_services'] = $appointment['serviceId']; } + if (array_key_exists('color', $appointment)) { + $decoded_request['color'] = $appointment['color']; + } + if (array_key_exists('googleCalendarId', $appointment)) { $decoded_request['id_google_calendar'] = $appointment['googleCalendarId']; } From dc68f3bcaf9987456b4f9d3fe588f271e84b4bd5 Mon Sep 17 00:00:00 2001 From: Clemens Neubauer Date: Sun, 18 Aug 2024 05:36:06 +0000 Subject: [PATCH 6/7] fix link in header --- application/models/Unavailabilities_model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/models/Unavailabilities_model.php b/application/models/Unavailabilities_model.php index 86ad425320..8c79b4396f 100644 --- a/application/models/Unavailabilities_model.php +++ b/application/models/Unavailabilities_model.php @@ -7,7 +7,7 @@ * @author A.Tselegidis * @copyright Copyright (c) Alex Tselegidis * @license https://opensource.org/licenses/GPL-3.0 - GPLv3 - * @link http://easyunavailabilities.org + * @link https://easyappointments.org * @since v1.0.0 * ---------------------------------------------------------------------------- */ From 0a3089bb4b308a03b6a11d342f6dad02364f0455 Mon Sep 17 00:00:00 2001 From: Clemens Neubauer Date: Mon, 19 Aug 2024 12:34:01 +0000 Subject: [PATCH 7/7] Add unavailabilities API capabilities to query by date, from, till & providerId --- .../api/v1/Unavailabilities_api_v1.php | 36 ++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/application/controllers/api/v1/Unavailabilities_api_v1.php b/application/controllers/api/v1/Unavailabilities_api_v1.php index 016c196435..783a0a2cb7 100644 --- a/application/controllers/api/v1/Unavailabilities_api_v1.php +++ b/application/controllers/api/v1/Unavailabilities_api_v1.php @@ -50,8 +50,42 @@ public function index(): void $with = $this->api->request_with(); + $where = null; + + // Date query param. + + $date = request('date'); + + if (!empty($date)) { + $where['DATE(start_datetime)'] = (new DateTime($date))->format('Y-m-d'); + } + + // From query param. + + $from = request('from'); + + if (!empty($from)) { + $where['DATE(start_datetime) >='] = (new DateTime($from))->format('Y-m-d'); + } + + // Till query param. + + $till = request('till'); + + if (!empty($till)) { + $where['DATE(end_datetime) <='] = (new DateTime($till))->format('Y-m-d'); + } + + // Provider ID query param. + + $provider_id = request('providerId'); + + if (!empty($provider_id)) { + $where['id_users_provider'] = $provider_id; + } + $unavailabilities = empty($keyword) - ? $this->unavailabilities_model->get(null, $limit, $offset, $order_by) + ? $this->unavailabilities_model->get($where, $limit, $offset, $order_by) : $this->unavailabilities_model->search($keyword, $limit, $offset, $order_by); foreach ($unavailabilities as &$unavailability) {