After "mix phx.gen.json BiddingRounds BiddingRound bidding_rounds round_number:integer running:boolean --no-scope".

This commit is contained in:
2026-02-11 10:57:27 +01:00
parent 5f966d485a
commit 14f04befd0
11 changed files with 429 additions and 3 deletions

View File

@ -0,0 +1,25 @@
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