Sha256: f7636eada23b4da8ad3ed63a46a3b9e6cea1a73b8d1073357ccdd0bd6e9a0a54

Contents?: true

Size: 1.66 KB

Versions: 13

Compression:

Stored size: 1.66 KB

Contents

# frozen_string_literal: true

module Decidim
  module Conferences
    # This module's job is to extend the API with custom fields related to
    # decidim-assemblies.
    module QueryExtensions
      # Public: Extends a type with `decidim-assemblies`'s fields.
      #
      # type - A GraphQL::BaseType to extend.
      #
      # Returns nothing.
      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

      def conferences(filter: {}, order: {})
        manifest = Decidim.participatory_space_manifests.select { |m| m.name == :conferences }.first

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

      def conference(id: nil)
        manifest = Decidim.participatory_space_manifests.select { |m| m.name == :conferences }.first

        Decidim::Core::ParticipatorySpaceFinderBase.new(manifest:).call(object, { id: }, context)
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
decidim-conferences-0.29.1 lib/decidim/conferences/query_extensions.rb
decidim-conferences-0.28.4 lib/decidim/conferences/query_extensions.rb
decidim-conferences-0.29.0 lib/decidim/conferences/query_extensions.rb
decidim-conferences-0.28.3 lib/decidim/conferences/query_extensions.rb
decidim-conferences-0.29.0.rc4 lib/decidim/conferences/query_extensions.rb
decidim-conferences-0.29.0.rc3 lib/decidim/conferences/query_extensions.rb
decidim-conferences-0.29.0.rc2 lib/decidim/conferences/query_extensions.rb
decidim-conferences-0.29.0.rc1 lib/decidim/conferences/query_extensions.rb
decidim-conferences-0.28.2 lib/decidim/conferences/query_extensions.rb
decidim-conferences-0.28.1 lib/decidim/conferences/query_extensions.rb
decidim-conferences-0.28.0 lib/decidim/conferences/query_extensions.rb
decidim-conferences-0.28.0.rc5 lib/decidim/conferences/query_extensions.rb
decidim-conferences-0.28.0.rc4 lib/decidim/conferences/query_extensions.rb