1
0
Fork 0
mirror of https://framagit.org/framasoft/mobilizon.git synced 2024-12-24 00:43:02 +00:00
mobilizon/lib/eventos/events/participant.ex
Thomas Citharel f1cb601b46
WIP
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2018-06-06 18:14:04 +02:00

26 lines
668 B
Elixir

defmodule Eventos.Events.Participant do
@moduledoc """
Represents a participant, an actor participating to an event
"""
use Ecto.Schema
import Ecto.Changeset
alias Eventos.Events.{Participant, Event}
alias Eventos.Actors.Actor
@primary_key false
schema "participants" do
field :role, :integer
field :approved, :boolean
belongs_to :event, Event, primary_key: true
belongs_to :actor, Actor, primary_key: true
timestamps()
end
@doc false
def changeset(%Participant{} = participant, attrs) do
participant
|> cast(attrs, [:role, :event_id, :actor_id])
|> validate_required([:role, :event_id, :actor_id])
end
end