Sha256: 32b3e91e6b4aaf823e98d2f3272e407a881d1eed4f0300219ea70d1b83f2b1db

Contents?: true

Size: 1.06 KB

Versions: 10

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true

module Decidim
  module Core
    # This interface represents a participatorySpaceResourceable object.
    # It create and array of linked participatory spaces for each registered manifest
    ParticipatorySpaceResourceableInterface = GraphQL::InterfaceType.define do
      name "ParticipatorySpaceResourcableInterface"
      description "An interface that can be used in objects with participatorySpaceResourceable"

      # this handles the cases linked_participatory_space_resources(:participatory_space, :included_participatory_space)
      field "linkedParticipatorySpaces", !types[ParticipatorySpaceLinkType] do
        description "Lists all linked participatory spaces in a polymorphic way"
        resolve ->(participatory_space, _args, _ctx) {
          Decidim::ParticipatorySpaceLink.where("name like 'included_%' and ((from_id=:id and from_type=:type) or (to_id=:id and to_type=:type))",
                                                id: participatory_space.id, type: participatory_space.class.name)
        }
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
decidim-core-0.23.6 lib/decidim/api/participatory_space_resourceable_interface.rb
decidim-core-0.23.5 lib/decidim/api/participatory_space_resourceable_interface.rb
decidim-core-0.23.4 lib/decidim/api/participatory_space_resourceable_interface.rb
decidim-core-0.23.3 lib/decidim/api/participatory_space_resourceable_interface.rb
decidim-core-0.23.2 lib/decidim/api/participatory_space_resourceable_interface.rb
decidim-core-0.23.1 lib/decidim/api/participatory_space_resourceable_interface.rb
decidim-core-0.23.1.rc1 lib/decidim/api/participatory_space_resourceable_interface.rb
decidim-core-0.23.0 lib/decidim/api/participatory_space_resourceable_interface.rb
decidim-core-0.22.0 lib/decidim/api/participatory_space_resourceable_interface.rb
decidim-core-0.21.0 lib/decidim/api/participatory_space_resourceable_interface.rb