debian-mirror-gitlab/app/graphql/types/tree/blob_type.rb

24 lines
739 B
Ruby
Raw Normal View History

2019-09-04 21:01:54 +05:30
# frozen_string_literal: true
module Types
module Tree
2019-09-30 21:07:59 +05:30
# rubocop: disable Graphql/AuthorizeTypes
# This is presented through `Repository` that has its own authorization
2019-09-04 21:01:54 +05:30
class BlobType < BaseObject
implements Types::Tree::EntryType
present_using BlobPresenter
graphql_name 'Blob'
2020-03-13 15:44:24 +05:30
field :web_url, GraphQL::STRING_TYPE, null: true,
description: 'Web URL of the blob'
field :lfs_oid, GraphQL::STRING_TYPE, null: true,
description: 'LFS ID of the blob',
resolve: -> (blob, args, ctx) do
Gitlab::Graphql::Loaders::BatchLfsOidLoader.new(blob.repository, blob.id).find
end
2019-09-30 21:07:59 +05:30
# rubocop: enable Graphql/AuthorizeTypes
2019-09-04 21:01:54 +05:30
end
end
end