Merge remote-tracking branch 'upstream/develop' into develop

This commit is contained in:
Aliberk Sandıkçı 2024-01-05 21:32:28 +03:00
commit 26d909a19b
Signed by: asandikci
GPG key ID: 25C67A03B5666BC1
18 changed files with 233 additions and 166 deletions

View file

@ -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,9 +79,17 @@ 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 {
$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);
@ -113,7 +115,7 @@ class Admins_api_v1 extends EA_Controller
/**
* Store a new admin.
*/
public function store()
public function store(): void
{
try {
$admin = request();
@ -145,7 +147,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 +181,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]);

View file

@ -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,9 +171,17 @@ 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 {
$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);
@ -205,7 +207,7 @@ class Appointments_api_v1 extends EA_Controller
/**
* Store a new appointment.
*/
public function store()
public function store(): void
{
try {
$appointment = request();
@ -295,7 +297,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 +333,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]);

View file

@ -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');

View file

@ -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,9 +77,17 @@ 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 {
$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);
@ -105,7 +107,7 @@ class Customers_api_v1 extends EA_Controller
/**
* Store a new customer.
*/
public function store()
public function store(): void
{
try {
$customer = request();
@ -133,7 +135,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 +169,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]);

View file

@ -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,9 +77,17 @@ 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 {
$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);
@ -111,7 +113,7 @@ class Providers_api_v1 extends EA_Controller
/**
* Store a new provider.
*/
public function store()
public function store(): void
{
try {
$provider = request();
@ -151,7 +153,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 +187,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]);

View file

@ -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,9 +77,17 @@ 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 {
$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);
@ -105,7 +107,7 @@ class Secretaries_api_v1 extends EA_Controller
/**
* Store a new secretary.
*/
public function store()
public function store(): void
{
try {
$secretary = request();
@ -141,7 +143,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 +177,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]);

View file

@ -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,9 +77,17 @@ 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 {
$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);
@ -111,7 +113,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 +141,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 +175,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]);

View file

@ -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,9 +77,17 @@ 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 {
$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);
@ -111,7 +113,7 @@ class Services_api_v1 extends EA_Controller
/**
* Store a new service.
*/
public function store()
public function store(): void
{
try {
$service = request();
@ -139,7 +141,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 +175,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]);

View file

@ -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');

View file

@ -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,9 +77,17 @@ 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 {
$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);
@ -111,7 +113,7 @@ class Unavailabilities_api_v1 extends EA_Controller
/**
* Store a new unavailability.
*/
public function store()
public function store(): void
{
try {
$unavailability = request();
@ -139,7 +141,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 +175,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]);

View file

@ -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,9 +77,17 @@ 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 {
$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);
@ -111,7 +113,7 @@ class Webhooks_api_v1 extends EA_Controller
/**
* Store a new webhook.
*/
public function store()
public function store(): void
{
try {
$webhook = request();
@ -139,7 +141,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 +175,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]);

View file

@ -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

View file

@ -1,10 +0,0 @@
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View file

@ -446,7 +446,16 @@ $lang['blocked_periods'] = 'Blocked Periods';
$lang['blocked_period_save'] = 'Blocked Period Save';
$lang['blocked_period_delete'] = 'Blocked Period Delete';
$lang['blocked_periods_hint'] = 'Define periods of time where public bookings will be disabled for all providers (e.g. closed dates, holidays etc.).';
<<<<<<< HEAD
$lang['custom_field'] = 'Değiştirilebilir Alan';
$lang['custom_fields'] = 'Değiştirilebilir Alanlar';
$lang['label'] = 'Etiket';
=======
$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';
>>>>>>> upstream/develop
// End

View file

@ -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']);

View file

@ -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;
}
}

View file

@ -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:

View file

@ -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':
@ -311,6 +317,10 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
x-codegen-request-body-name: body
security:
- BearerToken: [ ]
- BasicAuth: [ ]
post:
tags:
- unavailabilities
@ -470,7 +480,9 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/CustomerCollection'
type: array
items:
$ref: '#/components/schemas/CustomerRecord'
'401':
description: Unauthorized
'500':
@ -641,7 +653,9 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/ServiceCollection'
type: array
items:
$ref: '#/components/schemas/ServiceRecord'
'401':
description: Unauthorized
'500':
@ -812,7 +826,9 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/ServiceCategoryCollection'
type: array
items:
$ref: '#/components/schemas/ServiceCategoryRecord'
'401':
description: Unauthorized
'500':
@ -983,7 +999,9 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminCollection'
type: array
items:
$ref: '#/components/schemas/AdminRecord'
'401':
description: Unauthorized
'500':
@ -1154,7 +1172,9 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/ProviderCollection'
type: array
items:
$ref: '#/components/schemas/ProviderRecord'
'401':
description: Unauthorized
'500':
@ -1325,7 +1345,9 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/SecretaryCollection'
type: array
items:
$ref: '#/components/schemas/SecretaryRecord'
'401':
description: Unauthorized
'500':
@ -1490,7 +1512,9 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/SettingCollection'
type: array
items:
$ref: '#/components/schemas/ServiceRecord'
'401':
description: Unauthorized
'500':
@ -1606,7 +1630,9 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/WebhookCollection'
type: array
items:
$ref: '#/components/schemas/WebhookRecord'
'401':
description: Unauthorized
'500':
@ -1821,10 +1847,6 @@ components:
customerId: 5
providerId: 2
serviceId: 6
AppointmentCollection:
type: array
items:
$ref: '#/components/schemas/AppointmentRecord'
UnavailabilityRecord:
type: object
properties:
@ -1875,10 +1897,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 +1996,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 +2062,6 @@ components:
availabilitiesType: flexible
attendantsNumber: 1
serviceCategoryId: null
ServiceCollection:
type: array
items:
$ref: '#/components/schemas/ServiceRecord'
ServiceCategoryRecord:
type: object
properties:
@ -2075,10 +2085,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 +2193,6 @@ components:
password: Password@123
notifications: true
calendarView: default
AdminCollection:
type: array
items:
$ref: '#/components/schemas/AdminRecord'
ProviderRecord:
type: object
properties:
@ -2391,10 +2393,6 @@ components:
end: '17:00'
breaks: [ ]
saturday: null
ProviderCollection:
type: array
items:
$ref: '#/components/schemas/ProviderRecord'
SecretaryRecord:
type: object
properties:
@ -2516,10 +2514,6 @@ components:
password: Password@123
notifications: true
calendarView: default
SecretaryCollection:
type: array
items:
$ref: '#/components/schemas/SecretaryRecord'
SettingRecord:
type: object
properties:
@ -2537,10 +2531,6 @@ components:
type: string
example:
value: ACME Inc
SettingCollection:
type: array
items:
$ref: '#/components/schemas/SettingRecord'
WebhookRecord:
type: object
properties:
@ -2588,10 +2578,6 @@ components:
secretToken: SecureSecretTokenHere
isSslVerified: true
notes: This is a webhook.
WebhookCollection:
type: array
items:
$ref: '#/components/schemas/WebhookRecord'
ErrorResponse:
type: object
properties: