2021-11-09 13:13:13 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Resolvers
|
|
|
|
class TopicsResolver < BaseResolver
|
|
|
|
type Types::Projects::TopicType, null: true
|
|
|
|
|
|
|
|
argument :search, GraphQL::Types::String,
|
|
|
|
required: false,
|
|
|
|
description: 'Search query for topic name.'
|
|
|
|
|
|
|
|
def resolve(**args)
|
|
|
|
if args[:search].present?
|
2022-02-22 01:16:10 -05:00
|
|
|
::Projects::Topic.search(args[:search]).order_by_non_private_projects_count
|
2021-11-09 13:13:13 -05:00
|
|
|
else
|
2022-02-22 01:16:10 -05:00
|
|
|
::Projects::Topic.order_by_non_private_projects_count
|
2021-11-09 13:13:13 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|