Issue #1567 : Add a long_event computed field to an event

The actual long_event implementation is only done for search and long_event is a parameter of the search request.

This change is needed for the the front-end to know if an event is a long_event everywhere an event is received.

The computed field (Ecto virtual field) is set after the Ecto request with the function with_virtual_fields().

with_virtual_fields() handles cases where there is an event, a list of events and a paginated list of events returned.
This commit is contained in:
Massedil
2024-11-21 19:52:57 +01:00
committed by setop
parent 9796304a9a
commit 752da9e641
4 changed files with 76 additions and 1 deletions

View File

@@ -32,6 +32,11 @@ defmodule Mobilizon.GraphQL.Schema.EventType do
field(:description, :string, description: "The event's description")
field(:begins_on, :datetime, description: "Datetime for when the event begins")
field(:ends_on, :datetime, description: "Datetime for when the event ends")
field(:long_event, :boolean,
description: "Whether the event is a long event (activity) or not"
)
field(:status, :event_status, description: "Status of the event")
field(:visibility, :event_visibility, description: "The event's visibility")
field(:join_options, :event_join_options, description: "The event's visibility")

View File

@@ -17,6 +17,11 @@ defmodule Mobilizon.GraphQL.Schema.SearchType do
field(:title, :string, description: "The event's title")
field(:begins_on, :datetime, description: "Datetime for when the event begins")
field(:ends_on, :datetime, description: "Datetime for when the event ends")
field(:long_event, :boolean,
description: "Whether the event is a long event (activity) or not"
)
field(:status, :event_status, description: "Status of the event")
field(:picture, :media, description: "The event's picture")
field(:physical_address, :address, description: "The event's physical address")
@@ -52,6 +57,11 @@ defmodule Mobilizon.GraphQL.Schema.SearchType do
field(:title, :string, description: "The event's title")
field(:begins_on, :datetime, description: "Datetime for when the event begins")
field(:ends_on, :datetime, description: "Datetime for when the event ends")
field(:long_event, :boolean,
description: "Whether the event is a long event (activity) or not"
)
field(:status, :event_status, description: "Status of the event")
field(:picture, :media, description: "The event's picture")
field(:physical_address, :address, description: "The event's physical address")