debianize-mobilizon/lib/eventos_web/views/account_view.ex
Thomas Citharel f1cb601b46
WIP
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2018-06-06 18:14:04 +02:00

45 lines
1.2 KiB
Elixir

defmodule EventosWeb.ActorView do
@moduledoc """
View for Actors
"""
use EventosWeb, :view
alias EventosWeb.{ActorView, EventView}
def render("index.json", %{actors: actors}) do
%{data: render_many(actors, ActorView, "acccount_basic.json")}
end
def render("show.json", %{actor: actor}) do
%{data: render_one(actor, ActorView, "actor.json")}
end
def render("show_basic.json", %{actor: actor}) do
%{data: render_one(actor, ActorView, "actor_basic.json")}
end
def render("acccount_basic.json", %{actor: actor}) do
%{id: actor.id,
username: actor.username,
domain: actor.domain,
display_name: actor.display_name,
description: actor.description,
# public_key: actor.public_key,
suspended: actor.suspended,
url: actor.url,
}
end
def render("actor.json", %{actor: actor}) do
%{id: actor.id,
username: actor.username,
domain: actor.domain,
display_name: actor.display_name,
description: actor.description,
# public_key: actor.public_key,
suspended: actor.suspended,
url: actor.url,
organized_events: render_many(actor.organized_events, EventView, "event_simple.json")
}
end
end