After "mix phx.gen.json BiddingRounds BiddingRound bidding_rounds round_number:integer running:boolean --no-scope".
This commit is contained in:
20
lib/beet_round_server/bidding_rounds/bidding_round.ex
Normal file
20
lib/beet_round_server/bidding_rounds/bidding_round.ex
Normal file
@ -0,0 +1,20 @@
|
||||
defmodule BeetRoundServer.BiddingRounds.BiddingRound do
|
||||
use Ecto.Schema
|
||||
import Ecto.Changeset
|
||||
|
||||
@primary_key {:id, :binary_id, autogenerate: true}
|
||||
@foreign_key_type :binary_id
|
||||
schema "bidding_rounds" do
|
||||
field :round_number, :integer
|
||||
field :running, :boolean, default: false
|
||||
|
||||
timestamps(type: :utc_datetime)
|
||||
end
|
||||
|
||||
@doc false
|
||||
def changeset(bidding_round, attrs) do
|
||||
bidding_round
|
||||
|> cast(attrs, [:round_number, :running])
|
||||
|> validate_required([:round_number, :running])
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user