server/lib/boardwise_web/controllers/language_json.ex

18 lines
313 B
Elixir
Raw Normal View History

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