diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-10 00:09:22 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-10 00:09:22 +0300 |
commit | 017841e3c03105efd0b94e730652c5774f2c136f (patch) | |
tree | b2931e81db33138d3c32e058879a78635c0e2614 /app/graphql/types/packages/file_metadata_type.rb | |
parent | b19efd72743e22fd3b340b3c2906ba113e1390de (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/graphql/types/packages/file_metadata_type.rb')
-rw-r--r-- | app/graphql/types/packages/file_metadata_type.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/app/graphql/types/packages/file_metadata_type.rb b/app/graphql/types/packages/file_metadata_type.rb new file mode 100644 index 00000000000..46ccb424218 --- /dev/null +++ b/app/graphql/types/packages/file_metadata_type.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +module Types + module Packages + module FileMetadataType + include ::Types::BaseInterface + graphql_name 'PackageFileMetadata' + description 'Represents metadata associated with a Package file' + + field :created_at, ::Types::TimeType, null: false, description: 'Date of creation.' + field :updated_at, ::Types::TimeType, null: false, description: 'Date of most recent update.' + + def self.resolve_type(object, context) + case object + when ::Packages::Conan::FileMetadatum + ::Types::Packages::Conan::FileMetadatumType + else + # NOTE: This method must be kept in sync with `PackageFileType#file_metadata`, + # which must never produce data that this discriminator cannot handle. + raise 'Unsupported file metadata type' + end + end + + orphan_types Types::Packages::Conan::FileMetadatumType + end + end +end |