homeman-elixir/lib/homeman/accounts/todo.ex
2024-01-21 23:48:10 -06:00

23 lines
551 B
Elixir

defmodule Homeman.Accounts.Todo do
use Ecto.Schema
import Ecto.Changeset
@primary_key {:id, :binary_id, autogenerate: true}
@foreign_key_type :binary_id
schema "todos" do
field :description, :string
field :emoji, :string
field :completed_at, :naive_datetime
field :assignee_user_id, :binary_id
timestamps(type: :utc_datetime)
end
@doc false
def changeset(todo, attrs) do
todo
|> cast(attrs, [:description, :emoji, :completed_at])
|> validate_required([:description, :emoji, :completed_at])
end
end