initial commit

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2017-12-08 09:58:14 +01:00
commit 90ceb4f6fe
181 changed files with 8219 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
defmodule Eventos.Accounts.Group do
use Ecto.Schema
import Ecto.Changeset
alias Eventos.Accounts.{Group, Account, GroupAccount, GroupRequest}
schema "groups" do
field :description, :string
field :suspended, :boolean, default: false
field :title, :string
field :uri, :string
field :url, :string
many_to_many :accounts, Account, join_through: GroupAccount
has_many :requests, GroupRequest
timestamps()
end
@doc false
def changeset(%Group{} = group, attrs) do
group
|> cast(attrs, [:title, :description, :suspended, :url, :uri])
|> validate_required([:title, :description, :suspended, :url, :uri])
end
end