2018-09-11 15:08:34 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-05-23 03:55:14 -04:00
|
|
|
module Resolvers
|
|
|
|
module FullPathResolver
|
|
|
|
extend ActiveSupport::Concern
|
2018-02-23 10:36:40 -05:00
|
|
|
|
2018-05-23 03:55:14 -04:00
|
|
|
prepended do
|
|
|
|
argument :full_path, GraphQL::ID_TYPE,
|
|
|
|
required: true,
|
2019-09-18 10:02:45 -04:00
|
|
|
description: 'The full path of the project, group or namespace, e.g., "gitlab-org/gitlab-foss"'
|
2017-08-16 09:04:41 -04:00
|
|
|
end
|
|
|
|
|
2018-02-23 10:36:40 -05:00
|
|
|
def model_by_full_path(model, full_path)
|
2020-06-02 11:08:24 -04:00
|
|
|
::Gitlab::Graphql::Loaders::FullPathModelLoader.new(model, full_path).find
|
2018-02-23 10:36:40 -05:00
|
|
|
end
|
2017-08-16 09:04:41 -04:00
|
|
|
end
|
|
|
|
end
|