23 lines
538 B
Elixir
23 lines
538 B
Elixir
|
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
|