From 3bd3f433aee7ccfaafea892c1cfa05b7a2bfdb1f Mon Sep 17 00:00:00 2001 From: Damien <damien.burel@maarch.org> Date: Thu, 8 Oct 2020 10:14:54 +0200 Subject: [PATCH] FEAT #13271 TIME 0:10 Get departments --- rest/index.php | 3 +++ src/app/resource/controllers/DepartmentController.php | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/rest/index.php b/rest/index.php index 1c2ea1bc882..c923adf70db 100755 --- a/rest/index.php +++ b/rest/index.php @@ -188,6 +188,9 @@ $app->put('/customFields/{id}', \CustomField\controllers\CustomFieldController:: $app->delete('/customFields/{id}', \CustomField\controllers\CustomFieldController::class . ':delete'); $app->get('/customFieldsWhiteList', \CustomField\controllers\CustomFieldController::class . ':getWhiteList'); +//Departments +$app->get('/departments', \Resource\controllers\DepartmentController::class . ':getFrenchDepartments'); + //Docservers $app->get('/docservers', \Docserver\controllers\DocserverController::class . ':get'); $app->post('/docservers', \Docserver\controllers\DocserverController::class . ':create'); diff --git a/src/app/resource/controllers/DepartmentController.php b/src/app/resource/controllers/DepartmentController.php index e09c0d020a9..d2b0f9ee269 100644 --- a/src/app/resource/controllers/DepartmentController.php +++ b/src/app/resource/controllers/DepartmentController.php @@ -15,6 +15,8 @@ namespace Resource\controllers; +use Slim\Http\Request; +use Slim\Http\Response; use SrcCore\models\ValidatorModel; class DepartmentController @@ -123,6 +125,11 @@ class DepartmentController "976" => "Mayotte" ]; + public function getFrenchDepartments(Request $request, Response $response) + { + return $response->withJson(['departments' => self::FRENCH_DEPARTMENTS]); + } + public static function getById(array $aArgs) { ValidatorModel::notEmpty($aArgs, ['id']); -- GitLab