22 lines
476 B
Elixir
22 lines
476 B
Elixir
|
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
|