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

resolves_project.rb « concerns « resolvers « graphql « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3c5ce3dab0154daaada89c0076f112768682ced9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# frozen_string_literal: true

module ResolvesProject
  def resolve_project(full_path: nil, project_id: nil)
    unless full_path.present? ^ project_id.present?
      raise ::Gitlab::Graphql::Errors::ArgumentError, 'Incompatible arguments: projectId, projectPath.'
    end

    if full_path.present?
      ::Gitlab::Graphql::Loaders::FullPathModelLoader.new(Project, full_path).find
    else
      ::GitlabSchema.object_from_id(project_id, expected_type: Project)
    end
  end
end