debian-mirror-gitlab/app/graphql/resolvers/members_resolver.rb

39 lines
854 B
Ruby
Raw Normal View History

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
2021-10-27 15:23:28 +05:30
argument :search, GraphQL::Types::String,
2020-11-24 15:15:51 +05:30
required: false,
2021-03-08 18:12:59 +05:30
description: 'Search query.'
2020-11-24 15:15:51 +05:30
2022-10-11 01:57:18 +05:30
argument :sort, ::Types::MemberSortEnum,
required: false,
description: 'sort 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
2021-04-29 21:17:54 +05:30
def preloads
{
user: [:user, :source]
}
end
2020-11-24 15:15:51 +05:30
def finder_class
# override in subclass
end
end
end