Sha256: 3827250a336f4abe5cfe0ae1da0e142209e8a033a9c7849563be3ef9787b4370

Contents?: true

Size: 798 Bytes

Versions: 21

Compression:

Stored size: 798 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Pages
    PagesType = GraphQL::ObjectType.define do
      interfaces [-> { Decidim::Core::ComponentInterface }]

      name "Pages"
      description "A pages component of a participatory space."

      connection :pages, PageType.connection_type do
        resolve ->(component, _args, _ctx) {
                  PagesTypeHelper.base_scope(component).includes(:component)
                }
      end

      field(:page, PageType) do
        argument :id, !types.ID

        resolve ->(component, args, _ctx) {
          PagesTypeHelper.base_scope(component).find_by(id: args[:id])
        }
      end
    end

    module PagesTypeHelper
      def self.base_scope(component)
        Page.where(component: component)
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
decidim-pages-0.23.6 app/types/decidim/pages/pages_type.rb
decidim-pages-0.23.5 app/types/decidim/pages/pages_type.rb
decidim-pages-0.23.4 app/types/decidim/pages/pages_type.rb
decidim-pages-0.23.3 app/types/decidim/pages/pages_type.rb
decidim-pages-0.23.2 app/types/decidim/pages/pages_type.rb
decidim-pages-0.23.1 app/types/decidim/pages/pages_type.rb
decidim-pages-0.23.1.rc1 app/types/decidim/pages/pages_type.rb
decidim-pages-0.23.0 app/types/decidim/pages/pages_type.rb
decidim-pages-0.22.0 app/types/decidim/pages/pages_type.rb
decidim-pages-0.21.0 app/types/decidim/pages/pages_type.rb
decidim-pages-0.20.1 app/types/decidim/pages/pages_type.rb
decidim-pages-0.20.0 app/types/decidim/pages/pages_type.rb
decidim-pages-0.19.1 app/types/decidim/pages/pages_type.rb
decidim-pages-0.18.1 app/types/decidim/pages/pages_type.rb
decidim-pages-0.19.0 app/types/decidim/pages/pages_type.rb
decidim-pages-0.17.2 app/types/decidim/pages/pages_type.rb
decidim-pages-0.18.0 app/types/decidim/pages/pages_type.rb
decidim-pages-0.17.1 app/types/decidim/pages/pages_type.rb
decidim-pages-0.16.1 app/types/decidim/pages/pages_type.rb
decidim-pages-0.17.0 app/types/decidim/pages/pages_type.rb