aboutsummaryrefslogtreecommitdiff
path: root/web/views/audio_file_api_view.ex
blob: 1042be00a5f48dad095f7c6b97f8b0ec7c6c1559 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
defmodule TheTranscriberBackend.AudioFileAPIView do
  use TheTranscriberBackend.Web, :view



  def render("index.json", %{audio_file_api: audio_file_api}) do
    %{data: render_many(audio_file_api, TheTranscriberBackend.AudioFileAPIView, "audio_file_api.json")}
  end

  def render("show.json", %{audio_file_api: audio_file_api}) do
    %{data: render_one(audio_file_api, TheTranscriberBackend.AudioFileAPIView, "audio_file_api.json")}
  end

  def render("audio_file_api.json", %{audio_file_api: audio_file_api}) do
    %{id: audio_file_api.id,
      audio_path: audio_file_api.audio_path,
      audio_name: audio_file_api.audio_name,
      audio_duration: audio_file_api.audio_duration}
  end
end