API can serve bidding_of_highest_round and biddings_of_round/:round_number route.
This commit is contained in:
@ -2,6 +2,7 @@ defmodule BeetRoundServerWeb.BiddingController do
|
||||
use BeetRoundServerWeb, :controller
|
||||
|
||||
alias BeetRoundServer.Biddings
|
||||
alias BeetRoundServer.BiddingRounds.BiddingRoundFacade
|
||||
# alias BeetRoundServer.Biddings.Bidding
|
||||
|
||||
action_fallback BeetRoundServerWeb.FallbackController
|
||||
@ -13,6 +14,19 @@ defmodule BeetRoundServerWeb.BiddingController do
|
||||
render(conn, :index, biddings: biddings)
|
||||
end
|
||||
|
||||
def biddings_of_round(conn, %{"round_number" => round_number}) do
|
||||
biddings = Biddings.biddings_of_round(round_number)
|
||||
render(conn, :index, biddings: biddings)
|
||||
end
|
||||
|
||||
def biddings_of_highest_round(conn, _params) do
|
||||
round = BiddingRoundFacade.get_highest_bidding_round()
|
||||
IO.puts("Highest round number:")
|
||||
IO.puts(round.round_number)
|
||||
biddings = Biddings.biddings_of_round(round.round_number)
|
||||
render(conn, :index, biddings: biddings)
|
||||
end
|
||||
|
||||
# def create(conn, %{"bidding" => bidding_params}) do
|
||||
# with {:ok, %Bidding{} = bidding} <- Biddings.create_bidding(bidding_params) do
|
||||
# conn
|
||||
|
||||
Reference in New Issue
Block a user