aboutsummaryrefslogtreecommitdiff
path: root/src/guff/api
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2016-04-02 01:09:45 -0400
committerPaul Duncan <pabs@pablotron.org>2016-04-02 01:09:45 -0400
commit23ba337de24e88c6aaf6ceb37507997f5c5f4920 (patch)
treef5a6fc8d925dafd62ee45973b4e357234ea9ec9a /src/guff/api
parent7788012457346ae59fa58ed35fc08aa2b9e6b9ef (diff)
downloadold-guff-23ba337de24e88c6aaf6ceb37507997f5c5f4920.tar.bz2
old-guff-23ba337de24e88c6aaf6ceb37507997f5c5f4920.zip
fully working edit dialog
Diffstat (limited to 'src/guff/api')
-rw-r--r--src/guff/api/methods.cr42
-rw-r--r--src/guff/api/test.cr10
2 files changed, 48 insertions, 4 deletions
diff --git a/src/guff/api/methods.cr b/src/guff/api/methods.cr
index fce6911..9b8aa3b 100644
--- a/src/guff/api/methods.cr
+++ b/src/guff/api/methods.cr
@@ -403,6 +403,48 @@ module Guff
},
},
+ "edit_user": {
+ text: "Test edit user",
+
+ args: {
+ "user_id": {
+ text: "User ID",
+ type: :int,
+ required: true,
+ },
+
+ "name": {
+ text: "Name of user",
+ type: :text,
+ required: false,
+ },
+
+ "active": {
+ text: "Is this user active?",
+ type: :bool,
+ required: false,
+ },
+
+ "role": {
+ text: "Role of user",
+ type: :text,
+ required: false,
+ },
+
+ "email": {
+ text: "Email address of user",
+ type: :text,
+ required: false,
+ },
+
+ "password": {
+ text: "Password of user",
+ type: :text,
+ required: false,
+ },
+ },
+ },
+
"login": {
text: "Test user login.",
diff --git a/src/guff/api/test.cr b/src/guff/api/test.cr
index decc5ec..91a729c 100644
--- a/src/guff/api/test.cr
+++ b/src/guff/api/test.cr
@@ -65,14 +65,16 @@ module Guff::API::TestAPI
{ "ok": true, "user_id": user_id }
end
- private def do_test_update_user(
+ private def do_test_edit_user(
context : HTTP::Server::Context,
args : Hash(String, String)
)
- @models.user.update_user(args["user_id"].to_i64,
- name: args["name"]? ? args["name"] : nil,
+ @models.user.edit_user(args["user_id"].to_i64,
+ name: args["name"]?,
active: args["active"]? ? args["active"] == "t" : nil,
- role: args["role"]? ? args["role"] : nil
+ role: args["role"]?,
+ email: args["email"]?,
+ password: args["password"]?,
)
{ "ok": true }