summaryrefslogtreecommitdiff
path: root/app/graphql/resolvers/projects_resolver.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-05-20 14:34:42 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-05-20 14:34:42 +0000
commit9f46488805e86b1bc341ea1620b866016c2ce5ed (patch)
treef9748c7e287041e37d6da49e0a29c9511dc34768 /app/graphql/resolvers/projects_resolver.rb
parentdfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff)
downloadgitlab-ce-9f46488805e86b1bc341ea1620b866016c2ce5ed.tar.gz
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'app/graphql/resolvers/projects_resolver.rb')
-rw-r--r--app/graphql/resolvers/projects_resolver.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/app/graphql/resolvers/projects_resolver.rb b/app/graphql/resolvers/projects_resolver.rb
new file mode 100644
index 00000000000..068546cd39f
--- /dev/null
+++ b/app/graphql/resolvers/projects_resolver.rb
@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+
+module Resolvers
+ class ProjectsResolver < BaseResolver
+ type Types::ProjectType, null: true
+
+ argument :membership, GraphQL::BOOLEAN_TYPE,
+ required: false,
+ description: 'Limit projects that the current user is a member of'
+
+ argument :search, GraphQL::STRING_TYPE,
+ required: false,
+ description: 'Search criteria'
+
+ def resolve(**args)
+ ProjectsFinder
+ .new(current_user: current_user, params: project_finder_params(args))
+ .execute
+ end
+
+ private
+
+ def project_finder_params(params)
+ {
+ without_deleted: true,
+ non_public: params[:membership],
+ search: params[:search]
+ }.compact
+ end
+ end
+end