Sha256: 6018dd6b53448fabc307a729400c6934c3820fbfe05e4e3b74eb2a90223394ce

Contents?: true

Size: 1.09 KB

Versions: 10

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

module Decidim
  module Core
    # This interface represents a coauthorable object.
    CoauthorableInterface = GraphQL::InterfaceType.define do
      name "CoauthorableInterface"
      description "An interface that can be used in coauthorable objects."

      field :authorsCount, types.Int do
        description "The total amount of co-authors that contributed to the proposal. Note that this field may include also non-user authors like meetings or the organization"
        property :coauthorships_count
      end

      field :author, Decidim::Core::AuthorInterface do
        description "The resource author. Note that this can be null on official proposals or meeting-proposals"
        resolve ->(resource, _, _) {
          author = resource.creator_identity
          author if author.is_a?(Decidim::User) || author.is_a?(Decidim::UserGroup)
        }
      end

      field :authors, !types[Decidim::Core::AuthorInterface] do
        description "The resource co-authors. Include only users or groups of users"
        property :user_identities
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
decidim-core-0.23.6 lib/decidim/api/coauthorable_interface.rb
decidim-core-0.23.5 lib/decidim/api/coauthorable_interface.rb
decidim-core-0.23.4 lib/decidim/api/coauthorable_interface.rb
decidim-core-0.23.3 lib/decidim/api/coauthorable_interface.rb
decidim-core-0.23.2 lib/decidim/api/coauthorable_interface.rb
decidim-core-0.23.1 lib/decidim/api/coauthorable_interface.rb
decidim-core-0.23.1.rc1 lib/decidim/api/coauthorable_interface.rb
decidim-core-0.23.0 lib/decidim/api/coauthorable_interface.rb
decidim-core-0.22.0 lib/decidim/api/coauthorable_interface.rb
decidim-core-0.21.0 lib/decidim/api/coauthorable_interface.rb