summaryrefslogtreecommitdiff
path: root/app/graphql/types/dependency_proxy/manifest_type.rb
blob: ab22f540f48a890052bfa1f1103e925e972f6eb8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

module Types
  class DependencyProxy::ManifestType < BaseObject
    graphql_name 'DependencyProxyManifest'

    description 'Dependency proxy manifest'

    authorize :read_dependency_proxy

    field :created_at, Types::TimeType, null: false, description: 'Date of creation.'
    field :digest, GraphQL::Types::String, null: false, description: 'Digest of the manifest.'
    field :file_name, GraphQL::Types::String, null: false, description: 'Name of the manifest.'
    field :id, ::Types::GlobalIDType[::DependencyProxy::Manifest], null: false, description: 'ID of the manifest.'
    field :image_name, GraphQL::Types::String, null: false, description: 'Name of the image.'
    field :size, GraphQL::Types::String, null: false, description: 'Size of the manifest file.'
    field :updated_at, Types::TimeType, null: false, description: 'Date of most recent update.'

    def image_name
      object.file_name.chomp(File.extname(object.file_name))
    end
  end
end