defmodule BeetRoundServerWeb.BiddingController do use BeetRoundServerWeb, :controller alias BeetRoundServer.Biddings alias BeetRoundServer.BiddingRounds.BiddingRoundFacade # alias BeetRoundServer.Biddings.Bidding action_fallback BeetRoundServerWeb.FallbackController def index(conn, _params) do biddings = Biddings.list_biddings() IO.puts("biddings:") IO.inspect(biddings) 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 # |> put_status(:created) # |> put_resp_header("location", ~p"/api/biddings/#{bidding}") # |> render(:show, bidding: bidding) # end # end # def show(conn, %{"id" => id}) do # bidding = Biddings.get_bidding!(id) # render(conn, :show, bidding: bidding) # end # def update(conn, %{"id" => id, "bidding" => bidding_params}) do # bidding = Biddings.get_bidding!(id) # with {:ok, %Bidding{} = bidding} <- Biddings.update_bidding(bidding, bidding_params) do # render(conn, :show, bidding: bidding) # end # end # def delete(conn, %{"id" => id}) do # bidding = Biddings.get_bidding!(id) # with {:ok, %Bidding{}} <- Biddings.delete_bidding(bidding) do # send_resp(conn, :no_content, "") # end # end end