Welcome to mirror list, hosted at ThFree Co, Russian Federation.

project_search_arguments.rb « concerns « resolvers « graphql « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7e03963f412c066760ef937b293713839f1c04e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# frozen_string_literal: true

module ProjectSearchArguments
  extend ActiveSupport::Concern

  included do
    argument :membership, GraphQL::Types::Boolean,
             required: false,
             description: 'Return only projects that the current user is a member of.'

    argument :search, GraphQL::Types::String,
             required: false,
             description: 'Search query, which can be for the project name, a path, or a description.'

    argument :search_namespaces, GraphQL::Types::Boolean,
             required: false,
             description: 'Include namespace in project search.'

    argument :topics, type: [GraphQL::Types::String],
                      required: false,
                      description: 'Filter projects by topics.'
  end

  private

  def project_finder_params(params)
    {
      without_deleted: true,
      non_public: params[:membership],
      search: params[:search],
      search_namespaces: params[:search_namespaces],
      sort: params[:sort],
      topic: params[:topics]
    }.compact
  end
end