Fakultas Ilmu Komputer UI

Commit ae1b69c2 authored by Muhammad Rafif Elfazri's avatar Muhammad Rafif Elfazri
Browse files

Merge branch 'master' of...

Merge branch 'master' of https://gitlab.cs.ui.ac.id/functional-programming/diskuy-backend into deploy-runtime
parents f9a828d9 450ebd87
......@@ -18,13 +18,13 @@ defmodule Diskuy.ForumPostPage do
Post
|> join(:inner, [p], u in User, as: :users, on: p.user_id == u.id)
|> join(:left, [p], tr in Thread, as: :threads, on: p.thread_id == tr.id)
|> select([p, u], %{id: p.id, message: p.message,
|> select([p, u], %{post: %{id: p.id, message: p.message,
points: p.points,
user_id: p.user_id, thread_id: p.thread_id,
parent_id: p.parent_id,
username: u.username, inserted_at: p.inserted_at,
updated_at: p.updated_at
}
}}
)
end
end
......@@ -6,7 +6,7 @@ defmodule DiskuyWeb.PostPagesController do
# Pages Per threads
def pages_thread(conn, %{"thread_id" => thread_id}) do
query = ForumPostPage.page_per_thread(thread_id) |> Repo.paginate()
query = ForumPostPage.page_per_thread(thread_id)
paginate_and_render(conn, query)
end
......
......@@ -17,12 +17,14 @@ defmodule DiskuyWeb.Router do
scope "/api", DiskuyWeb do
pipe_through [:api, :auth]
get "/current", UserController, :currentuser
options "/current", UserController, :options
resources "/threads", ThreadController, except: [:new, :edit, :show, :index]
resources "/topics", TopicController, except: [:new, :edit, :show, :index]
resources "/post", PostController, except: [:new, :edit, :show, :index]
put "/users/update", UserController, :update
get "/users/update", UserController, :options
options "/users/update", UserController, :options
post "/threads/like/:id", ThreadController, :add_like
options "/threads/like/:id", ThreadController, :options
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment