mobilizon.chapril.org-mobil.../lib/eventos_web/views/event_view.ex
Thomas Citharel 1217361b6c fix some code style and add checks to ci
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2018-01-14 17:57:25 +01:00

24 lines
557 B
Elixir

defmodule EventosWeb.EventView do
@moduledoc """
View for Events
"""
use EventosWeb, :view
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
end