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

fix new API endpoint

parent b3b89ec0
......@@ -164,14 +164,14 @@ class GeoNode < ActiveRecord::Base
end
end
def project_registries_by(type: nil)
def filtered_project_registries(type = nil)
case type
when 'repository'
project_registries.failed_repos
when 'wiki'
project_registries.failed_repos
project_registries.failed_wikis
else
project_registries
project_registries.failed
end
end
......
......@@ -87,10 +87,10 @@ module API
end
params do
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
end
get ':id/failures/:type' do
get ':id/failures' do
unless Gitlab::Geo.current_node.id == params[:id]
forbidden!('Geo node is not the current node.')
end
......@@ -99,7 +99,7 @@ module API
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
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