defmodule Cake.Boards.Board do
  use Ecto.Schema
  import Ecto.Changeset

  schema "boards" do
    field :name, :string
    field :stories, {:array, Ecto.UUID}

    field :opened_on, :timestamp
    field :closed_on, :timestamp

    timestamps()
  end

  @doc false
  def changeset(board, attrs) do
    board
    |> cast(attrs, [:name, :stories])
    |> validate_required([:name, :stories])
  end
end