Commit f817dc2f authored by Guillaume Wauquier's avatar Guillaume Wauquier
Browse files

Route ouverte pour l'ajout et la modification d'une categorie

parent 4ec2b924
......@@ -54,3 +54,50 @@ $app->GET('/api/category/{id}', function($request, $response, $args) {
});
/**
* PUT categoryCreateupdate
* Summary:
* Notes: create or modify a category
* Output-Formats: [application/json]
* @SWG\Put(
* path="/api/category",
* tags={"category"},
* operationId="updateCategory",
* summary="Update an existing category",
* description="",
* consumes={"application/json", "application/xml"},
* produces={"application/xml", "application/json"},
* @SWG\Parameter(
* name="body",
* in="body",
* description="category object that needs to be added",
* required=true,
* @SWG\Schema(ref="#/definitions/Category"),
* ),
* @SWG\Response(
* response=400,
* description="Invalid ID supplied",
* ),
* @SWG\Response(
* response=404,
* description="Category not found",
* ),
* @SWG\Response(
* response=405,
* description="Validation exception",
* ),
* security={{"pasteque_auth":{"write:categories", "read:categories"}}}
* )
*/
$app->PUT('/api/category', function($request, $response, $args) {
$ptApp = $this->get('settings')['ptApp'];
$tab = $request->getParsedBody();
$category = \Pasteque\Server\Model\Category::fromStruct($tab,$ptApp->getDao());
$ptApp->getLogger()->err($category->getDispOrder());
return $response->withApiResult(APICaller::run($ptApp, 'category', 'write', $category));
});
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment