diff options
Diffstat (limited to 'web/views/audio_file_api_view.ex')
-rw-r--r-- | web/views/audio_file_api_view.ex | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/web/views/audio_file_api_view.ex b/web/views/audio_file_api_view.ex new file mode 100644 index 0000000..f5dbba9 --- /dev/null +++ b/web/views/audio_file_api_view.ex @@ -0,0 +1,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_transcription_file_path: audio_file_api.transcription_file_path, + audio_duration: audio_file_api.audio_duration} + end +end |