Sha256: 9e49359220c83f5c5b3674a4393be1f44e82b681f047b2e20817ffd3b3d12c8b
Contents?: true
Size: 1.02 KB
Versions: 2
Compression:
Stored size: 1.02 KB
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 :comments do description "Lists all commentable's comments." type !types[CommentType] argument :commentableId, !types.String, "The commentable's ID" argument :commentableType, !types.String, "The commentable's class name. i.e. `Decidim::ParticipatoryProcess`" resolve lambda { |_obj, args, _ctx| Comment .where(commentable_id: args[:commentableId]) .where(commentable_type: args[:commentableType]) .order(created_at: :asc) .all } end end end end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
decidim-comments-0.0.1 | lib/decidim/comments/query_extensions.rb |
decidim-0.0.1 | decidim-comments/lib/decidim/comments/query_extensions.rb |