aboutsummaryrefslogtreecommitdiff
path: root/src/guff
diff options
context:
space:
mode:
Diffstat (limited to 'src/guff')
-rw-r--r--src/guff/api-handler.cr2
-rw-r--r--src/guff/api/post.cr12
2 files changed, 7 insertions, 7 deletions
diff --git a/src/guff/api-handler.cr b/src/guff/api-handler.cr
index 4d4a996..274e137 100644
--- a/src/guff/api-handler.cr
+++ b/src/guff/api-handler.cr
@@ -13,7 +13,7 @@ private macro define_method_calls(hash)
context.request.query_params,
"{{ namespace.id }}",
"{{ method.id }}"
- ))
+ )).to_json
{% end %}
else
raise "unknown method"
diff --git a/src/guff/api/post.cr b/src/guff/api/post.cr
index 0bc6377..7141530 100644
--- a/src/guff/api/post.cr
+++ b/src/guff/api/post.cr
@@ -12,7 +12,7 @@ module Guff
q: args["q"]? || "",
tags: get_posts_tags(args["tags"]),
page: args.has_key?("page") ? args["page"].to_i : 1,
- ).to_json
+ )
end
private def do_post_add_post(
@@ -28,7 +28,7 @@ module Guff
)
# return json
- { post_id: post_id }.to_json
+ { post_id: post_id }
end
private def do_post_update_post(
@@ -42,11 +42,11 @@ module Guff
name: args["name"],
body: args["body"],
tags: args.has_key?("tags") ? get_tags(args["tags"]?) : nil,
- posted: args["posted"]?,
+ posted: args.has_key?("posted") ? (args["posted"] == "t") : nil,
)
# return json
- { ok: true }.to_json
+ { ok: true }
end
private def do_post_remove_posts(
@@ -60,7 +60,7 @@ module Guff
},
)
- { ok: true }.to_json
+ { ok: true }
end
private def do_post_set_tags(
@@ -73,7 +73,7 @@ module Guff
tags: get_tags(args["tags"]?),
)
- { ok: true}.to_json
+ { ok: true}
end
end
end