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 ...@@ -18,13 +18,13 @@ defmodule Diskuy.ForumPostPage do
Post Post
|> join(:inner, [p], u in User, as: :users, on: p.user_id == u.id) |> 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) |> 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, points: p.points,
user_id: p.user_id, thread_id: p.thread_id, user_id: p.user_id, thread_id: p.thread_id,
parent_id: p.parent_id, parent_id: p.parent_id,
username: u.username, inserted_at: p.inserted_at, username: u.username, inserted_at: p.inserted_at,
updated_at: p.updated_at updated_at: p.updated_at
} }}
) )
end end
end end
...@@ -6,7 +6,7 @@ defmodule DiskuyWeb.PostPagesController do ...@@ -6,7 +6,7 @@ defmodule DiskuyWeb.PostPagesController do
# Pages Per threads # Pages Per threads
def pages_thread(conn, %{"thread_id" => thread_id}) do 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) paginate_and_render(conn, query)
end end
......
...@@ -17,12 +17,14 @@ defmodule DiskuyWeb.Router do ...@@ -17,12 +17,14 @@ defmodule DiskuyWeb.Router do
scope "/api", DiskuyWeb do scope "/api", DiskuyWeb do
pipe_through [:api, :auth] pipe_through [:api, :auth]
get "/current", UserController, :currentuser get "/current", UserController, :currentuser
options "/current", UserController, :options
resources "/threads", ThreadController, except: [:new, :edit, :show, :index] resources "/threads", ThreadController, except: [:new, :edit, :show, :index]
resources "/topics", TopicController, except: [:new, :edit, :show, :index] resources "/topics", TopicController, except: [:new, :edit, :show, :index]
resources "/post", PostController, except: [:new, :edit, :show, :index] resources "/post", PostController, except: [:new, :edit, :show, :index]
put "/users/update", UserController, :update put "/users/update", UserController, :update
get "/users/update", UserController, :options options "/users/update", UserController, :options
post "/threads/like/:id", ThreadController, :add_like post "/threads/like/:id", ThreadController, :add_like
options "/threads/like/:id", ThreadController, :options options "/threads/like/:id", ThreadController, :options
......
Supports Markdown
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