asciinema.org/web/models/user.ex
2017-06-02 15:14:48 +02:00

25 lines
747 B
Elixir

defmodule Asciinema.User do
use Asciinema.Web, :model
schema "users" do
field :username, :string
field :temporary_username, :string
field :email, :string
field :name, :string
field :auth_token, :string
field :theme_name, :string
field :asciicasts_private_by_default, :boolean, default: true
# timestamps()
end
@doc """
Builds a changeset based on the `struct` and `params`.
"""
def changeset(struct, params \\ %{}) do
struct
|> cast(params, [:email, :name, :username, :temporary_username, :auth_token, :theme_name, :asciicasts_private_by_default])
|> validate_required([:email, :name, :username, :temporary_username, :auth_token, :theme_name, :asciicasts_private_by_default])
end
end