mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-18 02:03:40 +00:00
Add limit param to all endpoints
This commit is contained in:
@@ -49,7 +49,6 @@ use Symfony\Component\HttpFoundation\ParameterBag;
|
||||
class Controller extends BaseController
|
||||
{
|
||||
protected const CONTENT_TYPE = 'application/vnd.api+json';
|
||||
protected int $pageSize;
|
||||
protected ParameterBag $parameters;
|
||||
|
||||
/**
|
||||
@@ -58,10 +57,6 @@ class Controller extends BaseController
|
||||
public function __construct()
|
||||
{
|
||||
$this->parameters = $this->getParameters();
|
||||
$this->pageSize = 50;
|
||||
if (auth()->check()) {
|
||||
$this->pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -129,6 +124,11 @@ class Controller extends BaseController
|
||||
if (null !== $value) {
|
||||
$bag->set($integer, (int)$value);
|
||||
}
|
||||
if (null === $value && 'limit' === $integer) {
|
||||
// set default for user:
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$bag->set($integer, $pageSize);
|
||||
}
|
||||
}
|
||||
|
||||
// sort fields:
|
||||
|
Reference in New Issue
Block a user