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

blob_type.rb « repository « types « graphql « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 912fc5f643affbee51106c3ade0b86bdbf6c443f (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# frozen_string_literal: true
module Types
  module Repository
    # rubocop: disable Graphql/AuthorizeTypes
    # This is presented through `Repository` that has its own authorization
    class BlobType < BaseObject
      present_using BlobPresenter

      graphql_name 'RepositoryBlob'

      field :id, GraphQL::ID_TYPE, null: false,
            description: 'ID of the blob.'

      field :oid, GraphQL::STRING_TYPE, null: false, method: :id,
            description: 'OID of the blob.'

      field :path, GraphQL::STRING_TYPE, null: false,
            description: 'Path of the blob.'

      field :name, GraphQL::STRING_TYPE,
            description: 'Blob name.',
            null: true

      field :mode, type: GraphQL::STRING_TYPE,
            description: 'Blob mode.',
            null: true

      field :lfs_oid, GraphQL::STRING_TYPE, null: true,
            calls_gitaly: true,
            description: 'LFS OID of the blob.'

      field :web_path, GraphQL::STRING_TYPE, null: true,
            description: 'Web path of the blob.'

      def lfs_oid
        Gitlab::Graphql::Loaders::BatchLfsOidLoader.new(object.repository, object.id).find
      end
    end
  end
end