2020-11-24 15:15:51 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Resolvers
|
|
|
|
class MembersResolver < BaseResolver
|
|
|
|
include Gitlab::Graphql::Authorize::AuthorizeResource
|
|
|
|
include LooksAhead
|
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
type Types::MemberInterface.connection_type, null: true
|
|
|
|
|
2020-11-24 15:15:51 +05:30
|
|
|
argument :search, GraphQL::STRING_TYPE,
|
|
|
|
required: false,
|
2021-03-08 18:12:59 +05:30
|
|
|
description: 'Search query.'
|
2020-11-24 15:15:51 +05:30
|
|
|
|
|
|
|
def resolve_with_lookahead(**args)
|
|
|
|
authorize!(object)
|
|
|
|
|
2021-02-22 17:27:13 +05:30
|
|
|
relations = args.delete(:relations)
|
|
|
|
|
|
|
|
apply_lookahead(finder_class.new(object, current_user, params: args).execute(include_relations: relations))
|
2020-11-24 15:15:51 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def finder_class
|
|
|
|
# override in subclass
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|