API can serve bidding_of_highest_round and biddings_of_round/:round_number route.

This commit is contained in:
2026-02-13 21:01:07 +01:00
parent ebdb919245
commit 1c02f28d25
3 changed files with 38 additions and 1 deletions

View File

@ -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