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

@ -66,6 +66,26 @@ defmodule BeetRoundServer.Biddings do
Repo.get_by!(Bidding, id: id, user_id: scope.user.id)
end
def biddings_of_round(round_number) do
Repo.all(
from(bidding in Bidding,
where: bidding.bidding_round == ^round_number,
order_by: [asc: bidding.inserted_at]
)
)
end
def get_most_recent_bidding(%Scope{} = scope) do
query =
Ecto.Query.from(bidding in Bidding,
where: bidding.user_id == ^scope.user.id,
order_by: [desc: bidding.inserted_at],
limit: 1
)
Repo.one(query)
end
@doc """
Creates a bidding.