Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2023-10-17 16:41:31 +02:00
parent 0613f7f736
commit b5672cee7e
108 changed files with 5221 additions and 1318 deletions

View File

@@ -13,6 +13,7 @@ defmodule Mobilizon.Events.Event do
alias Mobilizon.{Addresses, Events, Medias, Mention}
alias Mobilizon.Addresses.Address
alias Mobilizon.Conversations.Conversation
alias Mobilizon.Discussions.Comment
alias Mobilizon.Events.{
@@ -126,6 +127,7 @@ defmodule Mobilizon.Events.Event do
has_many(:sessions, Session)
has_many(:mentions, Mention)
has_many(:comments, Comment)
has_many(:conversations, Conversation)
many_to_many(:contacts, Actor, join_through: "event_contacts", on_replace: :delete)
many_to_many(:tags, Tag, join_through: "events_tags", on_replace: :delete)
many_to_many(:participants, Actor, join_through: Participant)

View File

@@ -871,6 +871,21 @@ defmodule Mobilizon.Events do
|> Page.build_page(page, limit)
end
@doc """
Returns the whole list of participants for an event.
Default behaviour is to not return :not_approved or :not_confirmed participants
"""
@spec list_all_participants_for_event(String.t(), list(atom())) :: list(Participant.t())
def list_all_participants_for_event(
id,
roles \\ []
) do
id
|> participants_for_event_query(roles)
|> preload([:actor, :event])
|> Repo.all()
end
@spec list_actors_participants_for_event(String.t()) :: [Actor.t()]
def list_actors_participants_for_event(id) do
id