summaryrefslogtreecommitdiff
path: root/app/graphql/types/tree/blob_type.rb
blob: 9497e378dc0c21ca624897151fd04d48c97a47af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true
module Types
  module Tree
    # rubocop: disable Graphql/AuthorizeTypes
    # This is presented through `Repository` that has its own authorization
    class BlobType < BaseObject
      implements Types::Tree::EntryType

      present_using BlobPresenter

      graphql_name 'Blob'

      field :web_url, GraphQL::STRING_TYPE, null: true
      field :lfs_oid, GraphQL::STRING_TYPE, null: true, resolve: -> (blob, args, ctx) do
        Gitlab::Graphql::Loaders::BatchLfsOidLoader.new(blob.repository, blob.id).find
      end
      # rubocop: enable Graphql/AuthorizeTypes
    end
  end
end