Sha256: 16e5304eca5c23dae1e793f59c59e926eb8c0c68d3e1133c93d5a380e18eea1d
Contents?: true
Size: 1.08 KB
Versions: 10
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true module Decidim module Core ParticipatorySpaceLinkType = GraphQL::ObjectType.define do name "ParticipatorySpaceLink" description "A link representation between participatory spaces" field :id, !types.ID, "The id of this participatory space link" field :fromType, !types.String, "The origin participatory space type for this participatory space link", property: :from_type field :toType, !types.String, "The destination participatory space type for this participatory space link", property: :to_type field :name, !types.String, "The name (purpose) of this participatory space link" field :participatorySpace, !ParticipatorySpaceInterface do description "The linked participatory space (polymorphic)" resolve ->(link, _args, _ctx) { manifest_name = link.name.partition("included_").last object_class = "Decidim::#{manifest_name.classify}" return link.to if link.to_type == object_class return link.from if link.from_type == object_class } end end end end
Version data entries
10 entries across 10 versions & 1 rubygems