philomena/lib/philomena_web/forum_json.ex

22 lines
437 B
Elixir
Raw Normal View History

defmodule PhilomenaWeb.ForumJson do
def as_json(%{access_level: "normal"} = forum) do
%{
name: forum.name,
short_name: forum.short_name,
description: forum.description,
topic_count: forum.topic_count,
post_count: forum.post_count
}
end
2020-01-11 05:20:19 +01:00
def as_json(_forum) do
%{
name: nil,
short_name: nil,
description: nil,
topic_count: nil,
post_count: nil
}
end
end