Sha256: 42f4408ef5b4e5fefa446a029045ae3ccd0dd66e80703cd312e5b6470fadddca

Contents?: true

Size: 1.09 KB

Versions: 44

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

module Decidim
  module Core
    # This interface represents an author who owns a resource.
    module AuthorInterface
      include Decidim::Api::Types::BaseInterface
      graphql_name "Author"
      description "An author"

      field :id, ID, "The author ID", null: false
      field :name, String, "The author's name", null: false
      field :nickname, String, "The author's nickname", null: false

      field :avatar_url, String, "The author's avatar url", null: false
      field :profile_path, String, "The author's profile path", null: false
      field :badge, String, "The author's badge icon", null: false
      field :organization_name, String, "The authors's organization name", null: false

      def organization_name
        object.organization.name
      end

      field :deleted, Boolean, "Whether the author's account has been deleted or not", null: false

      def self.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
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
decidim-core-0.28.4 lib/decidim/api/interfaces/author_interface.rb
decidim-core-0.27.9 lib/decidim/api/interfaces/author_interface.rb
decidim-core-0.28.3 lib/decidim/api/interfaces/author_interface.rb
decidim-core-0.27.8 lib/decidim/api/interfaces/author_interface.rb
decidim-core-0.28.2 lib/decidim/api/interfaces/author_interface.rb
decidim-core-0.27.7 lib/decidim/api/interfaces/author_interface.rb
decidim-core-0.28.1 lib/decidim/api/interfaces/author_interface.rb
decidim-core-0.27.6 lib/decidim/api/interfaces/author_interface.rb
decidim-core-0.26.10 lib/decidim/api/interfaces/author_interface.rb
decidim-core-0.26.9 lib/decidim/api/interfaces/author_interface.rb
decidim-core-0.28.0 lib/decidim/api/interfaces/author_interface.rb
decidim-core-0.27.5 lib/decidim/api/interfaces/author_interface.rb
decidim-core-0.28.0.rc5 lib/decidim/api/interfaces/author_interface.rb
decidim-core-0.28.0.rc4 lib/decidim/api/interfaces/author_interface.rb
decidim-core-0.26.8 lib/decidim/api/interfaces/author_interface.rb
decidim-core-0.27.4 lib/decidim/api/interfaces/author_interface.rb
decidim-core-0.27.3 lib/decidim/api/interfaces/author_interface.rb
decidim-core-0.26.7 lib/decidim/api/interfaces/author_interface.rb
decidim-core-0.26.5 lib/decidim/api/interfaces/author_interface.rb
decidim-core-0.27.2 lib/decidim/api/interfaces/author_interface.rb