debian-mirror-gitlab/app/graphql/resolvers/projects_resolver.rb
2020-08-09 17:41:57 +05:30

31 lines
790 B
Ruby

# 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 query for project name, path, or description'
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