2017-12-08 09:58:14 +01:00
|
|
|
defmodule EventosWeb.AccountView do
|
|
|
|
use EventosWeb, :view
|
2018-01-13 23:33:03 +01:00
|
|
|
alias EventosWeb.AccountView
|
2018-01-09 17:52:26 +01:00
|
|
|
|
2018-01-13 23:33:03 +01:00
|
|
|
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,
|
2018-01-09 17:52:26 +01:00
|
|
|
username: account.username,
|
2018-01-13 23:33:03 +01:00
|
|
|
domain: account.domain,
|
2018-01-09 17:52:26 +01:00
|
|
|
display_name: account.display_name,
|
2018-01-13 23:33:03 +01:00
|
|
|
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,
|
2018-01-09 17:52:26 +01:00
|
|
|
domain: account.domain,
|
2018-01-13 23:33:03 +01:00
|
|
|
display_name: account.display_name,
|
|
|
|
description: account.description,
|
|
|
|
public_key: account.public_key,
|
2018-01-09 17:52:26 +01:00
|
|
|
suspended: account.suspended,
|
|
|
|
uri: account.uri,
|
|
|
|
url: account.url,
|
2018-01-13 23:33:03 +01:00
|
|
|
organized_events: account.organized_events
|
2018-01-09 17:52:26 +01:00
|
|
|
}
|
|
|
|
end
|
2017-12-08 09:58:14 +01:00
|
|
|
end
|