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