@ -60,7 +60,7 @@ $app->post('/insertForm', function(Request $request, Response $response){
throw new PDOError($request,$e->getMessage(),$e);
throw new PDOError($request,$e->getMessage(),$e);
}
}
$response->getBody()->write("OK");
$response->getBody()->write("OK");
return $response;
return $response->withStatus(200) ;
});
});
$app->delete('/deleteForm', function(Request $request, Response $response){
$app->delete('/deleteForm', function(Request $request, Response $response){
@ -74,7 +74,7 @@ $app->delete('/deleteForm', function(Request $request, Response $response){
throw new PDOError($request,$e->getMessage(),$e);
throw new PDOError($request,$e->getMessage(),$e);
}
}
$response->getBody()->write("OK");
$response->getBody()->write("OK");
return $response;
return $response->withStatus(200) ;
});
});
$app->get('/existsForm', function(Request $request, Response $response){
$app->get('/existsForm', function(Request $request, Response $response){
@ -101,7 +101,7 @@ $app->post('/assignKeywordToQuestion', function(Request $request, Response $resp
throw new PDOError($request,$e->getMessage(),$e);
throw new PDOError($request,$e->getMessage(),$e);
}
}
$response->getBody()->write("OK");
$response->getBody()->write("OK");
return $response;
return $response->withStatus(200) ;
});
});
$app->delete('/deleteKeywordFromQuestion', function(Request $request, Response $response){
$app->delete('/deleteKeywordFromQuestion', function(Request $request, Response $response){
@ -115,7 +115,7 @@ $app->delete('/deleteKeywordFromQuestion', function(Request $request, Response $
throw new PDOError($request,$e->getMessage(),$e);
throw new PDOError($request,$e->getMessage(),$e);
}
}
$response->getBody()->write("OK");
$response->getBody()->write("OK");
return $response;
return $response->withStatus(200) ;
});
});
$app->put('/updateTitleToForm', function(Request $request, Response $response){
$app->put('/updateTitleToForm', function(Request $request, Response $response){
@ -129,7 +129,7 @@ $app->put('/updateTitleToForm', function(Request $request, Response $response){
throw new PDOError($request,$e->getMessage(),$e);
throw new PDOError($request,$e->getMessage(),$e);
}
}
$response->getBody()->write("OK");
$response->getBody()->write("OK");
return $response;
return $response->withStatus(200) ;
});
});
$app->put('/updateDescriptionToForm', function(Request $request, Response $response){
$app->put('/updateDescriptionToForm', function(Request $request, Response $response){
@ -143,7 +143,7 @@ $app->put('/updateDescriptionToForm', function(Request $request, Response $respo
throw new PDOError($request,$e->getMessage(),$e);
throw new PDOError($request,$e->getMessage(),$e);
}
}
$response->getBody()->write("OK");
$response->getBody()->write("OK");
return $response;
return $response->withStatus(200) ;
});
});
$app->delete('/deleteDescriptionToForm', function(Request $request, Response $response){
$app->delete('/deleteDescriptionToForm', function(Request $request, Response $response){
@ -157,7 +157,7 @@ $app->delete('/deleteDescriptionToForm', function(Request $request, Response $re
throw new PDOError($request,$e->getMessage(),$e);
throw new PDOError($request,$e->getMessage(),$e);
}
}
$response->getBody()->write("OK");
$response->getBody()->write("OK");
return $response;
return $response->withStatus(200) ;
});
});
$app->post('/insertKeyword', function(Request $request, Response $response){
$app->post('/insertKeyword', function(Request $request, Response $response){
@ -171,7 +171,7 @@ $app->post('/insertKeyword', function(Request $request, Response $response){
throw new PDOError($request,$e->getMessage(),$e);
throw new PDOError($request,$e->getMessage(),$e);
}
}
$response->getBody()->write("OK");
$response->getBody()->write("OK");
return $response;
return $response->withStatus(200) ;
});
});
$app->delete('/deleteKeyword', function(Request $request, Response $response){
$app->delete('/deleteKeyword', function(Request $request, Response $response){
@ -185,7 +185,7 @@ $app->delete('/deleteKeyword', function(Request $request, Response $response){
throw new PDOError($request,$e->getMessage(),$e);
throw new PDOError($request,$e->getMessage(),$e);
}
}
$response->getBody()->write("OK");
$response->getBody()->write("OK");
return $response;
return $response->withStatus(200) ;
});
});
$app->get('getAllKeyword', function(Request $request, Response $response){
$app->get('getAllKeyword', function(Request $request, Response $response){
@ -244,7 +244,7 @@ $app->delete('/deleteListResponseOfCandidate', function(Request $request, Respon
throw new PDOError($request,$e->getMessage(),$e);
throw new PDOError($request,$e->getMessage(),$e);
}
}
$response->getBody()->write("OK");
$response->getBody()->write("OK");
return $response;
return $response->withStatus(200) ;
});
});
$app->post('/insertListResponseOfCandidate', function(Request $request, Response $response){
$app->post('/insertListResponseOfCandidate', function(Request $request, Response $response){
@ -258,7 +258,7 @@ $app->post('/insertListResponseOfCandidate', function(Request $request, Response
throw new PDOError($request,$e->getMessage(),$e);
throw new PDOError($request,$e->getMessage(),$e);
}
}
$response->getBody()->write("OK");
$response->getBody()->write("OK");
return $response;
return $response->withStatus(200) ;
});
});
$app->get('/getPossibleResponseByQuestion', function(Request $request, Response $response){
$app->get('/getPossibleResponseByQuestion', function(Request $request, Response $response){
@ -324,7 +324,7 @@ $app->delete('/deleteResponseById', function(Request $request, Response $respons
throw new PDOError($request,$e->getMessage(),$e);
throw new PDOError($request,$e->getMessage(),$e);
}
}
$response->getBody()->write("OK");
$response->getBody()->write("OK");
return $response;
return $response->withStatus(200) ;
});
});
$app->post('/insertResponse', function(Request $request, Response $response){
$app->post('/insertResponse', function(Request $request, Response $response){
@ -355,16 +355,16 @@ $app->post('/addQuestion', function(Request $request, Response $response){
$app->delete('/deleteQuestion', function(Request $request, Response $response){
$app->delete('/deleteQuestion', function(Request $request, Response $response){
$parameters = $request->getQueryParams();
$parameters = $request->getQueryParams();
if (empty($parameters['classQuestion']) || empty($parameters['id']) || empty($parameters['listPossibleResponse']) ){
if (empty($parameters['classQuestion']) || empty($parameters['id'])){
throw new TypeErrorParameters($request);
throw new TypeErrorParameters($request);
}
}
try{
try{
(new GatewayQuestion)->deleteQuestion($parameters['classQuestion'],$parameters['id'], json_decode($parameters['listPossibleResponse']) );
(new GatewayQuestion)->deleteQuestion($parameters['classQuestion'],$parameters['id']);
}catch (PDOException $e){
}catch (PDOException $e){
throw new PDOError($request,$e->getMessage(),$e);
throw new PDOError($request,$e->getMessage(),$e);
}
}
$response->getBody()->write("OK");
$response->getBody()->write("OK");
return $response;
return $response->withStatus(200) ;
});
});
$app->put('/updateQuestion', function(Request $request, Response $response){
$app->put('/updateQuestion', function(Request $request, Response $response){
@ -378,7 +378,7 @@ $app->put('/updateQuestion', function(Request $request, Response $response){
throw new PDOError($request,$e->getMessage(),$e);
throw new PDOError($request,$e->getMessage(),$e);
}
}
$response->getBody()->write("OK");
$response->getBody()->write("OK");
return $response;
return $response->withStatus(200) ;
});
});
$app->get('/getAllQuestions', function(Request $request, Response $response){
$app->get('/getAllQuestions', function(Request $request, Response $response){
@ -444,7 +444,7 @@ $app->delete('/deletePossibleResponse', function(Request $request, Response $res
throw new PDOError($request,$e->getMessage(),$e);
throw new PDOError($request,$e->getMessage(),$e);
}
}
$response->getBody()->write("OK");
$response->getBody()->write("OK");
return $response;
return $response->withStatus(200) ;
});
});
$app->post('/insertResponseInQuestion', function(Request $request, Response $response){
$app->post('/insertResponseInQuestion', function(Request $request, Response $response){
@ -458,7 +458,7 @@ $app->post('/insertResponseInQuestion', function(Request $request, Response $res
throw new PDOError($request,$e->getMessage(),$e);
throw new PDOError($request,$e->getMessage(),$e);
}
}
$response->getBody()->write("OK");
$response->getBody()->write("OK");
return $response;
return $response->withStatus(200) ;
});
});
$app->get('/getCategorizeOfResponsesIdByIdListCandidate', function(Request $request, Response $response){
$app->get('/getCategorizeOfResponsesIdByIdListCandidate', function(Request $request, Response $response){