Renamed the add_unavailable method to save_unavailable for consistency

This commit is contained in:
Alex Tselegidis 2021-10-29 13:12:39 +02:00
parent e29c2198de
commit 182cebfb74
3 changed files with 5 additions and 5 deletions

View file

@ -496,7 +496,7 @@ 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->add_unavailable($unavailable); $unavailable['id'] = $this->appointments_model->save_unavailable($unavailable);
$unavailable = $this->appointments_model->find($unavailable['id']); // fetch all inserted data $unavailable = $this->appointments_model->find($unavailable['id']); // fetch all inserted data
// Google Sync // Google Sync
@ -514,7 +514,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->add_unavailable($unavailable); $this->appointments_model->save_unavailable($unavailable);
} }
else else
{ {

View file

@ -92,7 +92,7 @@ class Unavailabilities extends API_V1_Controller {
unset($unavailability['id']); unset($unavailability['id']);
} }
$id = $this->appointments_model->add_unavailable($unavailability); $id = $this->appointments_model->save_unavailable($unavailability);
// Fetch the new object from the database and return it to the client. // Fetch the new object from the database and return it to the client.
$batch = $this->appointments_model->get(['id' => $id]); $batch = $this->appointments_model->get(['id' => $id]);
@ -128,7 +128,7 @@ class Unavailabilities extends API_V1_Controller {
$baseUnavailability = $batch[0]; $baseUnavailability = $batch[0];
$this->parser->decode($updatedUnavailability, $baseUnavailability); $this->parser->decode($updatedUnavailability, $baseUnavailability);
$updatedUnavailability['id'] = $id; $updatedUnavailability['id'] = $id;
$id = $this->appointments_model->add_unavailable($updatedUnavailability); $id = $this->appointments_model->save_unavailable($updatedUnavailability);
// Fetch the updated object from the database and return it to the client. // Fetch the updated object from the database and return it to the client.
$batch = $this->appointments_model->get(['id' => $id]); $batch = $this->appointments_model->get(['id' => $id]);

View file

@ -311,7 +311,7 @@ class Appointments_model extends EA_Model {
* *
* @throws InvalidArgumentException * @throws InvalidArgumentException
*/ */
public function add_unavailable(array $unavailable): int public function save_unavailable(array $unavailable): int
{ {
// Make sure the start date time is before the end date time. // Make sure the start date time is before the end date time.
$start = strtotime($unavailable['start_datetime']); $start = strtotime($unavailable['start_datetime']);