homeman-elixir/lib/homeman/accounts/task.ex

23 lines
538 B
Elixir
Raw Permalink Normal View History

2024-01-21 23:48:10 -06:00
defmodule Homeman.Accounts.Task do
use Ecto.Schema
import Ecto.Changeset
@primary_key {:id, :binary_id, autogenerate: true}
@foreign_key_type :binary_id
schema "tasks" do
field :description, :string
field :phase, :string
field :emoji, :string
field :completed_at, :naive_datetime
timestamps(type: :utc_datetime)
end
@doc false
def changeset(task, attrs) do
task
|> cast(attrs, [:description, :emoji, :completed_at, :phase])
|> validate_required([:description, :emoji, :phase])
end
end