2018-01-13 23:33:03 +01:00
|
|
|
defmodule Eventos.Events.Request do
|
2017-12-08 09:58:14 +01:00
|
|
|
use Ecto.Schema
|
|
|
|
import Ecto.Changeset
|
2018-01-13 23:33:03 +01:00
|
|
|
alias Eventos.Events.{Request, Event}
|
2017-12-08 09:58:14 +01:00
|
|
|
alias Eventos.Accounts.Account
|
|
|
|
|
|
|
|
schema "event_requests" do
|
|
|
|
field :state, :integer
|
2018-01-13 23:33:03 +01:00
|
|
|
belongs_to :event, Event
|
|
|
|
belongs_to :account, Account
|
2017-12-08 09:58:14 +01:00
|
|
|
|
|
|
|
timestamps()
|
|
|
|
end
|
|
|
|
|
|
|
|
@doc false
|
2018-01-13 23:33:03 +01:00
|
|
|
def changeset(%Request{} = request, attrs) do
|
|
|
|
request
|
2017-12-08 09:58:14 +01:00
|
|
|
|> cast(attrs, [:state])
|
|
|
|
|> validate_required([:state])
|
|
|
|
end
|
|
|
|
end
|