Welcome to mirror list, hosted at ThFree Co, Russian Federation.

blob_type.rb « tree « types « graphql « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 36cae756a0d2ac2bfc20bc36d4cba757cdb1c708 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# 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,
            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
      field :mode, GraphQL::STRING_TYPE, null: true,
            description: 'Blob mode in numeric format'
      # rubocop: enable Graphql/AuthorizeTypes
    end
  end
end