Replaced the appointments model with the unavailabilities model in the Backend_api.php

This commit is contained in:
Alex Tselegidis 2021-11-06 14:56:56 +01:00
parent 00f54dcfec
commit 27c5c3ab35

View file

@ -41,6 +41,7 @@ class Backend_api extends EA_Controller {
$this->load->model('service_categories_model'); $this->load->model('service_categories_model');
$this->load->model('services_model'); $this->load->model('services_model');
$this->load->model('settings_model'); $this->load->model('settings_model');
$this->load->model('unavailabilities_model');
$this->load->model('users_model'); $this->load->model('users_model');
$this->load->library('google_sync'); $this->load->library('google_sync');
@ -496,8 +497,9 @@ class Backend_api extends EA_Controller {
$provider = $this->providers_model->find($unavailable['id_users_provider']); $provider = $this->providers_model->find($unavailable['id_users_provider']);
// Add appointment // Add appointment
$unavailable['id'] = $this->appointments_model->save_unavailable($unavailable); $unavailable['id'] = $this->unavailabilities_model->save($unavailable);
$unavailable = $this->appointments_model->find($unavailable['id']); // fetch all inserted data
$unavailable = $this->unavailabilities_model->find($unavailable['id']); // fetch all inserted data
// Google Sync // Google Sync
try try
@ -514,7 +516,7 @@ class Backend_api extends EA_Controller {
{ {
$google_event = $this->google_sync->add_unavailable($provider, $unavailable); $google_event = $this->google_sync->add_unavailable($provider, $unavailable);
$unavailable['id_google_calendar'] = $google_event->id; $unavailable['id_google_calendar'] = $google_event->id;
$this->appointments_model->save_unavailable($unavailable); $this->unavailabilities_model->save($unavailable);
} }
else else
{ {