} elseif ($request->type == "updateTypeIngredient") { updateTypeIngredient($bdd, $request->id, $request->nom); } elseif ($request->type == "deleteTypeIngredient") { deleteTypeIngredient($bdd, $request->id); } elseif ($request->type == "getListRecipes") { $list = getListRecipes($bdd, $request->num_page, $request->type_recette); echo json_encode($list); } elseif ($request->type == "deleteRecipe") { deleteRecipe($bdd, $request->id); } elseif ($request->type == "getListUnits") { $list = getListUnits($bdd); echo json_encode($list); } elseif ($request->type == "addUnit") { addUnit($bdd, $request->nom, $request->type_unite); } elseif ($request->type == "updateUnit") { updateUnit($bdd, $request->id, $request->nom, $request->type_unite); } elseif ($request->type == "deleteUnit") { deleteUnit($bdd, $request->id); } } /** * Récupère la liste des unités * * @param bdd * Base de données * @param type_unite * Type d'unité : * - 1 -> Unité pour les portions * - 2 -> Unité de temps * - 3 -> Unité de poids *
echo json_encode(createUnit($app->request->getBody())); }); /** * @api {PUT} /unit Update a Unit * @apiName updateUnit * @apiGroup Unit * * * @apiSuccess {Unit} Unit Unit * @apiPermission Author of the Unit * @apiDescription Here you can describe the function. * */ $app->put('/unit', function () use($app) { include_once 'libs/unit.php'; updateUnit($app->request->getBody()); }); /** * @api {PUT} /unit/parent Update a Unit's Parent * @apiName updateUnitParent * @apiGroup Unit * * * @apiSuccess {Unit} Unit Unit * @apiPermission Author of the Unit * @apiDescription Here you can describe the function. * */ $app->put('/unit/parent', function () use($app) { include_once 'libs/unit.php'; updateUnitParent($app->request->getBody());