module Decidim::Conferences::QueryExtensions

This module's job is to extend the API with custom fields related to decidim-assemblies.

Public Class Methods

included(type) click to toggle source

Public: Extends a type with `decidim-assemblies`'s fields.

type - A GraphQL::BaseType to extend.

Returns nothing.

# File lib/decidim/conferences/query_extensions.rb, line 13
def self.included(type)
  type.field :conferences,
             [Decidim::Conferences::ConferenceType],
             null: true,
             description: "Lists all conferences" do
    argument :filter, Decidim::ParticipatoryProcesses::ParticipatoryProcessInputFilter, "This argument lets you filter the results", required: false
    argument :order, Decidim::ParticipatoryProcesses::ParticipatoryProcessInputSort, "This argument lets you order the results", required: false
  end

  type.field :conference,
             Decidim::Conferences::ConferenceType,
             null: true,
             description: "Finds a conference" do
    argument :id, GraphQL::Types::ID, "The ID of the participatory space", required: false
  end
end

Public Instance Methods

conference(id: nil) click to toggle source
# File lib/decidim/conferences/query_extensions.rb, line 36
def conference(id: nil)
  manifest = Decidim.participatory_space_manifests.select { |m| m.name == :conferences }.first

  Decidim::Core::ParticipatorySpaceFinderBase.new(manifest: manifest).call(object, { id: id }, context)
end
conferences(filter: {}, order: {}) click to toggle source
# File lib/decidim/conferences/query_extensions.rb, line 30
def conferences(filter: {}, order: {})
  manifest = Decidim.participatory_space_manifests.select { |m| m.name == :conferences }.first

  Decidim::Core::ParticipatorySpaceListBase.new(manifest: manifest).call(object, { filter: filter, order: order }, context)
end