Commit 66613f1a authored by Robert Speicher's avatar Robert Speicher

Merge branch 'zj-grape-sessions' into 'master'

GrapeDSL for Namespace endpoint

No changelog item as it doesn't change behaviour

Cherry-picked from !6330

See merge request !6632
parents 77de91e1 d6e42e0c
...@@ -4,20 +4,18 @@ module API ...@@ -4,20 +4,18 @@ module API
before { authenticate! } before { authenticate! }
resource :namespaces do resource :namespaces do
# Get a namespaces list desc 'Get a namespaces list' do
# success Entities::Namespace
# Example Request: end
# GET /namespaces params do
optional :search, type: String, desc: "Search query for namespaces"
end
get do get do
@namespaces = if current_user.admin namespaces = current_user.admin ? Namespace.all : current_user.namespaces
Namespace.all
else namespaces = namespaces.search(params[:search]) if params[:search].present?
current_user.namespaces
end
@namespaces = @namespaces.search(params[:search]) if params[:search].present?
@namespaces = paginate @namespaces
present @namespaces, with: Entities::Namespace present paginate(namespaces), with: Entities::Namespace
end end
end end
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