|
|
@ -11,7 +11,6 @@ use IQBall\Core\Http\HttpResponse;
|
|
|
|
use IQBall\Core\Http\JsonHttpResponse;
|
|
|
|
use IQBall\Core\Http\JsonHttpResponse;
|
|
|
|
use IQBall\Core\Validation\DefaultValidators;
|
|
|
|
use IQBall\Core\Validation\DefaultValidators;
|
|
|
|
use IQBall\Core\Model\AuthModel;
|
|
|
|
use IQBall\Core\Model\AuthModel;
|
|
|
|
use IQBall\Core\Validation\FieldValidationFail;
|
|
|
|
|
|
|
|
use IQBall\Core\Validation\ValidationFail;
|
|
|
|
use IQBall\Core\Validation\ValidationFail;
|
|
|
|
|
|
|
|
|
|
|
|
class APIAccountsController {
|
|
|
|
class APIAccountsController {
|
|
|
@ -35,8 +34,9 @@ class APIAccountsController {
|
|
|
|
return Control::runCheckedFrom($request, [
|
|
|
|
return Control::runCheckedFrom($request, [
|
|
|
|
'start' => [DefaultValidators::isUnsignedInteger()],
|
|
|
|
'start' => [DefaultValidators::isUnsignedInteger()],
|
|
|
|
'n' => [DefaultValidators::isUnsignedInteger()],
|
|
|
|
'n' => [DefaultValidators::isUnsignedInteger()],
|
|
|
|
|
|
|
|
'search' => [DefaultValidators::lenBetween(0, 256)],
|
|
|
|
], function (HttpRequest $req) {
|
|
|
|
], function (HttpRequest $req) {
|
|
|
|
$accounts = $this->accounts->listAccounts(intval($req['start']), intval($req['n']));
|
|
|
|
$accounts = $this->accounts->searchAccounts(intval($req['start']), intval($req['n']), $req["search"]);
|
|
|
|
$users = array_map(fn(Account $acc) => $acc->getUser(), $accounts);
|
|
|
|
$users = array_map(fn(Account $acc) => $acc->getUser(), $accounts);
|
|
|
|
return new JsonHttpResponse([
|
|
|
|
return new JsonHttpResponse([
|
|
|
|
"users" => $users,
|
|
|
|
"users" => $users,
|
|
|
|