summaryrefslogtreecommitdiff
path: root/app/graphql/resolvers/full_path_resolver.rb
blob: d01cdf749a1e8d8f8a55a2728de26b7216eea9ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

module Resolvers
  module FullPathResolver
    extend ActiveSupport::Concern

    prepended do
      argument :full_path, GraphQL::ID_TYPE,
               required: true,
               description: 'The full path of the project, group or namespace, e.g., "gitlab-org/gitlab-foss".'
    end

    def model_by_full_path(model, full_path)
      ::Gitlab::Graphql::Loaders::FullPathModelLoader.new(model, full_path).find
    end
  end
end