Files
runosaari.net/lib/runosaari/registration/performer.ex
2021-03-27 16:50:43 +02:00

26 lines
669 B
Elixir

defmodule Runosaari.Registration.Performer do
use Ecto.Schema
import Ecto.Changeset
schema "performers" do
field :confirmed, :boolean, default: false
field :email, :string
field :fname, :string
field :lname, :string
field :notes, :string
field :performerId, :integer
field :tel, :string
timestamps()
end
@doc false
def changeset(performer, attrs) do
performer
|> cast(attrs, [:performerId, :fname, :lname, :email, :tel, :confirmed, :notes])
|> validate_required([:performerId, :fname, :lname, :email, :tel, :confirmed, :notes])
|> unique_constraint(:performerId)
|> unique_constraint(:email)
end
end