2021-03-08 18:12:59 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Resolvers
|
|
|
|
class PackageDetailsResolver < BaseResolver
|
2022-10-11 01:57:18 +05:30
|
|
|
extension ::Gitlab::Graphql::Limit::FieldCallCount, limit: 1
|
|
|
|
|
2021-04-29 21:17:54 +05:30
|
|
|
type ::Types::Packages::PackageDetailsType, null: true
|
2021-03-11 19:13:27 +05:30
|
|
|
|
2021-03-08 18:12:59 +05:30
|
|
|
argument :id, ::Types::GlobalIDType[::Packages::Package],
|
|
|
|
required: true,
|
2021-11-11 11:23:49 +05:30
|
|
|
description: 'Global ID of the package.'
|
2021-03-08 18:12:59 +05:30
|
|
|
|
|
|
|
def resolve(id:)
|
2023-03-04 22:38:38 +05:30
|
|
|
Gitlab::Graphql::Lazy.with_value(find_object(id: id)) do |package|
|
|
|
|
package if package.default?
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def find_object(id:)
|
2021-03-08 18:12:59 +05:30
|
|
|
GitlabSchema.find_by_gid(id)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|