From 61927232aeeea277344262aa5c92cd9fbedce854 Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Thu, 11 Sep 2014 18:28:17 +0200 Subject: Improve API calls for categories --- jsonrpc.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'jsonrpc.php') diff --git a/jsonrpc.php b/jsonrpc.php index 7c885334..0a6913d6 100644 --- a/jsonrpc.php +++ b/jsonrpc.php @@ -251,7 +251,13 @@ $server->register('removeUser', function($user_id) use ($user) { /** * Category procedures */ -$server->register('createCategory', function(array $values) use ($category) { +$server->register('createCategory', function($project_id, $name) use ($category) { + + $values = array( + 'project_id' => $project_id, + 'name' => $name, + ); + list($valid,) = $category->validateCreation($values); return $valid && $category->create($values); }); @@ -264,7 +270,13 @@ $server->register('getAllCategories', function($project_id) use ($category) { return $category->getAll($project_id); }); -$server->register('updateCategory', function($values) use ($category) { +$server->register('updateCategory', function($id, $name) use ($category) { + + $values = array( + 'id' => $id, + 'name' => $name, + ); + list($valid,) = $category->validateModification($values); return $valid && $category->update($values); }); -- cgit v1.2.3