From 515dadb31915f22a512d1f10dcdb860cf2f94716 Mon Sep 17 00:00:00 2001 From: Mal <=> Date: Thu, 20 Aug 2020 15:58:00 +0200 Subject: [PATCH] Endpoint for fingerprint deletion added --- .../FingerprintDeleteController.php | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 backend/classes/controller/FingerprintDeleteController.php diff --git a/backend/classes/controller/FingerprintDeleteController.php b/backend/classes/controller/FingerprintDeleteController.php new file mode 100644 index 0000000..31ee4f0 --- /dev/null +++ b/backend/classes/controller/FingerprintDeleteController.php @@ -0,0 +1,37 @@ +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()); + } + } +} \ No newline at end of file