Move queries and mutations to submodules
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -3,6 +3,7 @@ defmodule MobilizonWeb.Schema.Events.CategoryType do
|
||||
Schema representation for Category
|
||||
"""
|
||||
use Absinthe.Schema.Notation
|
||||
alias MobilizonWeb.Resolvers
|
||||
|
||||
@desc "A category"
|
||||
object :category do
|
||||
@@ -11,4 +12,23 @@ defmodule MobilizonWeb.Schema.Events.CategoryType do
|
||||
field(:picture, :picture, description: "The category's picture")
|
||||
field(:title, :string, description: "The category's title")
|
||||
end
|
||||
|
||||
object :category_queries do
|
||||
@desc "Get the list of categories"
|
||||
field :categories, non_null(list_of(:category)) do
|
||||
arg(:page, :integer, default_value: 1)
|
||||
arg(:limit, :integer, default_value: 10)
|
||||
resolve(&Resolvers.Category.list_categories/3)
|
||||
end
|
||||
end
|
||||
|
||||
object :category_mutations do
|
||||
@desc "Create a category with a title, description and picture"
|
||||
field :create_category, type: :category do
|
||||
arg(:title, non_null(:string))
|
||||
arg(:description, non_null(:string))
|
||||
arg(:picture, non_null(:upload))
|
||||
resolve(&Resolvers.Category.create_category/3)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,6 +4,7 @@ defmodule MobilizonWeb.Schema.Events.ParticipantType do
|
||||
"""
|
||||
use Absinthe.Schema.Notation
|
||||
import Absinthe.Resolution.Helpers, only: [dataloader: 1]
|
||||
alias MobilizonWeb.Resolvers
|
||||
|
||||
@desc "Represents a participant to an event"
|
||||
object :participant do
|
||||
@@ -15,4 +16,14 @@ defmodule MobilizonWeb.Schema.Events.ParticipantType do
|
||||
field(:actor, :actor, description: "The actor that participates to the event")
|
||||
field(:role, :integer, description: "The role of this actor at this event")
|
||||
end
|
||||
|
||||
object :participant_queries do
|
||||
@desc "Get all participants for an event uuid"
|
||||
field :participants, list_of(:participant) do
|
||||
arg(:uuid, non_null(:uuid))
|
||||
arg(:page, :integer, default_value: 1)
|
||||
arg(:limit, :integer, default_value: 10)
|
||||
resolve(&Resolvers.Event.list_participants_for_event/3)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user