Skip to content

Commit 2e69306

Browse files
committed
Add search to API endpoints
1 parent 9fd17db commit 2e69306

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
88
* `[rc.2]` — Fixes bad API behavior on `/user` routes.
99
* `[rc.2]` — Fixes Admin CP user editing resetting a password on users unintentionally.
1010

11+
### Added
12+
* Added ability to search the following API endpoints: list users, list servers, and list locations.
13+
1114
## v0.7.0-rc.2 (Derelict Dermodactylus)
1215
### Fixed
1316
* `[rc.1]` — Fixes exception thrown when revoking user sessions.

app/Http/Controllers/Api/Application/Locations/LocationController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function __construct(
6767
*/
6868
public function index(GetLocationsRequest $request): array
6969
{
70-
$locations = $this->repository->paginated(100);
70+
$locations = $this->repository->setSearchTerm($request->input('search'))->paginated(50);
7171

7272
return $this->fractal->collection($locations)
7373
->transformWith($this->getTransformer(LocationTransformer::class))

app/Http/Controllers/Api/Application/Nodes/NodeController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function __construct(
6969
*/
7070
public function index(GetNodesRequest $request): array
7171
{
72-
$nodes = $this->repository->paginated(50);
72+
$nodes = $this->repository->setSearchTerm($request->input('search'))->paginated(50);
7373

7474
return $this->fractal->collection($nodes)
7575
->transformWith($this->getTransformer(NodeTransformer::class))

app/Http/Controllers/Api/Application/Users/UserController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function __construct(
7070
*/
7171
public function index(GetUsersRequest $request): array
7272
{
73-
$users = $this->repository->paginated(100);
73+
$users = $this->repository->setSearchTerm($request->input('search'))->paginated(50);
7474

7575
return $this->fractal->collection($users)
7676
->transformWith($this->getTransformer(UserTransformer::class))

0 commit comments

Comments
 (0)