Packages

CalDAV server library — mount as a Plug, bring your own storage adapter. Heavily WIP / beta software; APIs may change between releases.

Current section

Files

Jump to
ex_dav lib ex_dav storage postgres schemas user.ex
Raw

lib/ex_dav/storage/postgres/schemas/user.ex

defmodule ExDav.Storage.Postgres.Schemas.User do
@moduledoc "A DAV principal."
use Ecto.Schema
import Ecto.Changeset
alias ExDav.Storage.Postgres.Schemas.Collection
schema "caldav_users" do
field :username, :string
field :password, :string
field :display_name, :string
has_many :collections, Collection
timestamps(type: :utc_datetime)
end
def changeset(user, attrs) do
user
|> cast(attrs, [:username, :password, :display_name])
|> validate_required([:username, :password])
|> unique_constraint(:username)
end
end