Fixes for controllers
This commit is contained in:
parent
3a99e99130
commit
f4fdf50288
@ -5,6 +5,9 @@ declare(strict_types=1);
|
||||
final class FingerprintPutController extends AbstractController
|
||||
{
|
||||
protected string $route = '/api/v1/fingerprint/{fingerprintId}';
|
||||
protected array $mandatoryAttributes = [
|
||||
'fingerprint',
|
||||
];
|
||||
|
||||
private int $fingerprintId;
|
||||
|
||||
|
@ -17,9 +17,15 @@ final class UserGetController extends AbstractController
|
||||
|
||||
public function handle(): void
|
||||
{
|
||||
$user = new User($this->userId);
|
||||
$this->response = new ApiJsonResponse();
|
||||
|
||||
$this->response = new ApiJsonResponse();
|
||||
$this->response->setResult($user);
|
||||
try {
|
||||
$user = new User($this->userId);
|
||||
$this->response->setResult($user);
|
||||
} catch (Throwable $e) {
|
||||
$this->response->setParameter('success', false);
|
||||
$this->response->setStatus($e->getCode() !== 0 ? $e->getCode() : ServerStatus::INTERNAL_ERROR);
|
||||
$this->response->setMessage($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user