2019-05-22 11:43:35 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
module Types
|
|
|
|
module Tree
|
2019-06-18 16:31:06 +00:00
|
|
|
# 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
|
|
|
|
implements Types::Tree::EntryType
|
|
|
|
|
2019-06-04 13:38:18 +00:00
|
|
|
present_using BlobPresenter
|
|
|
|
|
2019-05-22 11:43:35 +00:00
|
|
|
graphql_name 'Blob'
|
2019-06-04 13:38:18 +00:00
|
|
|
|
2020-01-06 09:07:42 +00:00
|
|
|
field :web_url, GraphQL::STRING_TYPE, null: true,
|
2021-02-05 15:09:28 +00:00
|
|
|
description: 'Web URL of the blob.'
|
2020-07-23 15:09:28 +00:00
|
|
|
field :web_path, GraphQL::STRING_TYPE, null: true,
|
2021-02-05 15:09:28 +00:00
|
|
|
description: 'Web path of the blob.'
|
2020-01-06 09:07:42 +00:00
|
|
|
field :lfs_oid, GraphQL::STRING_TYPE, null: true,
|
2021-03-11 12:09:28 +00:00
|
|
|
calls_gitaly: true,
|
2021-02-05 15:09:28 +00:00
|
|
|
description: 'LFS ID of the blob.'
|
2020-07-15 12:09:26 +00:00
|
|
|
field :mode, GraphQL::STRING_TYPE, null: true,
|
2021-02-05 15:09:28 +00:00
|
|
|
description: 'Blob mode in numeric format.'
|
2020-12-01 12:09:17 +00:00
|
|
|
|
|
|
|
def lfs_oid
|
|
|
|
Gitlab::Graphql::Loaders::BatchLfsOidLoader.new(object.repository, object.id).find
|
|
|
|
end
|
2019-05-22 11:43:35 +00:00
|
|
|
end
|
2020-12-01 12:09:17 +00:00
|
|
|
# rubocop: enable Graphql/AuthorizeTypes
|
2019-05-22 11:43:35 +00:00
|
|
|
end
|
|
|
|
end
|