1
0
Fork 0
nc_ext_dav_push/lib/Controller/SubscriptionController.php

43 lines
932 B
PHP
Raw Permalink Normal View History

<?php
namespace OCA\DavPush\Controller;
use OCA\DavPush\AppInfo\Application;
use OCA\DavPush\Service\SubscriptionService;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\JSONResponse;
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
use OCP\IRequest;
class SubscriptionController extends Controller {
/** @var SubscriptionService */
private $service;
/** @var string */
private $userId;
use Errors;
public function __construct(
IRequest $request,
SubscriptionService $service,
$userId
) {
parent::__construct(Application::APP_ID, $request);
$this->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,
];
});
}
}