diff --git a/appinfo/routes.php b/appinfo/routes.php index b9eca4d..386e253 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -7,5 +7,6 @@ return [ 'resources' => [ ], 'routes' => [ + ['name' => 'subscription#destroy', 'url' => '/subscriptions/{id}', 'verb' => 'DELETE'] ] ]; \ No newline at end of file diff --git a/lib/Controller/SubscriptionController.php b/lib/Controller/SubscriptionController.php new file mode 100644 index 0000000..6a7798d --- /dev/null +++ b/lib/Controller/SubscriptionController.php @@ -0,0 +1,43 @@ +service = $service; + $this->userId = $userId; + } + + #[NoAdminRequired] + #[NoCSRFRequired] + public function destroy(int $id): JSONResponse { + return $this->handleNotFound(function () use ($id) { + $this->service->delete($this->userId, $id); + return [ + 'success' => True, + ]; + }); + } +} \ No newline at end of file