diff --git a/Source/API/script/Config/databaseScript.php b/Source/API/script/Config/databaseScript.php index 2ab24ca..8a82848 100644 --- a/Source/API/script/Config/databaseScript.php +++ b/Source/API/script/Config/databaseScript.php @@ -17,32 +17,7 @@ class ScriptDatabase { public function executeScript(): void { - $queryScript = "-- phpMyAdmin SQL Dump --- version 5.1.2 --- https://www.phpmyadmin.net/ --- --- Hôte : localhost:3306 --- Généré le : lun. 06 mars 2023 à 14:52 --- Version du serveur : 5.7.24 --- Version de PHP : 8.0.1 - -START TRANSACTION; - - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8mb4 */; - --- --- Base de données : `formulaire` --- - --- -------------------------------------------------------- - --- --- Structure de la table `admin` --- + $queryScript = ' CREATE TABLE `admin` ( `username` varchar(50) NOT NULL, @@ -317,7 +292,7 @@ COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; -"; +'; $this->connection->executeQuery($queryScript); $queryScript = "INSERT INTO `form` (`id`, `title`, `description`) VALUES (1, 'Votre avis nous intéresse !', 'Ce formulaire vous permet de candidater à une potentielle interview si votre profil nous intéresse.')"; $this->connection->executeQuery($queryScript); diff --git a/Source/API/script/index.php b/Source/API/script/index.php index 8415656..be783fc 100644 --- a/Source/API/script/index.php +++ b/Source/API/script/index.php @@ -359,7 +359,7 @@ $app->delete('/deleteQuestion', function(Request $request, Response $response){ throw new TypeErrorParameters($request); } try{ - (new GatewayQuestion)->deleteQuestion($parameters['classQuestion'],$parameters['id'], $parameters['listPossibleResponse']); + (new GatewayQuestion)->deleteQuestion($parameters['classQuestion'],$parameters['id'], json_decode($parameters['listPossibleResponse'])); }catch (PDOException $e){ throw new PDOError($request,$e->getMessage(),$e); } @@ -453,7 +453,7 @@ $app->post('/insertResponseInQuestion', function(Request $request, Response $res throw new TypeErrorParameters($request); } try{ - (new GatewayQuestion)->insertResponseInQuestion($parameters['response'],$parameters['categories'],$parameters['idQuestion']); + (new GatewayQuestion)->insertResponseInQuestion($parameters['response'],json_decode($parameters['categories']),$parameters['idQuestion']); }catch (PDOException $e){ throw new PDOError($request,$e->getMessage(),$e); }