Adjusted to suit standard (#58)

This commit is contained in:
SomewhatDamaged 2020-03-27 16:07:24 +11:00 committed by GitHub
parent 43b5e069e6
commit 44a20a7888
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 4 deletions

View file

@ -52,7 +52,6 @@ defmodule PhilomenaWeb.Api.Json.Forum.Topic.PostController do
_ -> _ ->
json(conn, %{ json(conn, %{
posts: Enum.map(posts, &PostJson.as_json/1), posts: Enum.map(posts, &PostJson.as_json/1),
page: page,
total: hd(posts).topic.post_count total: hd(posts).topic.post_count
}) })
end end

View file

@ -38,6 +38,9 @@ defmodule PhilomenaWeb.Api.Json.Forum.TopicController do
|> preload([:user]) |> preload([:user])
|> Repo.paginate(conn.assigns.scrivener) |> Repo.paginate(conn.assigns.scrivener)
json(conn, %{topic: Enum.map(topics, &TopicJson.as_json/1)}) json(conn, %{
topic: Enum.map(topics, &TopicJson.as_json/1),
total: topics.total_entries
})
end end
end end

View file

@ -29,8 +29,11 @@ defmodule PhilomenaWeb.Api.Json.ForumController do
Forum Forum
|> where(access_level: "normal") |> where(access_level: "normal")
|> order_by(asc: :name) |> order_by(asc: :name)
|> Repo.all() |> Repo.paginate(conn.assigns.scrivener)
json(conn, %{forums: Enum.map(forums, &ForumJson.as_json/1)}) json(conn, %{
forums: Enum.map(forums, &ForumJson.as_json/1),
total: forums.total_entries
})
end end
end end