2018-01-13 23:33:03 +01:00
|
|
|
defmodule EventosWeb.RequestView do
|
2018-01-14 17:56:50 +01:00
|
|
|
@moduledoc """
|
|
|
|
View for event request
|
|
|
|
"""
|
2018-01-13 23:33:03 +01:00
|
|
|
use EventosWeb, :view
|
|
|
|
alias EventosWeb.RequestView
|
|
|
|
|
|
|
|
def render("index.json", %{requests: requests}) do
|
|
|
|
%{data: render_many(requests, RequestView, "request.json")}
|
|
|
|
end
|
|
|
|
|
|
|
|
def render("show.json", %{request: request}) do
|
|
|
|
%{data: render_one(request, RequestView, "request.json")}
|
|
|
|
end
|
|
|
|
|
|
|
|
def render("request.json", %{request: request}) do
|
|
|
|
%{id: request.id,
|
|
|
|
state: request.state}
|
|
|
|
end
|
|
|
|
end
|