20cd1bb579
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
21 lines
516 B
Elixir
21 lines
516 B
Elixir
defmodule EventosWeb.EventView do
|
|
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
|