Sha256: 272de2c3dc2ac649b3934ca3a877cf4675ce4fa73cc08e0ba063b2765e41a6ad
Contents?: true
Size: 808 Bytes
Versions: 54
Compression:
Stored size: 808 Bytes
Contents
# frozen_string_literal: true module Decidim module Comments # This module's job is to extend the API with custom fields related to # decidim-comments. module QueryExtensions # Public: Extends a type with `decidim-comments`'s fields. # # type - A GraphQL::BaseType to extend. # # Returns nothing. def self.extend!(type) type.define do field :commentable do type !CommentableType argument :id, !types.String, "The commentable's ID" argument :type, !types.String, "The commentable's class name. i.e. `Decidim::ParticipatoryProcess`" resolve lambda { |_obj, args, _ctx| args[:type].constantize.find(args[:id]) } end end end end end end
Version data entries
54 entries across 54 versions & 2 rubygems