debian-mirror-gitlab/app/graphql/resolvers/achievements/user_achievements_resolver.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

34 lines
702 B
Ruby
Raw Normal View History

2023-05-27 22:25:52 +05:30
# frozen_string_literal: true
module Resolvers
module Achievements
class UserAchievementsResolver < BaseResolver
include LooksAhead
type ::Types::Achievements::UserAchievementType.connection_type, null: true
def resolve_with_lookahead
2023-07-09 08:55:56 +05:30
user_achievements = object.user_achievements.not_revoked.order_by_id_asc
2023-05-27 22:25:52 +05:30
apply_lookahead(user_achievements)
end
private
def unconditional_includes
[
{ achievement: [:namespace] }
]
end
def preloads
{
user: [:user],
awarded_by_user: [:awarded_by_user],
revoked_by_user: [:revoked_by_user]
}
end
end
end
end