Files
BeetRoundServer/lib/beet_round_server_web/controllers/bidding_round_json.ex

26 lines
608 B
Elixir

defmodule BeetRoundServerWeb.BiddingRoundJSON do
alias BeetRoundServer.BiddingRounds.BiddingRound
@doc """
Renders a list of bidding_rounds.
"""
def index(%{bidding_rounds: bidding_rounds}) do
%{data: for(bidding_round <- bidding_rounds, do: data(bidding_round))}
end
@doc """
Renders a single bidding_round.
"""
def show(%{bidding_round: bidding_round}) do
%{data: data(bidding_round)}
end
defp data(%BiddingRound{} = bidding_round) do
%{
id: bidding_round.id,
round_number: bidding_round.round_number,
running: bidding_round.running
}
end
end