Commit 2660e83c authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Add group filtering by name for API

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent da9d8279
......@@ -19,6 +19,8 @@ GET /groups
]
```
You can search for groups by name or path with: `/groups?search=Rails`
## Details of a group
Get all details of a group.
......
......@@ -25,11 +25,14 @@ module API
# Example Request:
# GET /groups
get do
if current_user.admin
@groups = paginate Group
@groups = if current_user.admin
Group.all
else
@groups = paginate current_user.groups
current_user.groups
end
@groups = @groups.search(params[:search]) if params[:search].present?
@groups = paginate @groups
present @groups, with: Entities::Group
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