mirror of
https://github.com/grocy/grocy.git
synced 2025-08-13 01:06:23 +00:00
Removde the /objects/{entity}/search API endpoint, added the new filter capabilities to /objects/{entity} (references #985)
This commit is contained in:
@@ -135,7 +135,7 @@ class GenericEntityApiController extends BaseApiController
|
||||
|
||||
public function GetObjects(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
||||
{
|
||||
$objects = $this->getDatabase()->{$args['entity']}();
|
||||
$objects = $this->queryData($this->getDatabase()->{$args['entity']}(), $request->getQueryParams());
|
||||
$allUserfields = $this->getUserfieldsService()->GetAllValues($args['entity']);
|
||||
|
||||
foreach ($objects as $object)
|
||||
@@ -176,25 +176,6 @@ class GenericEntityApiController extends BaseApiController
|
||||
}
|
||||
}
|
||||
|
||||
public function SearchObjects(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
||||
{
|
||||
if ($this->IsValidEntity($args['entity']) && !$this->IsEntityWithPreventedListing($args['entity']))
|
||||
{
|
||||
try
|
||||
{
|
||||
return $this->FilteredApiResponse($response, $this->getDatabase()->{$args['entity']}(), $request->getQueryParams());
|
||||
}
|
||||
catch (\PDOException $ex)
|
||||
{
|
||||
throw new HttpBadRequestException($request, $ex->getMessage(), $ex);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->GenericErrorResponse($response, 'Entity does not exist or is not exposed');
|
||||
}
|
||||
}
|
||||
|
||||
public function SetUserfields(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
||||
{
|
||||
User::checkPermission($request, User::PERMISSION_MASTER_DATA_EDIT);
|
||||
|
Reference in New Issue
Block a user