mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-02-01 03:46: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, %{
|
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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue