1217361b6c
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
25 lines
514 B
Elixir
25 lines
514 B
Elixir
defmodule Eventos.Events.Request do
|
|
@moduledoc """
|
|
Represents an account request to join an event
|
|
"""
|
|
use Ecto.Schema
|
|
import Ecto.Changeset
|
|
alias Eventos.Events.{Request, Event}
|
|
alias Eventos.Accounts.Account
|
|
|
|
schema "event_requests" do
|
|
field :state, :integer
|
|
belongs_to :event, Event
|
|
belongs_to :account, Account
|
|
|
|
timestamps()
|
|
end
|
|
|
|
@doc false
|
|
def changeset(%Request{} = request, attrs) do
|
|
request
|
|
|> cast(attrs, [:state])
|
|
|> validate_required([:state])
|
|
end
|
|
end
|