clacks/lib/clacks/user.ex

22 lines
407 B
Elixir

defmodule Clacks.User do
use Ecto.Schema
import Ecto.Changeset
@type t() :: %__MODULE__{}
schema "users" do
field :username, :string
field :private_key, :string
has_one :actor, Clacks.Actor
timestamps()
end
def changeset(%__MODULE__{} = schema, attrs) do
schema
|> cast(attrs, [:username, :private_key])
|> validate_required([:username, :private_key])
end
end