Add draft feature

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2019-10-02 17:59:07 +02:00
parent b96f3bc3ad
commit 442a011490
22 changed files with 587 additions and 66 deletions

View File

@@ -6,6 +6,7 @@ defmodule MobilizonWeb.Schema.EventType do
use Absinthe.Schema.Notation
import Absinthe.Resolution.Helpers, only: [dataloader: 1]
import MobilizonWeb.Schema.Utils
alias Mobilizon.{Actors, Addresses}
@@ -60,6 +61,8 @@ defmodule MobilizonWeb.Schema.EventType do
field(:category, :string, description: "The event's category")
field(:draft, :boolean, description: "Whether or not the event is a draft")
field(:participant_stats, :participant_stats, resolve: &Event.stats_participants_for_event/3)
field(:participants, list_of(:participant), description: "The event's participants") do
@@ -252,8 +255,9 @@ defmodule MobilizonWeb.Schema.EventType do
arg(:category, :string, default_value: "meeting")
arg(:physical_address, :address_input)
arg(:options, :event_options_input)
arg(:draft, :boolean, default_value: false)
resolve(&Event.create_event/3)
resolve(handle_errors(&Event.create_event/3))
end
@desc "Update an event"
@@ -280,8 +284,9 @@ defmodule MobilizonWeb.Schema.EventType do
arg(:category, :string)
arg(:physical_address, :address_input)
arg(:options, :event_options_input)
arg(:draft, :boolean)
resolve(&Event.update_event/3)
resolve(handle_errors(&Event.update_event/3))
end
@desc "Delete an event"

View File

@@ -49,7 +49,7 @@ defmodule MobilizonWeb.Schema.UserType do
field(:locale, :string, description: "The user's locale")
field(:participations, list_of(:participant),
description: "The list of events this user goes to"
description: "The list of participations this user has"
) do
arg(:after_datetime, :datetime)
arg(:before_datetime, :datetime)
@@ -57,6 +57,12 @@ defmodule MobilizonWeb.Schema.UserType do
arg(:limit, :integer, default_value: 10)
resolve(&User.user_participations/3)
end
field(:drafts, list_of(:event), description: "The list of draft events this user has created") do
arg(:page, :integer, default_value: 1)
arg(:limit, :integer, default_value: 10)
resolve(&User.user_drafted_events/3)
end
end
enum :user_role do