Sha256: 0de386b4920fff814ec222482fc0aaeded806a7347514c54f8f591a147eb1125
Contents?: true
Size: 1.72 KB
Versions: 37
Compression:
Stored size: 1.72 KB
Contents
# frozen_string_literal: true module Decidim module Consultations # 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 :consultations, [Decidim::Consultations::ConsultationType], null: true, description: "Lists all consultations" do argument :filter, Decidim::ParticipatoryProcesses::ParticipatoryProcessInputFilter, "This argument let's you filter the results", required: false argument :order, Decidim::ParticipatoryProcesses::ParticipatoryProcessInputSort, "This argument let's you order the results", required: false end type.field :consultation, Decidim::Consultations::ConsultationType, null: true, description: "Finds a consultation" do argument :id, GraphQL::Types::ID, "The ID of the participatory space", required: false end end def consultations(filter: {}, order: {}) manifest = Decidim.participatory_space_manifests.select { |m| m.name == :consultations }.first Decidim::Core::ParticipatorySpaceListBase.new(manifest: manifest).call(object, { filter: filter, order: order }, context) end def consultation(id: nil) manifest = Decidim.participatory_space_manifests.select { |m| m.name == :consultations }.first Decidim::Core::ParticipatorySpaceFinderBase.new(manifest: manifest).call(object, { id: id }, context) end end end end
Version data entries
37 entries across 37 versions & 1 rubygems