Sha256: 79e55bf8719cbfa76bc8a5ed729c29e16e8d549723f1d0c08bd3f1bc5f309421

Contents?: true

Size: 1.01 KB

Versions: 32

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true

module Decidim
  # This module's job is to extend the API with custom fields related to
  # decidim-core.
  module QueryExtensions
    # Public: Extends a type with `decidim-core`'s fields.
    #
    # type - A GraphQL::BaseType to extend.
    #
    # Returns nothing.
    def self.extend!(type)
      type.define do
        field :processes do
          type !types[ProcessType]
          description "Lists all processes."

          resolve lambda { |_obj, _args, ctx|
            ParticipatoryProcesses::OrganizationPublishedParticipatoryProcesses.new(ctx[:current_organization])
          }
        end

        field :session do
          type SessionType
          description "Return's information about the logged in user"

          resolve lambda { |_obj, _args, ctx|
            ctx[:current_user]
          }
        end

        field :decidim, DecidimType, "Decidim's framework properties." do
          resolve ->(_obj, _args, _ctx) { Decidim }
        end
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 2 rubygems

Version Path
decidim-core-0.9.3 lib/decidim/query_extensions.rb
decidim-core-0.9.2 lib/decidim/query_extensions.rb
decidim-core-0.9.1 lib/decidim/query_extensions.rb
decidim-core-0.9.0 lib/decidim/query_extensions.rb
decidim-core-0.8.4 lib/decidim/query_extensions.rb
decidim-core-0.8.3 lib/decidim/query_extensions.rb
decidim-core-0.8.2 lib/decidim/query_extensions.rb
decidim-core-0.8.1 lib/decidim/query_extensions.rb
decidim-core-0.8.0 lib/decidim/query_extensions.rb
decidim-core-0.7.4 lib/decidim/query_extensions.rb
decidim-core-0.7.3 lib/decidim/query_extensions.rb
decidim-core-0.7.2 lib/decidim/query_extensions.rb
decidim-core-0.7.1 lib/decidim/query_extensions.rb
decidim-core-0.7.0 lib/decidim/query_extensions.rb
decidim-core-0.6.8 lib/decidim/query_extensions.rb
decidim-0.6.8 decidim-core/lib/decidim/query_extensions.rb
decidim-core-0.6.7 lib/decidim/query_extensions.rb
decidim-0.6.7 decidim-core/lib/decidim/query_extensions.rb
decidim-core-0.6.6 lib/decidim/query_extensions.rb
decidim-0.6.6 decidim-core/lib/decidim/query_extensions.rb