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,26 @@
defmodule Eventos.Events.Event do
use Ecto.Schema
import Ecto.Changeset
alias Eventos.Events.{Event, EventAccount, EventRequest}
alias Eventos.Accounts.Account
schema "events" do
field :begin_on, :utc_datetime
field :description, :string
field :ends_on, :utc_datetime
field :title, :string
has_one :organizer_id, Account
many_to_many :participants, Account, join_through: EventAccount
has_many :event_request, EventRequest
timestamps()
end
@doc false
def changeset(%Event{} = event, attrs) do
event
|> cast(attrs, [:title, :description, :begin_on, :ends_on])
|> validate_required([:title, :description, :begin_on, :ends_on, :organizer_id])
end
end