gitlab-org--gitlab-foss/app/graphql/types/tree/blob_type.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 lines
958 B
Ruby
Raw Normal View History

2019-05-22 11:43:35 +00:00
# frozen_string_literal: true
module Types
module Tree
# rubocop: disable Graphql/AuthorizeTypes
# This is presented through `Repository` that has its own authorization
2019-05-22 11:43:35 +00:00
class BlobType < BaseObject
graphql_name 'Blob'
2019-05-22 11:43:35 +00:00
implements Types::Tree::EntryType
present_using BlobPresenter
field :lfs_oid, GraphQL::Types::String, null: true,
calls_gitaly: true,
description: 'LFS ID of the blob.'
field :mode, GraphQL::Types::String, null: true,
description: 'Blob mode in numeric format.'
field :web_path, GraphQL::Types::String, null: true,
description: 'Web path of the blob.'
field :web_url, GraphQL::Types::String, null: true,
description: 'Web URL of the blob.'
def lfs_oid
Gitlab::Graphql::Loaders::BatchLfsOidLoader.new(object.repository, object.id).find
end
2019-05-22 11:43:35 +00:00
end
# rubocop: enable Graphql/AuthorizeTypes
2019-05-22 11:43:35 +00:00
end
end