diff --git a/src/API/requests.php b/src/API/requests.php index 52079a8..144d77a 100644 --- a/src/API/requests.php +++ b/src/API/requests.php @@ -135,14 +135,9 @@ $router->GET('/api/past-rdv-patient', ["id"], function($id){ getPastRdvByPatient($pdo, $id); }); -$router->DELETE('/api/delete-empty', ["id"], function($id){ +$router->DELETE('/api/cancel-empty-rdv', ["id"], function($id){ global $pdo; - DeleteEmptyRdv($pdo, $id); -}); - -$router->DELETE('/api/cancel-rdv', ["id"], function($id){ - global $pdo; - CancelRDV($pdo, $id); + CancelEmptyRDV($pdo, $id); }); $router->POST('/api/create-rdv', ["medID", "date", "time", "lieu"], function($medID, $date, $time, $lieu){ diff --git a/src/API/test/database.php b/src/API/test/database.php index 75fd92e..74f9dfd 100644 --- a/src/API/test/database.php +++ b/src/API/test/database.php @@ -1,22 +1,6 @@ setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - } - catch (PDOException $exception) - { - error_log('Connection error: '.$exception->getMessage()); - return false; - } - return $db; -}*/ - - function dbRequestRdvPraticien($pdo, $id){ $statement = $pdo->prepare("SELECT rdv_date, rdv_time, concat(p_name,' ', p_surname) as patient, p_mail, p_phone FROM rendez_vous @@ -129,19 +113,14 @@ function CreateRDV($pdo, $medID, $date, $time, $lieu){ } } -function DeleteEmptyRdv($pdo, $id) -{ - $statement = $pdo->prepare("SELECT p_id FROM rendez_vous WHERE rdv_id = :id"); +function CancelEmptyRDV($pdo, $id){ + $statement = $pdo->prepare("DELETE FROM propose WHERE rdv_id = :id"); $statement->bindParam(':id', $id); $statement->execute(); - $result = $statement->fetch(PDO::FETCH_ASSOC); - if ($result['p_id'] == null) { - $statement = $pdo->prepare("DELETE FROM rendez_vous WHERE rdv_id = :id"); - $statement->bindParam(':id', $id); - $statement->execute(); - Response::HTTP200(["Success" => "RDV deleted"]); - } - Response::HTTP403(["Forbidden" => "This RDV is not empty"]); + $statement = $pdo->prepare("DELETE FROM rendez_vous WHERE rdv_id = :id"); + $statement->bindParam(':id', $id); + $statement->execute(); + Response::HTTP200(["Success" => "RDV deleted"]); } function CancelRDVFromPatient($pdo, $id){ diff --git a/src/API/test/request.php b/src/API/test/request.php deleted file mode 100644 index 11aedc2..0000000 --- a/src/API/test/request.php +++ /dev/null @@ -1,26 +0,0 @@ - -

+

Doct'ISEN

-
+
avatar