2018-10-11 17:37:39 +02:00
|
|
|
defmodule MobilizonWeb.ParticipantView do
|
2018-01-14 17:56:50 +01:00
|
|
|
@moduledoc """
|
|
|
|
View for Participants
|
|
|
|
"""
|
2018-10-11 17:37:39 +02:00
|
|
|
use MobilizonWeb, :view
|
|
|
|
alias MobilizonWeb.ParticipantView
|
2018-01-13 23:33:03 +01:00
|
|
|
|
|
|
|
def render("index.json", %{participants: participants}) do
|
|
|
|
%{data: render_many(participants, ParticipantView, "participant.json")}
|
|
|
|
end
|
|
|
|
|
|
|
|
def render("show.json", %{participant: participant}) do
|
|
|
|
%{data: render_one(participant, ParticipantView, "participant.json")}
|
|
|
|
end
|
|
|
|
|
|
|
|
def render("participant.json", %{participant: participant}) do
|
2018-07-27 10:45:35 +02:00
|
|
|
%{id: participant.id, role: participant.role}
|
2018-01-13 23:33:03 +01:00
|
|
|
end
|
|
|
|
end
|