debian-mirror-gitlab/app/graphql/resolvers/achievements/achievements_resolver.rb
2023-05-27 22:25:52 +05:30

27 lines
629 B
Ruby

# frozen_string_literal: true
module Resolvers
module Achievements
class AchievementsResolver < BaseResolver
include LooksAhead
type ::Types::Achievements::AchievementType.connection_type, null: true
alias_method :namespace, :object
def resolve_with_lookahead
return ::Achievements::Achievement.none if Feature.disabled?(:achievements, namespace)
apply_lookahead(namespace.achievements)
end
private
def preloads
{
user_achievements: [{ user_achievements: [:user, :awarded_by_user, :revoked_by_user] }]
}
end
end
end
end