More actions implemented

This commit is contained in:
Dennis Eichhorn 2017-04-15 18:23:04 +02:00
parent 0f860d92f6
commit 069bb61312
2 changed files with 10 additions and 2 deletions

View File

@ -34,6 +34,14 @@ return [
],
],
// todo: the order of find and account is bad but needed for now. otherwise the admin/account.* also matches and we match two routes = bad
'^.*/api/admin/find/account.*$' => [
[
'dest' => '\Modules\Admin\Controller:apiAccountFind',
'verb' => RouteVerb::GET,
],
],
'^.*/api/admin/account.*$' => [
[
'dest' => '\Modules\Admin\Controller:apiAccountCreate',

View File

@ -359,10 +359,10 @@ class Controller extends ModuleAbstract implements WebInterface
$response->set('account', array_values(AccountMapper::getByRequest($request)));
}
public function apiAccountFind()
public function apiAccountFind(RequestAbstract $request, ResponseAbstract $response, $data = null)
{
$response->getHeader()->set('Content-Type', MimeType::M_JSON . '; charset=utf-8', true);
$response->set('account', array_values(AccountMapper::find($request->getData('search'))));
$response->set('account', array_values(AccountMapper::find($request->getData('search') ?? '')));
}
private function validateAccountCreate(RequestAbstract $request) : array