server/lib/boardwise_web/controllers/language_json.ex

18 lines
313 B
Elixir
Raw Normal View History

2023-12-05 22:15:59 +00:00
defmodule BoardWiseWeb.LanguageJSON do
alias BoardWise.Languages.Language
@doc """
Renders a list of coaches.
"""
def index(%{langs: langs}) do
%{data: for(lang <- langs, do: data(lang))}
end
defp data(%Language{} = lang) do
%{
code: lang.code,
name: lang.name
}
end
end