Class: Types::Packages::PackageBaseType
- Inherits:
-
BaseObject
- Object
- GraphQL::Schema::Object
- BaseObject
- Types::Packages::PackageBaseType
- Defined in:
- app/graphql/types/packages/package_base_type.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#metadata ⇒ Object
NOTE: This method must be kept in sync with the union type: ‘Types::Packages::MetadataType`.
- #project ⇒ Object
- #protection_rule_exists ⇒ Object
Methods inherited from BaseObject
accepts, assignable?, authorization, authorization_scopes, authorize, authorized?, #current_user, #id
Methods included from Gitlab::Graphql::Present
Instance Method Details
#metadata ⇒ Object
NOTE: This method must be kept in sync with the union type: ‘Types::Packages::MetadataType`.
‘Types::Packages::MetadataType.resolve_type(metadata, ctx)` must never raise. rubocop: disable GraphQL/ResolverMethodLength
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'app/graphql/types/packages/package_base_type.rb', line 56 def case object.package_type when 'composer' object. when 'conan' object. when 'maven' object. when 'nuget' object. when 'pypi' object. when 'terraform_module' object. end end |
#project ⇒ Object
35 36 37 |
# File 'app/graphql/types/packages/package_base_type.rb', line 35 def project Gitlab::Graphql::Loaders::BatchModelLoader.new(Project, object.project_id).find end |
#protection_rule_exists ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 |
# File 'app/graphql/types/packages/package_base_type.rb', line 39 def protection_rule_exists object_package_type_value = ::Packages::Package.package_types[object.package_type] BatchLoader::GraphQL.for([object.name, object_package_type_value]).batch do |inputs, loader| ::Packages::Protection::Rule .for_push_exists_for_multiple_packages( package_names: inputs.map(&:first), package_types: inputs.map(&:last), project_id: object.project_id ) .each { |row| loader.call([row['package_name'], row['package_type']], row['protected']) } end end |