1
0
mirror of https://github.com/mgerb/classic-wow-forums synced 2026-01-12 01:52:49 +00:00

update thread reply

This commit is contained in:
2018-01-04 21:06:23 -06:00
parent 148bde8f99
commit f540e7351b
7 changed files with 73 additions and 20 deletions

View File

@@ -18,5 +18,21 @@ defmodule MyAppWeb.ReplyController do
|> put_status(status)
|> Response.json(output)
end
@spec update(map, map) :: any
def update(conn, params) do
user_id = conn
|> MyApp.Guardian.Plug.current_claims
|> Map.get("id")
{output, status} = params
|> Map.put("user_id", user_id)
|> Data.Reply.user_update_reply
|> Response.put_resp
conn
|> put_status(status)
|> Response.json(output)
end
end

View File

@@ -27,7 +27,7 @@ defmodule MyAppWeb.ThreadController do
{output, status} = params
|> Map.put("user_id", user_id)
|> Data.Thread.update_thread
|> Data.Thread.user_update_thread
|> Response.put_resp
conn

View File

@@ -46,6 +46,7 @@ defmodule MyAppWeb.Router do
# authenticated routes
pipe_through [:user_auth]
post "/", ReplyController, :insert
put "/", ReplyController, :update
end
scope "/category" do