2018-01-13 23:33:03 +01:00
|
|
|
defmodule EventosWeb.MemberView do
|
2018-01-14 17:56:50 +01:00
|
|
|
@moduledoc """
|
|
|
|
View for Members
|
|
|
|
"""
|
2018-01-13 23:33:03 +01:00
|
|
|
use EventosWeb, :view
|
2018-06-06 17:42:53 +02:00
|
|
|
alias EventosWeb.{MemberView, ActorView}
|
2018-01-13 23:33:03 +01:00
|
|
|
|
|
|
|
def render("index.json", %{members: members}) do
|
|
|
|
%{data: render_many(members, MemberView, "member.json")}
|
|
|
|
end
|
|
|
|
|
|
|
|
def render("show.json", %{member: member}) do
|
|
|
|
%{data: render_one(member, MemberView, "member.json")}
|
|
|
|
end
|
|
|
|
|
|
|
|
def render("member.json", %{member: member}) do
|
2018-06-06 17:42:53 +02:00
|
|
|
%{
|
|
|
|
role: member.role,
|
|
|
|
actor: render_one(member.actor, ActorView, "acccount_basic.json"),
|
|
|
|
group: render_one(member.parent, ActorView, "acccount_basic.json")
|
|
|
|
}
|
2018-01-13 23:33:03 +01:00
|
|
|
end
|
|
|
|
end
|