aboutsummaryrefslogtreecommitdiff
path: root/src/guff/api
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2016-04-01 00:02:30 -0400
committerPaul Duncan <pabs@pablotron.org>2016-04-01 00:02:30 -0400
commit094cbeedb81afde03d8f30f8928f98c13f1aa00a (patch)
tree31195843a8d38c172f8539df062a442b43f38cca /src/guff/api
parentec78a9b0fed0d54d6cc6695f80484e34286921ab (diff)
downloadold-guff-094cbeedb81afde03d8f30f8928f98c13f1aa00a.tar.bz2
old-guff-094cbeedb81afde03d8f30f8928f98c13f1aa00a.zip
add user methods
Diffstat (limited to 'src/guff/api')
-rw-r--r--src/guff/api/test.cr41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/guff/api/test.cr b/src/guff/api/test.cr
index 79d2d2e..71d614a 100644
--- a/src/guff/api/test.cr
+++ b/src/guff/api/test.cr
@@ -76,6 +76,47 @@ module Guff
)
raise "some random error"
end
+
+ private def do_test_add_user(
+ context : HTTP::Server::Context,
+ args : Hash(String, String)
+ )
+ user_id = @models.user.add_user(args["name"])
+ { "ok": true, "user_id": user_id }
+ end
+
+ private def do_test_update_user(
+ context : HTTP::Server::Context,
+ args : Hash(String, String)
+ )
+ @models.user.update_user(args["user_id"].to_i,
+ name: args["name"]? ? args["name"] : nil,
+ active: args["active"]? ? args["active"] == "t" : nil,
+ role: args["role"]? ? args["role"] : nil
+ )
+
+ { "ok": true }
+ end
+
+ private def do_test_add_login(
+ context : HTTP::Server::Context,
+ args : Hash(String, String)
+ )
+ @models.user.add_login(args["user_id"].to_i,
+ email: args["name"],
+ password: args["password"],
+ )
+
+ { "ok": true }
+ end
+
+ private def do_test_remove_login(
+ context : HTTP::Server::Context,
+ args : Hash(String, String)
+ )
+ @models.user.remove_login(args["user_id"].to_i)
+ { "ok": true }
+ end
end
end
end