Add search to API endpoints

This commit is contained in:
Dane Everitt 2018-02-07 21:33:44 -06:00
parent 9fd17db103
commit 2e693067b8
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53
4 changed files with 6 additions and 3 deletions

View File

@ -8,6 +8,9 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
* `[rc.2]` — Fixes bad API behavior on `/user` routes. * `[rc.2]` — Fixes bad API behavior on `/user` routes.
* `[rc.2]` — Fixes Admin CP user editing resetting a password on users unintentionally. * `[rc.2]` — Fixes Admin CP user editing resetting a password on users unintentionally.
### Added
* Added ability to search the following API endpoints: list users, list servers, and list locations.
## v0.7.0-rc.2 (Derelict Dermodactylus) ## v0.7.0-rc.2 (Derelict Dermodactylus)
### Fixed ### Fixed
* `[rc.1]` — Fixes exception thrown when revoking user sessions. * `[rc.1]` — Fixes exception thrown when revoking user sessions.

View File

@ -67,7 +67,7 @@ class LocationController extends ApplicationApiController
*/ */
public function index(GetLocationsRequest $request): array public function index(GetLocationsRequest $request): array
{ {
$locations = $this->repository->paginated(100); $locations = $this->repository->setSearchTerm($request->input('search'))->paginated(50);
return $this->fractal->collection($locations) return $this->fractal->collection($locations)
->transformWith($this->getTransformer(LocationTransformer::class)) ->transformWith($this->getTransformer(LocationTransformer::class))

View File

@ -69,7 +69,7 @@ class NodeController extends ApplicationApiController
*/ */
public function index(GetNodesRequest $request): array public function index(GetNodesRequest $request): array
{ {
$nodes = $this->repository->paginated(50); $nodes = $this->repository->setSearchTerm($request->input('search'))->paginated(50);
return $this->fractal->collection($nodes) return $this->fractal->collection($nodes)
->transformWith($this->getTransformer(NodeTransformer::class)) ->transformWith($this->getTransformer(NodeTransformer::class))

View File

@ -70,7 +70,7 @@ class UserController extends ApplicationApiController
*/ */
public function index(GetUsersRequest $request): array public function index(GetUsersRequest $request): array
{ {
$users = $this->repository->paginated(100); $users = $this->repository->setSearchTerm($request->input('search'))->paginated(50);
return $this->fractal->collection($users) return $this->fractal->collection($users)
->transformWith($this->getTransformer(UserTransformer::class)) ->transformWith($this->getTransformer(UserTransformer::class))