After "mix phx.gen.json BiddingRounds BiddingRound bidding_rounds round_number:integer running:boolean --no-scope".
This commit is contained in:
25
lib/beet_round_server_web/controllers/bidding_round_json.ex
Normal file
25
lib/beet_round_server_web/controllers/bidding_round_json.ex
Normal 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
|
||||
Reference in New Issue
Block a user