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

22 lines
476 B
Elixir
Raw Normal View History

2024-01-21 23:48:10 -06:00
defmodule Homeman.Accounts.User do
use Ecto.Schema
import Ecto.Changeset
@primary_key {:id, :binary_id, autogenerate: true}
@foreign_key_type :binary_id
schema "users" do
field :name, :string
field :color, :string
field :avatar_url, :string
timestamps(type: :utc_datetime)
end
@doc false
def changeset(user, attrs) do
user
|> cast(attrs, [:name, :avatar_url, :color])
|> validate_required([:name, :avatar_url, :color])
end
end