Change models, new migrations, fix front and make tests work
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
19
lib/eventos_web/views/track_view.ex
Normal file
19
lib/eventos_web/views/track_view.ex
Normal file
@@ -0,0 +1,19 @@
|
||||
defmodule EventosWeb.TrackView do
|
||||
use EventosWeb, :view
|
||||
alias EventosWeb.TrackView
|
||||
|
||||
def render("index.json", %{tracks: tracks}) do
|
||||
%{data: render_many(tracks, TrackView, "track.json")}
|
||||
end
|
||||
|
||||
def render("show.json", %{track: track}) do
|
||||
%{data: render_one(track, TrackView, "track.json")}
|
||||
end
|
||||
|
||||
def render("track.json", %{track: track}) do
|
||||
%{id: track.id,
|
||||
name: track.name,
|
||||
description: track.description,
|
||||
color: track.color}
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user