2018-05-17 11:32:23 +02:00
|
|
|
defmodule EventosWeb.CommentView do
|
|
|
|
use EventosWeb, :view
|
|
|
|
alias EventosWeb.CommentView
|
|
|
|
|
|
|
|
def render("index.json", %{comments: comments}) do
|
|
|
|
%{data: render_many(comments, CommentView, "comment.json")}
|
|
|
|
end
|
|
|
|
|
|
|
|
def render("show.json", %{comment: comment}) do
|
|
|
|
%{data: render_one(comment, CommentView, "comment.json")}
|
|
|
|
end
|
|
|
|
|
|
|
|
def render("comment.json", %{comment: comment}) do
|
|
|
|
%{id: comment.id,
|
2018-06-14 17:25:55 +02:00
|
|
|
uuid: comment.uuid,
|
2018-05-17 11:32:23 +02:00
|
|
|
url: comment.url,
|
2018-06-14 17:25:55 +02:00
|
|
|
text: comment.text
|
|
|
|
}
|
2018-05-17 11:32:23 +02:00
|
|
|
end
|
|
|
|
end
|