aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_reminders/lib/Controller/ApiController.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_reminders/lib/Controller/ApiController.php')
-rw-r--r--apps/files_reminders/lib/Controller/ApiController.php26
1 files changed, 21 insertions, 5 deletions
diff --git a/apps/files_reminders/lib/Controller/ApiController.php b/apps/files_reminders/lib/Controller/ApiController.php
index de69997f616..ddc34b16c6b 100644
--- a/apps/files_reminders/lib/Controller/ApiController.php
+++ b/apps/files_reminders/lib/Controller/ApiController.php
@@ -67,11 +67,7 @@ class ApiController extends OCSController {
];
return new JSONResponse($reminderData, Http::STATUS_OK);
} catch (DoesNotExistException $e) {
- // Return null when no reminder is found
- $reminderData = [
- 'dueDate' => null,
- ];
- return new JSONResponse($reminderData, Http::STATUS_OK);
+ return new JSONResponse([], Http::STATUS_NOT_FOUND);
} catch (Throwable $th) {
$this->logger->error($th->getMessage(), ['exception' => $th]);
return new JSONResponse([], Http::STATUS_INTERNAL_SERVER_ERROR);
@@ -104,4 +100,24 @@ class ApiController extends OCSController {
return new JSONResponse([], Http::STATUS_INTERNAL_SERVER_ERROR);
}
}
+
+ /**
+ * Remove a reminder
+ */
+ public function remove(int $fileId): JSONResponse {
+ $user = $this->userSession->getUser();
+ if ($user === null) {
+ return new JSONResponse([], Http::STATUS_UNAUTHORIZED);
+ }
+
+ try {
+ $this->reminderService->remove($user, $fileId);
+ return new JSONResponse([], Http::STATUS_OK);
+ } catch (DoesNotExistException $e) {
+ return new JSONResponse([], Http::STATUS_NOT_FOUND);
+ } catch (Throwable $th) {
+ $this->logger->error($th->getMessage(), ['exception' => $th]);
+ return new JSONResponse([], Http::STATUS_INTERNAL_SERVER_ERROR);
+ }
+ }
}