Commit fcf90d05 authored by Alexis Reigel's avatar Alexis Reigel

un-dry the search api scope

due to the usage in EE this attempt to more DRYness is not worth it.
parent b0981097
...@@ -58,15 +58,6 @@ module API ...@@ -58,15 +58,6 @@ module API
render_api_error!({ error: _("Scope not supported with disabled 'users_search' feature!") }, 400) render_api_error!({ error: _("Scope not supported with disabled 'users_search' feature!") }, 400)
end end
end end
params :scope do |options|
values = SCOPE_ENTITY.stringify_keys.slice(*options[:values]).keys
requires :scope,
type: String,
desc: 'The scope of the search',
values: values
end
end end
resource :search do resource :search do
...@@ -75,7 +66,10 @@ module API ...@@ -75,7 +66,10 @@ module API
end end
params do params do
requires :search, type: String, desc: 'The expression it should be searched for' requires :search, type: String, desc: 'The expression it should be searched for'
use :scope, values: Helpers::SearchHelpers.global_search_scopes requires :scope,
type: String,
desc: 'The scope of the search',
values: Helpers::SearchHelpers.global_search_scopes
use :pagination use :pagination
end end
get do get do
...@@ -93,7 +87,10 @@ module API ...@@ -93,7 +87,10 @@ module API
params do params do
requires :id, type: String, desc: 'The ID of a group' requires :id, type: String, desc: 'The ID of a group'
requires :search, type: String, desc: 'The expression it should be searched for' requires :search, type: String, desc: 'The expression it should be searched for'
use :scope, values: Helpers::SearchHelpers.group_search_scopes requires :scope,
type: String,
desc: 'The scope of the search',
values: Helpers::SearchHelpers.group_search_scopes
use :pagination use :pagination
end end
get ':id/(-/)search' do get ':id/(-/)search' do
...@@ -111,7 +108,10 @@ module API ...@@ -111,7 +108,10 @@ module API
params do params do
requires :id, type: String, desc: 'The ID of a project' requires :id, type: String, desc: 'The ID of a project'
requires :search, type: String, desc: 'The expression it should be searched for' requires :search, type: String, desc: 'The expression it should be searched for'
use :scope, Helpers::SearchHelpers.project_search_scopes requires :scope,
type: String,
desc: 'The scope of the search',
values: Helpers::SearchHelpers.project_search_scopes
use :pagination use :pagination
end end
get ':id/(-/)search' do get ':id/(-/)search' do
......
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