Sha256: 83008106b57ba5175a1357524d72b47a2ca041edb511c46d757e5c2e86593f28
Contents?: true
Size: 1.27 KB
Versions: 17
Compression:
Stored size: 1.27 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::Component.where( participatory_space: participatory_space ).published } end field :stats, types[Decidim::Core::StatisticType] do resolve ->(participatory_space, _args, _ctx) { published_components = Component.where(participatory_space: participatory_space).published stats = Decidim.component_manifests.map do |component_manifest| component_manifest.stats.with_context(published_components).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
17 entries across 17 versions & 1 rubygems