Sha256: c79f3a6377e11b1123d263f309094f5d4e3f76a6454d409242ef2654572aeb61
Contents?: true
Size: 1.26 KB
Versions: 2
Compression:
Stored size: 1.26 KB
Contents
# frozen_string_literal: true module Decidim module Core ParticipatorySpaceInterface = GraphQL::InterfaceType.define do name "ParticipatorySpaceInterface" description "The interface that all participatory spaces should implement." field :id, !types.ID, "The participatory space's unique ID" field :title, !TranslatedFieldType, "The name of this participatory space." field :components, types[ComponentInterface] do description "Lists the components this space contains." resolve ->(participatory_space, _args, _ctx) { Decidim::Feature.where( participatory_space: participatory_space ).published } end field :stats, types[Decidim::Core::StatisticType] do resolve ->(participatory_space, _args, _ctx) { published_features = Feature.where(participatory_space: participatory_space).published stats = Decidim.feature_manifests.map do |feature_manifest| feature_manifest.stats.with_context(published_features).map { |name, data| [name, data] }.flatten end stats.reject(&:empty?) } end resolve_type ->(obj, _ctx) { obj.manifest.query_type.constantize } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
decidim-core-0.10.1 | lib/decidim/api/participatory_space_interface.rb |
decidim-core-0.10.0 | lib/decidim/api/participatory_space_interface.rb |