From 87cb1e190b186dae30fdc535a4f1832e1658e708 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Thu, 4 Jan 2024 21:56:50 +0100 Subject: [PATCH 1/8] Correct typo --- application/libraries/Notifications.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/libraries/Notifications.php b/application/libraries/Notifications.php index 59df379a..2323dca7 100644 --- a/application/libraries/Notifications.php +++ b/application/libraries/Notifications.php @@ -63,7 +63,7 @@ class Notifications bool $manage_mode = false, ): void { try { - $current_language = config('english'); + $current_language = config('language'); $customer_link = site_url('booking/reschedule/' . $appointment['hash']); From c5eafc9552881a64d50894d933a114549091ea0d Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Fri, 5 Jan 2024 16:49:23 +0100 Subject: [PATCH 2/8] Add missing translations --- application/language/arabic/translations_lang.php | 3 +++ application/language/bulgarian/translations_lang.php | 3 +++ application/language/catalan/translations_lang.php | 3 +++ application/language/chinese/translations_lang.php | 3 +++ application/language/croatian/translations_lang.php | 3 +++ application/language/czech/translations_lang.php | 3 +++ application/language/danish/translations_lang.php | 3 +++ application/language/dutch/translations_lang.php | 3 +++ application/language/english/translations_lang.php | 3 +++ application/language/estonian/translations_lang.php | 3 +++ application/language/finnish/translations_lang.php | 3 +++ application/language/french/translations_lang.php | 3 +++ application/language/german/translations_lang.php | 3 +++ application/language/greek/translations_lang.php | 3 +++ application/language/hebrew/translations_lang.php | 3 +++ application/language/hindi/translations_lang.php | 3 +++ application/language/hungarian/translations_lang.php | 3 +++ application/language/italian/translations_lang.php | 3 +++ application/language/japanese/translations_lang.php | 3 +++ application/language/luxembourgish/translations_lang.php | 3 +++ application/language/marathi/translations_lang.php | 3 +++ application/language/persian/translations_lang.php | 3 +++ application/language/polish/translations_lang.php | 3 +++ application/language/portuguese-br/translations_lang.php | 3 +++ application/language/portuguese/translations_lang.php | 3 +++ application/language/romanian/translations_lang.php | 3 +++ application/language/russian/translations_lang.php | 3 +++ application/language/serbian/translations_lang.php | 3 +++ application/language/slovak/translations_lang.php | 3 +++ application/language/spanish/translations_lang.php | 3 +++ application/language/swedish/translations_lang.php | 3 +++ application/language/turkish/translations_lang.php | 3 +++ 32 files changed, 96 insertions(+) diff --git a/application/language/arabic/translations_lang.php b/application/language/arabic/translations_lang.php index 2d473dc8..fa919fc1 100755 --- a/application/language/arabic/translations_lang.php +++ b/application/language/arabic/translations_lang.php @@ -449,4 +449,7 @@ $lang['blocked_periods_hint'] = 'Define periods of time where public bookings wi $lang['custom_field'] = 'Custom Field'; $lang['custom_fields'] = 'Custom Fields'; $lang['label'] = 'Label'; +$lang['webhook_saved'] = 'Webhook saved successfully.'; +$lang['webhook_deleted'] = 'Webhook deleted successfully.'; +$lang['delete_webhook'] = 'Delete Webhook'; // End diff --git a/application/language/bulgarian/translations_lang.php b/application/language/bulgarian/translations_lang.php index c76cfeaf..2cd079f6 100755 --- a/application/language/bulgarian/translations_lang.php +++ b/application/language/bulgarian/translations_lang.php @@ -449,4 +449,7 @@ $lang['blocked_periods_hint'] = 'Define periods of time where public bookings wi $lang['custom_field'] = 'Custom Field'; $lang['custom_fields'] = 'Custom Fields'; $lang['label'] = 'Label'; +$lang['webhook_saved'] = 'Webhook saved successfully.'; +$lang['webhook_deleted'] = 'Webhook deleted successfully.'; +$lang['delete_webhook'] = 'Delete Webhook'; // End diff --git a/application/language/catalan/translations_lang.php b/application/language/catalan/translations_lang.php index 6b68fe9e..ff2315ea 100644 --- a/application/language/catalan/translations_lang.php +++ b/application/language/catalan/translations_lang.php @@ -449,4 +449,7 @@ $lang['blocked_periods_hint'] = 'Define periods of time where public bookings wi $lang['custom_field'] = 'Custom Field'; $lang['custom_fields'] = 'Custom Fields'; $lang['label'] = 'Label'; +$lang['webhook_saved'] = 'Webhook saved successfully.'; +$lang['webhook_deleted'] = 'Webhook deleted successfully.'; +$lang['delete_webhook'] = 'Delete Webhook'; // End diff --git a/application/language/chinese/translations_lang.php b/application/language/chinese/translations_lang.php index 0c2d8efe..ab76491c 100755 --- a/application/language/chinese/translations_lang.php +++ b/application/language/chinese/translations_lang.php @@ -449,4 +449,7 @@ $lang['blocked_periods_hint'] = 'Define periods of time where public bookings wi $lang['custom_field'] = 'Custom Field'; $lang['custom_fields'] = 'Custom Fields'; $lang['label'] = 'Label'; +$lang['webhook_saved'] = 'Webhook saved successfully.'; +$lang['webhook_deleted'] = 'Webhook deleted successfully.'; +$lang['delete_webhook'] = 'Delete Webhook'; // End diff --git a/application/language/croatian/translations_lang.php b/application/language/croatian/translations_lang.php index 21244e59..b2fc177f 100644 --- a/application/language/croatian/translations_lang.php +++ b/application/language/croatian/translations_lang.php @@ -449,4 +449,7 @@ $lang['blocked_periods_hint'] = 'Define periods of time where public bookings wi $lang['custom_field'] = 'Custom Field'; $lang['custom_fields'] = 'Custom Fields'; $lang['label'] = 'Label'; +$lang['webhook_saved'] = 'Webhook saved successfully.'; +$lang['webhook_deleted'] = 'Webhook deleted successfully.'; +$lang['delete_webhook'] = 'Delete Webhook'; // End diff --git a/application/language/czech/translations_lang.php b/application/language/czech/translations_lang.php index 30c868d4..67bee642 100644 --- a/application/language/czech/translations_lang.php +++ b/application/language/czech/translations_lang.php @@ -449,4 +449,7 @@ $lang['blocked_periods_hint'] = 'Define periods of time where public bookings wi $lang['custom_field'] = 'Custom Field'; $lang['custom_fields'] = 'Custom Fields'; $lang['label'] = 'Label'; +$lang['webhook_saved'] = 'Webhook saved successfully.'; +$lang['webhook_deleted'] = 'Webhook deleted successfully.'; +$lang['delete_webhook'] = 'Delete Webhook'; // End diff --git a/application/language/danish/translations_lang.php b/application/language/danish/translations_lang.php index efc43a86..4588eee1 100755 --- a/application/language/danish/translations_lang.php +++ b/application/language/danish/translations_lang.php @@ -449,4 +449,7 @@ $lang['blocked_periods_hint'] = 'Define periods of time where public bookings wi $lang['custom_field'] = 'Custom Field'; $lang['custom_fields'] = 'Custom Fields'; $lang['label'] = 'Label'; +$lang['webhook_saved'] = 'Webhook saved successfully.'; +$lang['webhook_deleted'] = 'Webhook deleted successfully.'; +$lang['delete_webhook'] = 'Delete Webhook'; // End diff --git a/application/language/dutch/translations_lang.php b/application/language/dutch/translations_lang.php index ad03ef53..c39a12fe 100755 --- a/application/language/dutch/translations_lang.php +++ b/application/language/dutch/translations_lang.php @@ -449,4 +449,7 @@ $lang['blocked_periods_hint'] = 'Define periods of time where public bookings wi $lang['custom_field'] = 'Custom Field'; $lang['custom_fields'] = 'Custom Fields'; $lang['label'] = 'Label'; +$lang['webhook_saved'] = 'Webhook saved successfully.'; +$lang['webhook_deleted'] = 'Webhook deleted successfully.'; +$lang['delete_webhook'] = 'Delete Webhook'; // End diff --git a/application/language/english/translations_lang.php b/application/language/english/translations_lang.php index d721dffd..22f9cec8 100755 --- a/application/language/english/translations_lang.php +++ b/application/language/english/translations_lang.php @@ -449,4 +449,7 @@ $lang['blocked_periods_hint'] = 'Define periods of time where public bookings wi $lang['custom_field'] = 'Custom Field'; $lang['custom_fields'] = 'Custom Fields'; $lang['label'] = 'Label'; +$lang['webhook_saved'] = 'Webhook saved successfully.'; +$lang['webhook_deleted'] = 'Webhook deleted successfully.'; +$lang['delete_webhook'] = 'Delete Webhook'; // End diff --git a/application/language/estonian/translations_lang.php b/application/language/estonian/translations_lang.php index 63a8d36f..5a91c4b0 100644 --- a/application/language/estonian/translations_lang.php +++ b/application/language/estonian/translations_lang.php @@ -449,4 +449,7 @@ $lang['blocked_periods_hint'] = 'Define periods of time where public bookings wi $lang['custom_field'] = 'Custom Field'; $lang['custom_fields'] = 'Custom Fields'; $lang['label'] = 'Label'; +$lang['webhook_saved'] = 'Webhook saved successfully.'; +$lang['webhook_deleted'] = 'Webhook deleted successfully.'; +$lang['delete_webhook'] = 'Delete Webhook'; // End diff --git a/application/language/finnish/translations_lang.php b/application/language/finnish/translations_lang.php index 6ee251e8..eed35ec0 100755 --- a/application/language/finnish/translations_lang.php +++ b/application/language/finnish/translations_lang.php @@ -449,4 +449,7 @@ $lang['blocked_periods_hint'] = 'Define periods of time where public bookings wi $lang['custom_field'] = 'Custom Field'; $lang['custom_fields'] = 'Custom Fields'; $lang['label'] = 'Label'; +$lang['webhook_saved'] = 'Webhook saved successfully.'; +$lang['webhook_deleted'] = 'Webhook deleted successfully.'; +$lang['delete_webhook'] = 'Delete Webhook'; // End diff --git a/application/language/french/translations_lang.php b/application/language/french/translations_lang.php index f7448097..b71b3575 100755 --- a/application/language/french/translations_lang.php +++ b/application/language/french/translations_lang.php @@ -449,4 +449,7 @@ $lang['blocked_periods_hint'] = 'Define periods of time where public bookings wi $lang['custom_field'] = 'Custom Field'; $lang['custom_fields'] = 'Custom Fields'; $lang['label'] = 'Label'; +$lang['webhook_saved'] = 'Webhook saved successfully.'; +$lang['webhook_deleted'] = 'Webhook deleted successfully.'; +$lang['delete_webhook'] = 'Delete Webhook'; // End diff --git a/application/language/german/translations_lang.php b/application/language/german/translations_lang.php index 745fa458..102aaf2c 100755 --- a/application/language/german/translations_lang.php +++ b/application/language/german/translations_lang.php @@ -449,4 +449,7 @@ $lang['blocked_periods_hint'] = 'Define periods of time where public bookings wi $lang['custom_field'] = 'Custom Field'; $lang['custom_fields'] = 'Custom Fields'; $lang['label'] = 'Label'; +$lang['webhook_saved'] = 'Webhook saved successfully.'; +$lang['webhook_deleted'] = 'Webhook deleted successfully.'; +$lang['delete_webhook'] = 'Delete Webhook'; // End diff --git a/application/language/greek/translations_lang.php b/application/language/greek/translations_lang.php index 99588172..fc3b14f6 100755 --- a/application/language/greek/translations_lang.php +++ b/application/language/greek/translations_lang.php @@ -449,4 +449,7 @@ $lang['blocked_periods_hint'] = 'Define periods of time where public bookings wi $lang['custom_field'] = 'Custom Field'; $lang['custom_fields'] = 'Custom Fields'; $lang['label'] = 'Label'; +$lang['webhook_saved'] = 'Webhook saved successfully.'; +$lang['webhook_deleted'] = 'Webhook deleted successfully.'; +$lang['delete_webhook'] = 'Delete Webhook'; // End diff --git a/application/language/hebrew/translations_lang.php b/application/language/hebrew/translations_lang.php index fd575159..6176e465 100644 --- a/application/language/hebrew/translations_lang.php +++ b/application/language/hebrew/translations_lang.php @@ -449,4 +449,7 @@ $lang['blocked_periods_hint'] = 'Define periods of time where public bookings wi $lang['custom_field'] = 'Custom Field'; $lang['custom_fields'] = 'Custom Fields'; $lang['label'] = 'Label'; +$lang['webhook_saved'] = 'Webhook saved successfully.'; +$lang['webhook_deleted'] = 'Webhook deleted successfully.'; +$lang['delete_webhook'] = 'Delete Webhook'; // End diff --git a/application/language/hindi/translations_lang.php b/application/language/hindi/translations_lang.php index 97df25f2..f6f6ea79 100755 --- a/application/language/hindi/translations_lang.php +++ b/application/language/hindi/translations_lang.php @@ -449,4 +449,7 @@ $lang['blocked_periods_hint'] = 'Define periods of time where public bookings wi $lang['custom_field'] = 'Custom Field'; $lang['custom_fields'] = 'Custom Fields'; $lang['label'] = 'Label'; +$lang['webhook_saved'] = 'Webhook saved successfully.'; +$lang['webhook_deleted'] = 'Webhook deleted successfully.'; +$lang['delete_webhook'] = 'Delete Webhook'; // End diff --git a/application/language/hungarian/translations_lang.php b/application/language/hungarian/translations_lang.php index 2e79f03d..8a24068c 100755 --- a/application/language/hungarian/translations_lang.php +++ b/application/language/hungarian/translations_lang.php @@ -449,4 +449,7 @@ $lang['blocked_periods_hint'] = 'Define periods of time where public bookings wi $lang['custom_field'] = 'Custom Field'; $lang['custom_fields'] = 'Custom Fields'; $lang['label'] = 'Label'; +$lang['webhook_saved'] = 'Webhook saved successfully.'; +$lang['webhook_deleted'] = 'Webhook deleted successfully.'; +$lang['delete_webhook'] = 'Delete Webhook'; // End diff --git a/application/language/italian/translations_lang.php b/application/language/italian/translations_lang.php index 93d6b75a..8a60a06d 100755 --- a/application/language/italian/translations_lang.php +++ b/application/language/italian/translations_lang.php @@ -449,4 +449,7 @@ $lang['blocked_periods_hint'] = 'Define periods of time where public bookings wi $lang['custom_field'] = 'Custom Field'; $lang['custom_fields'] = 'Custom Fields'; $lang['label'] = 'Label'; +$lang['webhook_saved'] = 'Webhook saved successfully.'; +$lang['webhook_deleted'] = 'Webhook deleted successfully.'; +$lang['delete_webhook'] = 'Delete Webhook'; // End diff --git a/application/language/japanese/translations_lang.php b/application/language/japanese/translations_lang.php index 7467722d..71fa41f9 100755 --- a/application/language/japanese/translations_lang.php +++ b/application/language/japanese/translations_lang.php @@ -449,4 +449,7 @@ $lang['blocked_periods_hint'] = 'Define periods of time where public bookings wi $lang['custom_field'] = 'Custom Field'; $lang['custom_fields'] = 'Custom Fields'; $lang['label'] = 'Label'; +$lang['webhook_saved'] = 'Webhook saved successfully.'; +$lang['webhook_deleted'] = 'Webhook deleted successfully.'; +$lang['delete_webhook'] = 'Delete Webhook'; // End diff --git a/application/language/luxembourgish/translations_lang.php b/application/language/luxembourgish/translations_lang.php index 3a2ef359..a5008281 100755 --- a/application/language/luxembourgish/translations_lang.php +++ b/application/language/luxembourgish/translations_lang.php @@ -449,4 +449,7 @@ $lang['blocked_periods_hint'] = 'Define periods of time where public bookings wi $lang['custom_field'] = 'Custom Field'; $lang['custom_fields'] = 'Custom Fields'; $lang['label'] = 'Label'; +$lang['webhook_saved'] = 'Webhook saved successfully.'; +$lang['webhook_deleted'] = 'Webhook deleted successfully.'; +$lang['delete_webhook'] = 'Delete Webhook'; // End diff --git a/application/language/marathi/translations_lang.php b/application/language/marathi/translations_lang.php index 3a733535..9ae094be 100644 --- a/application/language/marathi/translations_lang.php +++ b/application/language/marathi/translations_lang.php @@ -449,4 +449,7 @@ $lang['blocked_periods_hint'] = 'Define periods of time where public bookings wi $lang['custom_field'] = 'Custom Field'; $lang['custom_fields'] = 'Custom Fields'; $lang['label'] = 'Label'; +$lang['webhook_saved'] = 'Webhook saved successfully.'; +$lang['webhook_deleted'] = 'Webhook deleted successfully.'; +$lang['delete_webhook'] = 'Delete Webhook'; // End diff --git a/application/language/persian/translations_lang.php b/application/language/persian/translations_lang.php index e3e8d9df..e09e27da 100644 --- a/application/language/persian/translations_lang.php +++ b/application/language/persian/translations_lang.php @@ -449,4 +449,7 @@ $lang['blocked_periods_hint'] = 'Define periods of time where public bookings wi $lang['custom_field'] = 'Custom Field'; $lang['custom_fields'] = 'Custom Fields'; $lang['label'] = 'Label'; +$lang['webhook_saved'] = 'Webhook saved successfully.'; +$lang['webhook_deleted'] = 'Webhook deleted successfully.'; +$lang['delete_webhook'] = 'Delete Webhook'; // End diff --git a/application/language/polish/translations_lang.php b/application/language/polish/translations_lang.php index 6579b25d..4114b9b0 100755 --- a/application/language/polish/translations_lang.php +++ b/application/language/polish/translations_lang.php @@ -449,4 +449,7 @@ $lang['blocked_periods_hint'] = 'Define periods of time where public bookings wi $lang['custom_field'] = 'Custom Field'; $lang['custom_fields'] = 'Custom Fields'; $lang['label'] = 'Label'; +$lang['webhook_saved'] = 'Webhook saved successfully.'; +$lang['webhook_deleted'] = 'Webhook deleted successfully.'; +$lang['delete_webhook'] = 'Delete Webhook'; // End diff --git a/application/language/portuguese-br/translations_lang.php b/application/language/portuguese-br/translations_lang.php index 2a7c8c95..9f40686b 100755 --- a/application/language/portuguese-br/translations_lang.php +++ b/application/language/portuguese-br/translations_lang.php @@ -449,4 +449,7 @@ $lang['blocked_periods_hint'] = 'Define periods of time where public bookings wi $lang['custom_field'] = 'Custom Field'; $lang['custom_fields'] = 'Custom Fields'; $lang['label'] = 'Label'; +$lang['webhook_saved'] = 'Webhook saved successfully.'; +$lang['webhook_deleted'] = 'Webhook deleted successfully.'; +$lang['delete_webhook'] = 'Delete Webhook'; // End diff --git a/application/language/portuguese/translations_lang.php b/application/language/portuguese/translations_lang.php index 26af230b..01564c11 100755 --- a/application/language/portuguese/translations_lang.php +++ b/application/language/portuguese/translations_lang.php @@ -449,4 +449,7 @@ $lang['blocked_periods_hint'] = 'Define periods of time where public bookings wi $lang['custom_field'] = 'Custom Field'; $lang['custom_fields'] = 'Custom Fields'; $lang['label'] = 'Label'; +$lang['webhook_saved'] = 'Webhook saved successfully.'; +$lang['webhook_deleted'] = 'Webhook deleted successfully.'; +$lang['delete_webhook'] = 'Delete Webhook'; // End diff --git a/application/language/romanian/translations_lang.php b/application/language/romanian/translations_lang.php index 76499148..ea4ffaad 100755 --- a/application/language/romanian/translations_lang.php +++ b/application/language/romanian/translations_lang.php @@ -449,4 +449,7 @@ $lang['blocked_periods_hint'] = 'Define periods of time where public bookings wi $lang['custom_field'] = 'Custom Field'; $lang['custom_fields'] = 'Custom Fields'; $lang['label'] = 'Label'; +$lang['webhook_saved'] = 'Webhook saved successfully.'; +$lang['webhook_deleted'] = 'Webhook deleted successfully.'; +$lang['delete_webhook'] = 'Delete Webhook'; // End diff --git a/application/language/russian/translations_lang.php b/application/language/russian/translations_lang.php index 51e9c291..f97095ae 100644 --- a/application/language/russian/translations_lang.php +++ b/application/language/russian/translations_lang.php @@ -449,4 +449,7 @@ $lang['blocked_periods_hint'] = 'Define periods of time where public bookings wi $lang['custom_field'] = 'Custom Field'; $lang['custom_fields'] = 'Custom Fields'; $lang['label'] = 'Label'; +$lang['webhook_saved'] = 'Webhook saved successfully.'; +$lang['webhook_deleted'] = 'Webhook deleted successfully.'; +$lang['delete_webhook'] = 'Delete Webhook'; // End diff --git a/application/language/serbian/translations_lang.php b/application/language/serbian/translations_lang.php index e0569d02..8cbfb136 100644 --- a/application/language/serbian/translations_lang.php +++ b/application/language/serbian/translations_lang.php @@ -449,4 +449,7 @@ $lang['blocked_periods_hint'] = 'Define periods of time where public bookings wi $lang['custom_field'] = 'Custom Field'; $lang['custom_fields'] = 'Custom Fields'; $lang['label'] = 'Label'; +$lang['webhook_saved'] = 'Webhook saved successfully.'; +$lang['webhook_deleted'] = 'Webhook deleted successfully.'; +$lang['delete_webhook'] = 'Delete Webhook'; // End diff --git a/application/language/slovak/translations_lang.php b/application/language/slovak/translations_lang.php index 7cd6b86b..96f66230 100755 --- a/application/language/slovak/translations_lang.php +++ b/application/language/slovak/translations_lang.php @@ -449,4 +449,7 @@ $lang['blocked_periods_hint'] = 'Define periods of time where public bookings wi $lang['custom_field'] = 'Custom Field'; $lang['custom_fields'] = 'Custom Fields'; $lang['label'] = 'Label'; +$lang['webhook_saved'] = 'Webhook saved successfully.'; +$lang['webhook_deleted'] = 'Webhook deleted successfully.'; +$lang['delete_webhook'] = 'Delete Webhook'; // End diff --git a/application/language/spanish/translations_lang.php b/application/language/spanish/translations_lang.php index 30a70e75..6ee70279 100755 --- a/application/language/spanish/translations_lang.php +++ b/application/language/spanish/translations_lang.php @@ -449,4 +449,7 @@ $lang['blocked_periods_hint'] = 'Define periods of time where public bookings wi $lang['custom_field'] = 'Custom Field'; $lang['custom_fields'] = 'Custom Fields'; $lang['label'] = 'Label'; +$lang['webhook_saved'] = 'Webhook saved successfully.'; +$lang['webhook_deleted'] = 'Webhook deleted successfully.'; +$lang['delete_webhook'] = 'Delete Webhook'; // End diff --git a/application/language/swedish/translations_lang.php b/application/language/swedish/translations_lang.php index f99f6a6b..c9af9406 100644 --- a/application/language/swedish/translations_lang.php +++ b/application/language/swedish/translations_lang.php @@ -449,4 +449,7 @@ $lang['blocked_periods_hint'] = 'Define periods of time where public bookings wi $lang['custom_field'] = 'Custom Field'; $lang['custom_fields'] = 'Custom Fields'; $lang['label'] = 'Label'; +$lang['webhook_saved'] = 'Webhook saved successfully.'; +$lang['webhook_deleted'] = 'Webhook deleted successfully.'; +$lang['delete_webhook'] = 'Delete Webhook'; // End diff --git a/application/language/turkish/translations_lang.php b/application/language/turkish/translations_lang.php index 7bd07f72..e84e61e6 100755 --- a/application/language/turkish/translations_lang.php +++ b/application/language/turkish/translations_lang.php @@ -449,4 +449,7 @@ $lang['blocked_periods_hint'] = 'Define periods of time where public bookings wi $lang['custom_field'] = 'Custom Field'; $lang['custom_fields'] = 'Custom Fields'; $lang['label'] = 'Label'; +$lang['webhook_saved'] = 'Webhook saved successfully.'; +$lang['webhook_deleted'] = 'Webhook deleted successfully.'; +$lang['delete_webhook'] = 'Delete Webhook'; // End From e0a1282338b616abcf32092e52f6428fc7f86b5c Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Fri, 5 Jan 2024 17:06:49 +0100 Subject: [PATCH 3/8] Add missing API methods --- application/models/Webhooks_model.php | 61 +++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/application/models/Webhooks_model.php b/application/models/Webhooks_model.php index 18cec3cb..5ccc936a 100644 --- a/application/models/Webhooks_model.php +++ b/application/models/Webhooks_model.php @@ -277,4 +277,65 @@ class Webhooks_model extends EA_Model { // Webhooks do not currently have any related resources. } + + /** + * Convert the database webhook record to the equivalent API resource. + * + * @param array $webhook Webhook data. + */ + public function api_encode(array &$webhook): void + { + $encoded_resource = [ + 'id' => array_key_exists('id', $webhook) ? (int) $webhook['id'] : null, + 'name' => $webhook['name'], + 'url' => $webhook['url'], + 'actions' => $webhook['actions'], + 'secret_token' => $webhook['secret_token'], + 'is_ssl_verified' => $webhook['is_ssl_verified'], + 'notes' => $webhook['notes'], + ]; + + $webhook = $encoded_resource; + } + + /** + * Convert the API resource to the equivalent database webhook record. + * + * @param array $webhook API resource. + * @param array|null $base Base webhook data to be overwritten with the provided values (useful for updates). + */ + public function api_decode(array &$webhook, array $base = null) + { + $decoded_resource = $base ?: []; + + if (array_key_exists('id', $webhook)) { + $decoded_resource['id'] = $webhook['id']; + } + + if (array_key_exists('name', $webhook)) { + $decoded_resource['name'] = $webhook['name']; + } + + if (array_key_exists('url', $webhook)) { + $decoded_resource['url'] = $webhook['url']; + } + + if (array_key_exists('actions', $webhook)) { + $decoded_resource['actions'] = $webhook['actions']; + } + + if (array_key_exists('secretToken', $webhook)) { + $decoded_resource['secret_token'] = $webhook['secretToken']; + } + + if (array_key_exists('isSslVerified', $webhook)) { + $decoded_resource['is_ssl_verified'] = $webhook['isSslVerified']; + } + + if (array_key_exists('notes', $webhook)) { + $decoded_resource['notes'] = $webhook['notes']; + } + + $webhook = $decoded_resource; + } } From 6a1b2b28f1d641d7c11a0c75c0e515b0a7bd3541 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Fri, 5 Jan 2024 17:09:44 +0100 Subject: [PATCH 4/8] Replace collection objects with array definitions that better translate to Swagger clients --- openapi.yml | 84 +++++++++++++++++++++-------------------------------- 1 file changed, 33 insertions(+), 51 deletions(-) diff --git a/openapi.yml b/openapi.yml index d0dd3b55..5510e004 100644 --- a/openapi.yml +++ b/openapi.yml @@ -54,7 +54,9 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Availabilities' + type: array + items: + type: string '401': description: Unauthorized '500': @@ -131,7 +133,9 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/AppointmentCollection' + type: array + items: + $ref: '#/components/schemas/AppointmentRecord' '401': description: Unauthorized '500': @@ -302,7 +306,9 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/UnavailabilityCollection' + type: array + items: + $ref: '#/components/schemas/UnavailabilityRecord' '401': description: Unauthorized '500': @@ -470,7 +476,9 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/CustomerCollection' + type: array + items: + $ref: '#/components/schemas/CustomerRecord' '401': description: Unauthorized '500': @@ -641,7 +649,9 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/ServiceCollection' + type: array + items: + $ref: '#/components/schemas/ServiceRecord' '401': description: Unauthorized '500': @@ -812,7 +822,9 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/ServiceCategoryCollection' + type: array + items: + $ref: '#/components/schemas/ServiceCategoryRecord' '401': description: Unauthorized '500': @@ -983,7 +995,9 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/AdminCollection' + type: array + items: + $ref: '#/components/schemas/AdminRecord' '401': description: Unauthorized '500': @@ -1154,7 +1168,9 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/ProviderCollection' + type: array + items: + $ref: '#/components/schemas/ProviderRecord' '401': description: Unauthorized '500': @@ -1325,7 +1341,9 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/SecretaryCollection' + type: array + items: + $ref: '#/components/schemas/SecretaryRecord' '401': description: Unauthorized '500': @@ -1490,7 +1508,9 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/SettingCollection' + type: array + items: + $ref: '#/components/schemas/ServiceRecord' '401': description: Unauthorized '500': @@ -1606,7 +1626,9 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/WebhookCollection' + type: array + items: + $ref: '#/components/schemas/WebhookRecord' '401': description: Unauthorized '500': @@ -1821,10 +1843,6 @@ components: customerId: 5 providerId: 2 serviceId: 6 - AppointmentCollection: - type: array - items: - $ref: '#/components/schemas/AppointmentRecord' UnavailabilityRecord: type: object properties: @@ -1875,10 +1893,6 @@ components: location: Test Street 1A, 12345 Some State, Some Place notes: This is a test appointment. providerId: 2 - UnavailabilityCollection: - type: array - items: - $ref: '#/components/schemas/UnavailabilityRecord' CustomerRecord: type: object properties: @@ -1978,10 +1992,6 @@ components: customField4: Value4 customField5: Value5 notes: This is a test customer. - CustomerCollection: - type: array - items: - $ref: '#/components/schemas/CustomerRecord' ServiceRecord: type: object properties: @@ -2048,10 +2058,6 @@ components: availabilitiesType: flexible attendantsNumber: 1 serviceCategoryId: null - ServiceCollection: - type: array - items: - $ref: '#/components/schemas/ServiceRecord' ServiceCategoryRecord: type: object properties: @@ -2075,10 +2081,6 @@ components: example: name: Test Category description: This is a test category. - ServiceCategoryCollection: - type: array - items: - $ref: '#/components/schemas/ServiceCategoryRecord' AdminRecord: type: object properties: @@ -2187,10 +2189,6 @@ components: password: Password@123 notifications: true calendarView: default - AdminCollection: - type: array - items: - $ref: '#/components/schemas/AdminRecord' ProviderRecord: type: object properties: @@ -2391,10 +2389,6 @@ components: end: '17:00' breaks: [ ] saturday: null - ProviderCollection: - type: array - items: - $ref: '#/components/schemas/ProviderRecord' SecretaryRecord: type: object properties: @@ -2516,10 +2510,6 @@ components: password: Password@123 notifications: true calendarView: default - SecretaryCollection: - type: array - items: - $ref: '#/components/schemas/SecretaryRecord' SettingRecord: type: object properties: @@ -2537,10 +2527,6 @@ components: type: string example: value: ACME Inc - SettingCollection: - type: array - items: - $ref: '#/components/schemas/SettingRecord' WebhookRecord: type: object properties: @@ -2588,10 +2574,6 @@ components: secretToken: SecureSecretTokenHere isSslVerified: true notes: This is a webhook. - WebhookCollection: - type: array - items: - $ref: '#/components/schemas/WebhookRecord' ErrorResponse: type: object properties: From 5a1f604e3da87c371bc74daf64c069083113ba50 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Fri, 5 Jan 2024 17:10:17 +0100 Subject: [PATCH 5/8] Add missing security section for unavailabilities --- openapi.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/openapi.yml b/openapi.yml index 5510e004..b18976ef 100644 --- a/openapi.yml +++ b/openapi.yml @@ -317,6 +317,10 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' + x-codegen-request-body-name: body + security: + - BearerToken: [ ] + - BasicAuth: [ ] post: tags: - unavailabilities From 7a8832d311c40322bc6a11ee824a4323ae96df41 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Fri, 5 Jan 2024 17:38:50 +0100 Subject: [PATCH 6/8] Use fixed swagger UI version --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 447e4e13..1bd72690 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -46,7 +46,7 @@ services: swagger-ui: platform: linux/amd64 - image: swaggerapi/swagger-ui + image: swaggerapi/swagger-ui:v5.10.5 ports: - "8000:8080" volumes: From aee7bb80c0fdd1683ac16cfd1da5603ef8cb053e Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Fri, 5 Jan 2024 19:12:25 +0100 Subject: [PATCH 7/8] Add return types --- application/controllers/api/v1/Admins_api_v1.php | 10 +++++----- .../controllers/api/v1/Appointments_api_v1.php | 12 ++++++------ .../controllers/api/v1/Availabilities_api_v1.php | 2 +- application/controllers/api/v1/Customers_api_v1.php | 10 +++++----- application/controllers/api/v1/Providers_api_v1.php | 10 +++++----- .../controllers/api/v1/Secretaries_api_v1.php | 10 +++++----- .../controllers/api/v1/Service_categories_api_v1.php | 10 +++++----- application/controllers/api/v1/Services_api_v1.php | 10 +++++----- application/controllers/api/v1/Settings_api_v1.php | 4 ++-- .../controllers/api/v1/Unavailabilities_api_v1.php | 10 +++++----- application/controllers/api/v1/Webhooks_api_v1.php | 10 +++++----- 11 files changed, 49 insertions(+), 49 deletions(-) diff --git a/application/controllers/api/v1/Admins_api_v1.php b/application/controllers/api/v1/Admins_api_v1.php index d751c120..5f15216b 100644 --- a/application/controllers/api/v1/Admins_api_v1.php +++ b/application/controllers/api/v1/Admins_api_v1.php @@ -37,7 +37,7 @@ class Admins_api_v1 extends EA_Controller /** * Get an admin collection. */ - public function index() + public function index(): void { try { $keyword = $this->api->request_keyword(); @@ -79,7 +79,7 @@ class Admins_api_v1 extends EA_Controller * * @param int|null $id Admin ID. */ - public function show(int $id = null) + public function show(int $id = null): void { try { $fields = $this->api->request_fields(); @@ -113,7 +113,7 @@ class Admins_api_v1 extends EA_Controller /** * Store a new admin. */ - public function store() + public function store(): void { try { $admin = request(); @@ -145,7 +145,7 @@ class Admins_api_v1 extends EA_Controller * * @param int $id Admin ID. */ - public function update(int $id) + public function update(int $id): void { try { $occurrences = $this->admins_model->get(['id' => $id]); @@ -179,7 +179,7 @@ class Admins_api_v1 extends EA_Controller * * @param int $id Admin ID. */ - public function destroy(int $id) + public function destroy(int $id): void { try { $occurrences = $this->admins_model->get(['id' => $id]); diff --git a/application/controllers/api/v1/Appointments_api_v1.php b/application/controllers/api/v1/Appointments_api_v1.php index 44cf4883..54e3c2d2 100644 --- a/application/controllers/api/v1/Appointments_api_v1.php +++ b/application/controllers/api/v1/Appointments_api_v1.php @@ -43,7 +43,7 @@ class Appointments_api_v1 extends EA_Controller /** * Get an appointment collection. */ - public function index() + public function index(): void { try { $keyword = $this->api->request_keyword(); @@ -143,7 +143,7 @@ class Appointments_api_v1 extends EA_Controller * * @deprecated Since 1.5 */ - private function aggregates(array &$appointment) + private function aggregates(array &$appointment): void { $aggregates = request('aggregates') !== null; @@ -171,7 +171,7 @@ class Appointments_api_v1 extends EA_Controller * * @param int|null $id Appointment ID. */ - public function show(int $id = null) + public function show(int $id = null): void { try { $fields = $this->api->request_fields(); @@ -205,7 +205,7 @@ class Appointments_api_v1 extends EA_Controller /** * Store a new appointment. */ - public function store() + public function store(): void { try { $appointment = request(); @@ -295,7 +295,7 @@ class Appointments_api_v1 extends EA_Controller * * @param int $id Appointment ID. */ - public function update(int $id) + public function update(int $id): void { try { $occurrences = $this->appointments_model->get(['id' => $id]); @@ -331,7 +331,7 @@ class Appointments_api_v1 extends EA_Controller * * @param int $id Appointment ID. */ - public function destroy(int $id) + public function destroy(int $id): void { try { $occurrences = $this->appointments_model->get(['id' => $id]); diff --git a/application/controllers/api/v1/Availabilities_api_v1.php b/application/controllers/api/v1/Availabilities_api_v1.php index e0a87ec8..a696b52d 100644 --- a/application/controllers/api/v1/Availabilities_api_v1.php +++ b/application/controllers/api/v1/Availabilities_api_v1.php @@ -54,7 +54,7 @@ class Availabilities_api_v1 extends EA_Controller * * If no date parameter is provided then the current date will be used. */ - public function get() + public function get(): void { try { $provider_id = request('providerId'); diff --git a/application/controllers/api/v1/Customers_api_v1.php b/application/controllers/api/v1/Customers_api_v1.php index 693cc7b5..8f0b5fdd 100644 --- a/application/controllers/api/v1/Customers_api_v1.php +++ b/application/controllers/api/v1/Customers_api_v1.php @@ -35,7 +35,7 @@ class Customers_api_v1 extends EA_Controller /** * Get a customer collection. */ - public function index() + public function index(): void { try { $keyword = $this->api->request_keyword(); @@ -77,7 +77,7 @@ class Customers_api_v1 extends EA_Controller * * @param int|null $id Customer ID. */ - public function show(int $id = null) + public function show(int $id = null): void { try { $fields = $this->api->request_fields(); @@ -105,7 +105,7 @@ class Customers_api_v1 extends EA_Controller /** * Store a new customer. */ - public function store() + public function store(): void { try { $customer = request(); @@ -133,7 +133,7 @@ class Customers_api_v1 extends EA_Controller * * @param int $id Customer ID. */ - public function update(int $id) + public function update(int $id): void { try { $occurrences = $this->customers_model->get(['id' => $id]); @@ -167,7 +167,7 @@ class Customers_api_v1 extends EA_Controller * * @param int $id Customer ID. */ - public function destroy(int $id) + public function destroy(int $id): void { try { $occurrences = $this->customers_model->get(['id' => $id]); diff --git a/application/controllers/api/v1/Providers_api_v1.php b/application/controllers/api/v1/Providers_api_v1.php index 916942b9..5613fa40 100644 --- a/application/controllers/api/v1/Providers_api_v1.php +++ b/application/controllers/api/v1/Providers_api_v1.php @@ -35,7 +35,7 @@ class Providers_api_v1 extends EA_Controller /** * Get a provider collection. */ - public function index() + public function index(): void { try { $keyword = $this->api->request_keyword(); @@ -77,7 +77,7 @@ class Providers_api_v1 extends EA_Controller * * @param int|null $id Provider ID. */ - public function show(int $id = null) + public function show(int $id = null): void { try { $fields = $this->api->request_fields(); @@ -111,7 +111,7 @@ class Providers_api_v1 extends EA_Controller /** * Store a new provider. */ - public function store() + public function store(): void { try { $provider = request(); @@ -151,7 +151,7 @@ class Providers_api_v1 extends EA_Controller * * @param int $id Provider ID. */ - public function update(int $id) + public function update(int $id): void { try { $occurrences = $this->providers_model->get(['id' => $id]); @@ -185,7 +185,7 @@ class Providers_api_v1 extends EA_Controller * * @param int $id Provider ID. */ - public function destroy(int $id) + public function destroy(int $id): void { try { $occurrences = $this->providers_model->get(['id' => $id]); diff --git a/application/controllers/api/v1/Secretaries_api_v1.php b/application/controllers/api/v1/Secretaries_api_v1.php index 9d151565..7ff4c8c4 100644 --- a/application/controllers/api/v1/Secretaries_api_v1.php +++ b/application/controllers/api/v1/Secretaries_api_v1.php @@ -35,7 +35,7 @@ class Secretaries_api_v1 extends EA_Controller /** * Get a secretary collection. */ - public function index() + public function index(): void { try { $keyword = $this->api->request_keyword(); @@ -77,7 +77,7 @@ class Secretaries_api_v1 extends EA_Controller * * @param int|null $id Secretary ID. */ - public function show(int $id = null) + public function show(int $id = null): void { try { $fields = $this->api->request_fields(); @@ -105,7 +105,7 @@ class Secretaries_api_v1 extends EA_Controller /** * Store a new secretary. */ - public function store() + public function store(): void { try { $secretary = request(); @@ -141,7 +141,7 @@ class Secretaries_api_v1 extends EA_Controller * * @param int $id Secretary ID. */ - public function update(int $id) + public function update(int $id): void { try { $occurrences = $this->secretaries_model->get(['id' => $id]); @@ -175,7 +175,7 @@ class Secretaries_api_v1 extends EA_Controller * * @param int $id Secretary ID. */ - public function destroy(int $id) + public function destroy(int $id): void { try { $occurrences = $this->secretaries_model->get(['id' => $id]); diff --git a/application/controllers/api/v1/Service_categories_api_v1.php b/application/controllers/api/v1/Service_categories_api_v1.php index c8c84481..c0b288f9 100644 --- a/application/controllers/api/v1/Service_categories_api_v1.php +++ b/application/controllers/api/v1/Service_categories_api_v1.php @@ -35,7 +35,7 @@ class Service_categories_api_v1 extends EA_Controller /** * Get a service-category collection. */ - public function index() + public function index(): void { try { $keyword = $this->api->request_keyword(); @@ -77,7 +77,7 @@ class Service_categories_api_v1 extends EA_Controller * * @param int|null $id Service-category ID. */ - public function show(int $id = null) + public function show(int $id = null): void { try { $fields = $this->api->request_fields(); @@ -111,7 +111,7 @@ class Service_categories_api_v1 extends EA_Controller /** * Store a new service-category. */ - public function store() + public function store(): void { try { $service_category = request(); @@ -139,7 +139,7 @@ class Service_categories_api_v1 extends EA_Controller * * @param int $id Service-category ID. */ - public function update(int $id) + public function update(int $id): void { try { $occurrences = $this->service_categories_model->get(['id' => $id]); @@ -173,7 +173,7 @@ class Service_categories_api_v1 extends EA_Controller * * @param int $id Service-category ID. */ - public function destroy(int $id) + public function destroy(int $id): void { try { $occurrences = $this->service_categories_model->get(['id' => $id]); diff --git a/application/controllers/api/v1/Services_api_v1.php b/application/controllers/api/v1/Services_api_v1.php index fa6f250d..47eaa7cd 100644 --- a/application/controllers/api/v1/Services_api_v1.php +++ b/application/controllers/api/v1/Services_api_v1.php @@ -35,7 +35,7 @@ class Services_api_v1 extends EA_Controller /** * Get an service collection. */ - public function index() + public function index(): void { try { $keyword = $this->api->request_keyword(); @@ -77,7 +77,7 @@ class Services_api_v1 extends EA_Controller * * @param int|null $id Service ID. */ - public function show(int $id = null) + public function show(int $id = null): void { try { $fields = $this->api->request_fields(); @@ -111,7 +111,7 @@ class Services_api_v1 extends EA_Controller /** * Store a new service. */ - public function store() + public function store(): void { try { $service = request(); @@ -139,7 +139,7 @@ class Services_api_v1 extends EA_Controller * * @param int $id Service ID. */ - public function update(int $id) + public function update(int $id): void { try { $occurrences = $this->services_model->get(['id' => $id]); @@ -173,7 +173,7 @@ class Services_api_v1 extends EA_Controller * * @param int $id Service ID. */ - public function destroy(int $id) + public function destroy(int $id): void { try { $occurrences = $this->services_model->get(['id' => $id]); diff --git a/application/controllers/api/v1/Settings_api_v1.php b/application/controllers/api/v1/Settings_api_v1.php index 177757f6..e32f237c 100644 --- a/application/controllers/api/v1/Settings_api_v1.php +++ b/application/controllers/api/v1/Settings_api_v1.php @@ -71,7 +71,7 @@ class Settings_api_v1 extends EA_Controller * * @param string $name Setting name. */ - public function show(string $name) + public function show(string $name): void { try { $value = setting($name); @@ -90,7 +90,7 @@ class Settings_api_v1 extends EA_Controller * * @param string $name Setting name. */ - public function update(string $name) + public function update(string $name): void { try { $value = request('value'); diff --git a/application/controllers/api/v1/Unavailabilities_api_v1.php b/application/controllers/api/v1/Unavailabilities_api_v1.php index dbf304bd..0c6d7bc8 100644 --- a/application/controllers/api/v1/Unavailabilities_api_v1.php +++ b/application/controllers/api/v1/Unavailabilities_api_v1.php @@ -35,7 +35,7 @@ class Unavailabilities_api_v1 extends EA_Controller /** * Get an unavailability collection. */ - public function index() + public function index(): void { try { $keyword = $this->api->request_keyword(); @@ -77,7 +77,7 @@ class Unavailabilities_api_v1 extends EA_Controller * * @param int|null $id Unavailability ID. */ - public function show(int $id = null) + public function show(int $id = null): void { try { $fields = $this->api->request_fields(); @@ -111,7 +111,7 @@ class Unavailabilities_api_v1 extends EA_Controller /** * Store a new unavailability. */ - public function store() + public function store(): void { try { $unavailability = request(); @@ -139,7 +139,7 @@ class Unavailabilities_api_v1 extends EA_Controller * * @param int $id Unavailability ID. */ - public function update(int $id) + public function update(int $id): void { try { $occurrences = $this->unavailabilities_model->get(['id' => $id]); @@ -173,7 +173,7 @@ class Unavailabilities_api_v1 extends EA_Controller * * @param int $id Unavailability ID. */ - public function destroy(int $id) + public function destroy(int $id): void { try { $occurrences = $this->unavailabilities_model->get(['id' => $id]); diff --git a/application/controllers/api/v1/Webhooks_api_v1.php b/application/controllers/api/v1/Webhooks_api_v1.php index b7baa954..e1e019f6 100644 --- a/application/controllers/api/v1/Webhooks_api_v1.php +++ b/application/controllers/api/v1/Webhooks_api_v1.php @@ -35,7 +35,7 @@ class Webhooks_api_v1 extends EA_Controller /** * Get a webhook collection. */ - public function index() + public function index(): void { try { $keyword = $this->api->request_keyword(); @@ -77,7 +77,7 @@ class Webhooks_api_v1 extends EA_Controller * * @param int|null $id Webhook ID. */ - public function show(int $id = null) + public function show(int $id = null): void { try { $fields = $this->api->request_fields(); @@ -111,7 +111,7 @@ class Webhooks_api_v1 extends EA_Controller /** * Store a new webhook. */ - public function store() + public function store(): void { try { $webhook = request(); @@ -139,7 +139,7 @@ class Webhooks_api_v1 extends EA_Controller * * @param int $id Webhook ID. */ - public function update(int $id) + public function update(int $id): void { try { $occurrences = $this->webhooks_model->get(['id' => $id]); @@ -173,7 +173,7 @@ class Webhooks_api_v1 extends EA_Controller * * @param int $id Webhook ID. */ - public function destroy(int $id) + public function destroy(int $id): void { try { $occurrences = $this->webhooks_model->get(['id' => $id]); From cd6280b97d13c35802fa760e45eada5ff0eeb818 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Fri, 5 Jan 2024 19:20:00 +0100 Subject: [PATCH 8/8] Make sure the API returns 404 on show if the ID was not found --- application/controllers/api/v1/Admins_api_v1.php | 14 ++++++++------ .../controllers/api/v1/Appointments_api_v1.php | 14 ++++++++------ .../controllers/api/v1/Customers_api_v1.php | 14 ++++++++------ .../controllers/api/v1/Providers_api_v1.php | 14 ++++++++------ .../controllers/api/v1/Secretaries_api_v1.php | 14 ++++++++------ .../api/v1/Service_categories_api_v1.php | 14 ++++++++------ application/controllers/api/v1/Services_api_v1.php | 14 ++++++++------ .../controllers/api/v1/Unavailabilities_api_v1.php | 14 ++++++++------ application/controllers/api/v1/Webhooks_api_v1.php | 14 ++++++++------ 9 files changed, 72 insertions(+), 54 deletions(-) diff --git a/application/controllers/api/v1/Admins_api_v1.php b/application/controllers/api/v1/Admins_api_v1.php index 5f15216b..6faa6584 100644 --- a/application/controllers/api/v1/Admins_api_v1.php +++ b/application/controllers/api/v1/Admins_api_v1.php @@ -82,6 +82,14 @@ class Admins_api_v1 extends EA_Controller public function show(int $id = null): void { try { + $occurrences = $this->admins_model->get(['id' => $id]); + + if (empty($occurrences)) { + response('', 404); + + return; + } + $fields = $this->api->request_fields(); $with = $this->api->request_with(); @@ -98,12 +106,6 @@ class Admins_api_v1 extends EA_Controller $this->admins_model->load($admin, $with); } - if (!$admin) { - response('', 404); - - return; - } - json_response($admin); } catch (Throwable $e) { json_exception($e); diff --git a/application/controllers/api/v1/Appointments_api_v1.php b/application/controllers/api/v1/Appointments_api_v1.php index 54e3c2d2..d3914e8d 100644 --- a/application/controllers/api/v1/Appointments_api_v1.php +++ b/application/controllers/api/v1/Appointments_api_v1.php @@ -174,6 +174,14 @@ class Appointments_api_v1 extends EA_Controller public function show(int $id = null): void { try { + $occurrences = $this->appointments_model->get(['id' => $id]); + + if (empty($occurrences)) { + response('', 404); + + return; + } + $fields = $this->api->request_fields(); $with = $this->api->request_with(); @@ -190,12 +198,6 @@ class Appointments_api_v1 extends EA_Controller $this->appointments_model->load($appointment, $with); } - if (!$appointment) { - response('Not Found', 404); - - return; - } - json_response($appointment); } catch (Throwable $e) { json_exception($e); diff --git a/application/controllers/api/v1/Customers_api_v1.php b/application/controllers/api/v1/Customers_api_v1.php index 8f0b5fdd..9141776d 100644 --- a/application/controllers/api/v1/Customers_api_v1.php +++ b/application/controllers/api/v1/Customers_api_v1.php @@ -80,6 +80,14 @@ class Customers_api_v1 extends EA_Controller public function show(int $id = null): void { try { + $occurrences = $this->customers_model->get(['id' => $id]); + + if (empty($occurrences)) { + response('', 404); + + return; + } + $fields = $this->api->request_fields(); $customer = $this->customers_model->find($id); @@ -90,12 +98,6 @@ class Customers_api_v1 extends EA_Controller $this->customers_model->only($customer, $fields); } - if (!$customer) { - response('', 404); - - return; - } - json_response($customer); } catch (Throwable $e) { json_exception($e); diff --git a/application/controllers/api/v1/Providers_api_v1.php b/application/controllers/api/v1/Providers_api_v1.php index 5613fa40..f9ba2062 100644 --- a/application/controllers/api/v1/Providers_api_v1.php +++ b/application/controllers/api/v1/Providers_api_v1.php @@ -80,6 +80,14 @@ class Providers_api_v1 extends EA_Controller public function show(int $id = null): void { try { + $occurrences = $this->providers_model->get(['id' => $id]); + + if (empty($occurrences)) { + response('', 404); + + return; + } + $fields = $this->api->request_fields(); $with = $this->api->request_with(); @@ -96,12 +104,6 @@ class Providers_api_v1 extends EA_Controller $this->providers_model->load($provider, $with); } - if (!$provider) { - response('', 404); - - return; - } - json_response($provider); } catch (Throwable $e) { json_exception($e); diff --git a/application/controllers/api/v1/Secretaries_api_v1.php b/application/controllers/api/v1/Secretaries_api_v1.php index 7ff4c8c4..fec32f32 100644 --- a/application/controllers/api/v1/Secretaries_api_v1.php +++ b/application/controllers/api/v1/Secretaries_api_v1.php @@ -80,6 +80,14 @@ class Secretaries_api_v1 extends EA_Controller public function show(int $id = null): void { try { + $occurrences = $this->secretaries_model->get(['id' => $id]); + + if (empty($occurrences)) { + response('', 404); + + return; + } + $fields = $this->api->request_fields(); $secretary = $this->secretaries_model->find($id); @@ -90,12 +98,6 @@ class Secretaries_api_v1 extends EA_Controller $this->secretaries_model->only($secretary, $fields); } - if (!$secretary) { - response('', 404); - - return; - } - json_response($secretary); } catch (Throwable $e) { json_exception($e); diff --git a/application/controllers/api/v1/Service_categories_api_v1.php b/application/controllers/api/v1/Service_categories_api_v1.php index c0b288f9..7a1d2dec 100644 --- a/application/controllers/api/v1/Service_categories_api_v1.php +++ b/application/controllers/api/v1/Service_categories_api_v1.php @@ -80,6 +80,14 @@ class Service_categories_api_v1 extends EA_Controller public function show(int $id = null): void { try { + $occurrences = $this->service_categories_model->get(['id' => $id]); + + if (empty($occurrences)) { + response('', 404); + + return; + } + $fields = $this->api->request_fields(); $with = $this->api->request_with(); @@ -96,12 +104,6 @@ class Service_categories_api_v1 extends EA_Controller $this->service_categories_model->load($service_category, $with); } - if (!$service_category) { - response('', 404); - - return; - } - json_response($service_category); } catch (Throwable $e) { json_exception($e); diff --git a/application/controllers/api/v1/Services_api_v1.php b/application/controllers/api/v1/Services_api_v1.php index 47eaa7cd..397550da 100644 --- a/application/controllers/api/v1/Services_api_v1.php +++ b/application/controllers/api/v1/Services_api_v1.php @@ -80,6 +80,14 @@ class Services_api_v1 extends EA_Controller public function show(int $id = null): void { try { + $occurrences = $this->services_model->get(['id' => $id]); + + if (empty($occurrences)) { + response('', 404); + + return; + } + $fields = $this->api->request_fields(); $with = $this->api->request_with(); @@ -96,12 +104,6 @@ class Services_api_v1 extends EA_Controller $this->services_model->load($service, $with); } - if (!$service) { - response('', 404); - - return; - } - json_response($service); } catch (Throwable $e) { json_exception($e); diff --git a/application/controllers/api/v1/Unavailabilities_api_v1.php b/application/controllers/api/v1/Unavailabilities_api_v1.php index 0c6d7bc8..016c1964 100644 --- a/application/controllers/api/v1/Unavailabilities_api_v1.php +++ b/application/controllers/api/v1/Unavailabilities_api_v1.php @@ -80,6 +80,14 @@ class Unavailabilities_api_v1 extends EA_Controller public function show(int $id = null): void { try { + $occurrences = $this->unavailabilities_model->get(['id' => $id]); + + if (empty($occurrences)) { + response('', 404); + + return; + } + $fields = $this->api->request_fields(); $with = $this->api->request_with(); @@ -96,12 +104,6 @@ class Unavailabilities_api_v1 extends EA_Controller $this->unavailabilities_model->load($unavailability, $with); } - if (!$unavailability) { - response('', 404); - - return; - } - json_response($unavailability); } catch (Throwable $e) { json_exception($e); diff --git a/application/controllers/api/v1/Webhooks_api_v1.php b/application/controllers/api/v1/Webhooks_api_v1.php index e1e019f6..75e71032 100644 --- a/application/controllers/api/v1/Webhooks_api_v1.php +++ b/application/controllers/api/v1/Webhooks_api_v1.php @@ -80,6 +80,14 @@ class Webhooks_api_v1 extends EA_Controller public function show(int $id = null): void { try { + $occurrences = $this->webhooks_model->get(['id' => $id]); + + if (empty($occurrences)) { + response('', 404); + + return; + } + $fields = $this->api->request_fields(); $with = $this->api->request_with(); @@ -96,12 +104,6 @@ class Webhooks_api_v1 extends EA_Controller $this->webhooks_model->load($webhook, $with); } - if (!$webhook) { - response('', 404); - - return; - } - json_response($webhook); } catch (Throwable $e) { json_exception($e);