Endpoint for fingerprint deletion added
This commit is contained in:
parent
d5aa47ff54
commit
515dadb319
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
final class FingerprintDeleteController extends AbstractController
|
||||
{
|
||||
protected string $route = '/api/v1/fingerprint/{fingerprintId}';
|
||||
|
||||
private int $fingerprintId;
|
||||
|
||||
public function __construct(string $url)
|
||||
{
|
||||
parent::__construct($url);
|
||||
|
||||
$this->fingerprintId = (int)$this->getUrlParamInt('fingerprintId');
|
||||
}
|
||||
|
||||
public function handle(): void
|
||||
{
|
||||
parent::handle();
|
||||
|
||||
if ($this->response->getStatus() !== ServerStatus::OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$fingerprint = new Fingerprint($this->fingerprintId);
|
||||
$fingerprint->Delete();
|
||||
|
||||
$this->response = new ApiJsonResponse();
|
||||
} catch (Throwable $e) {
|
||||
$this->response = new ApiJsonResponse(ServerStatus::BAD_REQUEST);
|
||||
$this->response->setParameter('success', false);
|
||||
$this->response->setMessage($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue