debian-mirror-gitlab/app/graphql/resolvers/package_details_resolver.rb
2023-03-04 22:38:38 +05:30

25 lines
592 B
Ruby

# frozen_string_literal: true
module Resolvers
class PackageDetailsResolver < BaseResolver
extension ::Gitlab::Graphql::Limit::FieldCallCount, limit: 1
type ::Types::Packages::PackageDetailsType, null: true
argument :id, ::Types::GlobalIDType[::Packages::Package],
required: true,
description: 'Global ID of the package.'
def resolve(id:)
Gitlab::Graphql::Lazy.with_value(find_object(id: id)) do |package|
package if package.default?
end
end
private
def find_object(id:)
GitlabSchema.find_by_gid(id)
end
end
end