2017-12-08 09:58:14 +01:00
|
|
|
defmodule EventosWeb.EventView do
|
2018-01-14 17:56:50 +01:00
|
|
|
@moduledoc """
|
|
|
|
View for Events
|
|
|
|
"""
|
2017-12-08 09:58:14 +01:00
|
|
|
use EventosWeb, :view
|
2018-01-13 23:33:03 +01:00
|
|
|
alias EventosWeb.EventView
|
|
|
|
|
|
|
|
def render("index.json", %{events: events}) do
|
|
|
|
%{data: render_many(events, EventView, "event.json")}
|
|
|
|
end
|
|
|
|
|
|
|
|
def render("show.json", %{event: event}) do
|
|
|
|
%{data: render_one(event, EventView, "event.json")}
|
|
|
|
end
|
|
|
|
|
|
|
|
def render("event.json", %{event: event}) do
|
|
|
|
%{id: event.id,
|
|
|
|
title: event.title,
|
|
|
|
description: event.description,
|
|
|
|
begins_on: event.begins_on,
|
|
|
|
ends_on: event.ends_on}
|
|
|
|
end
|
2017-12-08 09:58:14 +01:00
|
|
|
end
|