mobilizon.chapril.org-mobil.../lib/eventos_web/views/account_view.ex
Thomas Citharel 1217361b6c fix some code style and add checks to ci
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2018-01-14 17:57:25 +01:00

43 lines
1.1 KiB
Elixir

defmodule EventosWeb.AccountView do
@moduledoc """
View for Accounts
"""
use EventosWeb, :view
alias EventosWeb.AccountView
def render("index.json", %{accounts: accounts}) do
%{data: render_many(accounts, AccountView, "account_for_user.json")}
end
def render("show.json", %{account: account}) do
%{data: render_one(account, AccountView, "account.json")}
end
def render("account_for_user.json", %{account: account}) do
%{id: account.id,
username: account.username,
domain: account.domain,
display_name: account.display_name,
description: account.description,
public_key: account.public_key,
suspended: account.suspended,
uri: account.uri,
url: account.url,
}
end
def render("account.json", %{account: account}) do
%{id: account.id,
username: account.username,
domain: account.domain,
display_name: account.display_name,
description: account.description,
public_key: account.public_key,
suspended: account.suspended,
uri: account.uri,
url: account.url,
organized_events: account.organized_events
}
end
end