2021-10-27 15:23:28 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Resolvers
|
|
|
|
class GroupsResolver < BaseResolver
|
2021-12-11 22:18:48 +05:30
|
|
|
include ResolvesGroups
|
|
|
|
|
2023-04-23 21:23:45 +05:30
|
|
|
type "Types::GroupConnection", null: true
|
2021-10-27 15:23:28 +05:30
|
|
|
|
|
|
|
argument :search, GraphQL::Types::String,
|
|
|
|
required: false,
|
|
|
|
description: 'Search query for group name or group full path.'
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
# rubocop: disable CodeReuse/ActiveRecord
|
2023-04-23 21:23:45 +05:30
|
|
|
def resolve_groups(**args)
|
2021-10-27 15:23:28 +05:30
|
|
|
GroupsFinder
|
2023-04-23 21:23:45 +05:30
|
|
|
.new(context[:current_user], args)
|
2021-10-27 15:23:28 +05:30
|
|
|
.execute
|
2022-06-21 17:19:12 +05:30
|
|
|
.reorder(name: :asc)
|
2021-10-27 15:23:28 +05:30
|
|
|
end
|
|
|
|
# rubocop: enable CodeReuse/ActiveRecord
|
|
|
|
end
|
|
|
|
end
|