Sha256: a8e458e38e606a8c0028634b71151d872891d49332e39a308c1655a5699805d5

Contents?: true

Size: 1.05 KB

Versions: 9

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

module Decidim
  module Core
    # This interface represents an author who owns a resource.
    AuthorInterface = GraphQL::InterfaceType.define do
      name "Author"
      description "An author"

      field :id, !types.ID, "The author ID"
      field :name, !types.String, "The author's name"
      field :nickname, !types.String, "The author's nickname"

      field :avatarUrl, !types.String, "The author's avatar url"
      field :profilePath, !types.String, "The author's profile path"
      field :badge, !types.String, "The author's badge icon"
      field :organizationName, !types.String, "The authors's organization name" do
        resolve ->(obj, _args, _ctx) { obj.organization.name }
      end

      field :deleted, !types.Boolean, "Whether the author's account has been deleted or not"

      resolve_type ->(obj, _ctx) {
                     return Decidim::Core::UserType if obj.is_a? Decidim::User
                     return Decidim::Core::UserGroupType if obj.is_a? Decidim::UserGroup
                   }
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

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