summaryrefslogtreecommitdiff
path: root/jsonrpc.php
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-09-11 18:28:17 +0200
committerFrédéric Guillot <fred@kanboard.net>2014-09-11 18:28:17 +0200
commit61927232aeeea277344262aa5c92cd9fbedce854 (patch)
treea79bc0e22281535d0b95390407a1402c742b56c9 /jsonrpc.php
parentd9850ae66ac7c6545633b3cfa0fe1b811b27bc41 (diff)
Improve API calls for categories
Diffstat (limited to 'jsonrpc.php')
-rw-r--r--jsonrpc.php16
1 files changed, 14 insertions, 2 deletions
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);
});