mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-01-31 19:36:44 +01:00
Adjusted to suit standard (#58)
This commit is contained in:
parent
43b5e069e6
commit
44a20a7888
3 changed files with 9 additions and 4 deletions
|
@ -52,7 +52,6 @@ defmodule PhilomenaWeb.Api.Json.Forum.Topic.PostController do
|
|||
_ ->
|
||||
json(conn, %{
|
||||
posts: Enum.map(posts, &PostJson.as_json/1),
|
||||
page: page,
|
||||
total: hd(posts).topic.post_count
|
||||
})
|
||||
end
|
||||
|
|
|
@ -38,6 +38,9 @@ defmodule PhilomenaWeb.Api.Json.Forum.TopicController do
|
|||
|> preload([:user])
|
||||
|> 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
|
||||
|
|
|
@ -29,8 +29,11 @@ defmodule PhilomenaWeb.Api.Json.ForumController do
|
|||
Forum
|
||||
|> where(access_level: "normal")
|
||||
|> 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
|
||||
|
|
Loading…
Reference in a new issue