mobilizon.chapril.org-mobil.../lib/eventos_web/views/account_view.ex

45 lines
1.2 KiB
Elixir
Raw Normal View History

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