Update all remaining code pathways to use new search tooling

This commit is contained in:
Dane Everitt 2020-09-13 12:21:44 -07:00
parent 12fe3f1a4e
commit d8c338df3e
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
14 changed files with 54 additions and 305 deletions

View file

@ -5,6 +5,7 @@ namespace Pterodactyl\Http\Controllers\Api\Application\Servers;
use Illuminate\Http\Response;
use Pterodactyl\Models\Server;
use Illuminate\Http\JsonResponse;
use Spatie\QueryBuilder\QueryBuilder;
use Pterodactyl\Services\Servers\ServerCreationService;
use Pterodactyl\Services\Servers\ServerDeletionService;
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
@ -59,7 +60,10 @@ class ServerController extends ApplicationApiController
*/
public function index(GetServersRequest $request): array
{
$servers = $this->repository->setSearchTerm($request->input('search'))->paginated(50);
$servers = QueryBuilder::for(Server::query())
->allowedFilters(['uuid', 'name', 'image', 'external_id'])
->allowedSorts(['id', 'uuid'])
->paginate(100);
return $this->fractal->collection($servers)
->transformWith($this->getTransformer(ServerTransformer::class))