1# frozen_string_literal: true
2
3module Resolvers
4  module FullPathResolver
5    extend ActiveSupport::Concern
6
7    prepended do
8      argument :full_path, GraphQL::Types::ID,
9               required: true,
10               description: 'Full path of the project, group, or namespace. For example, `gitlab-org/gitlab-foss`.'
11    end
12
13    def model_by_full_path(model, full_path)
14      ::Gitlab::Graphql::Loaders::FullPathModelLoader.new(model, full_path).find
15    end
16  end
17end
18