Sha256: 7a4c8c1c64375c96fea59a0a519db9220ccaade61fece5368646c1f09e228eb2

Contents?: true

Size: 1.09 KB

Versions: 50

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

module Decidim
  module Core
    class ParticipatorySpaceLinkType < Decidim::Api::Types::BaseObject
      description "A link representation between participatory spaces"

      field :id, GraphQL::Types::ID, "The id of this participatory space link", null: false
      field :from_type, GraphQL::Types::String, "The origin participatory space type for this participatory space link", null: false
      field :to_type, GraphQL::Types::String, "The destination participatory space type for this participatory space link", null: false
      field :name, GraphQL::Types::String, "The name (purpose) of this participatory space link", null: false
      field :participatory_space, ParticipatorySpaceInterface, description: "The linked participatory space (polymorphic)", null: false

      def participatory_space
        manifest_name = object.name.partition("included_").last
        object_class = "Decidim::#{manifest_name.classify}"
        return object.to if object.to_type == object_class
        return object.from if object.from_type == object_class
      end
    end
  end
end

Version data entries

50 entries across 50 versions & 1 rubygems

Version Path
decidim-core-0.29.1 lib/decidim/api/types/participatory_space_link_type.rb
decidim-core-0.28.4 lib/decidim/api/types/participatory_space_link_type.rb
decidim-core-0.27.9 lib/decidim/api/types/participatory_space_link_type.rb
decidim-core-0.29.0 lib/decidim/api/types/participatory_space_link_type.rb
decidim-core-0.28.3 lib/decidim/api/types/participatory_space_link_type.rb
decidim-core-0.27.8 lib/decidim/api/types/participatory_space_link_type.rb
decidim-core-0.29.0.rc4 lib/decidim/api/types/participatory_space_link_type.rb
decidim-core-0.29.0.rc3 lib/decidim/api/types/participatory_space_link_type.rb
decidim-core-0.29.0.rc2 lib/decidim/api/types/participatory_space_link_type.rb
decidim-core-0.29.0.rc1 lib/decidim/api/types/participatory_space_link_type.rb
decidim-core-0.28.2 lib/decidim/api/types/participatory_space_link_type.rb
decidim-core-0.27.7 lib/decidim/api/types/participatory_space_link_type.rb
decidim-core-0.28.1 lib/decidim/api/types/participatory_space_link_type.rb
decidim-core-0.27.6 lib/decidim/api/types/participatory_space_link_type.rb
decidim-core-0.26.10 lib/decidim/api/types/participatory_space_link_type.rb
decidim-core-0.26.9 lib/decidim/api/types/participatory_space_link_type.rb
decidim-core-0.28.0 lib/decidim/api/types/participatory_space_link_type.rb
decidim-core-0.27.5 lib/decidim/api/types/participatory_space_link_type.rb
decidim-core-0.28.0.rc5 lib/decidim/api/types/participatory_space_link_type.rb
decidim-core-0.28.0.rc4 lib/decidim/api/types/participatory_space_link_type.rb