Commit 36b6cac8 authored by James Lopez's avatar James Lopez

fix new API endpoint

parent b3b89ec0
...@@ -164,14 +164,14 @@ class GeoNode < ActiveRecord::Base ...@@ -164,14 +164,14 @@ class GeoNode < ActiveRecord::Base
end end
end end
def project_registries_by(type: nil) def filtered_project_registries(type = nil)
case type case type
when 'repository' when 'repository'
project_registries.failed_repos project_registries.failed_repos
when 'wiki' when 'wiki'
project_registries.failed_repos project_registries.failed_wikis
else else
project_registries project_registries.failed
end end
end end
......
...@@ -87,10 +87,10 @@ module API ...@@ -87,10 +87,10 @@ module API
end end
params do params do
requires :id, type: Integer, desc: 'The ID of the node' requires :id, type: Integer, desc: 'The ID of the node'
optional :type, type: String, desc: 'Type of failure (repository/wiki)' optional :type, type: String, values: %w[wiki repository], desc: 'Type of failure (repository/wiki)'
use :pagination use :pagination
end end
get ':id/failures/:type' do get ':id/failures' do
unless Gitlab::Geo.current_node.id == params[:id] unless Gitlab::Geo.current_node.id == params[:id]
forbidden!('Geo node is not the current node.') forbidden!('Geo node is not the current node.')
end end
...@@ -99,7 +99,7 @@ module API ...@@ -99,7 +99,7 @@ module API
not_found('Geo node not found') unless geo_node not_found('Geo node not found') unless geo_node
project_registries = geo_node.project_registries project_registries = paginate(geo_node.filtered_project_registries(params[:type]))
present project_registries, with: ::ProjectRegistryEntity present project_registries, with: ::ProjectRegistryEntity
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment