aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Ng <chrng8@gmail.com>2023-07-31 12:10:50 -0700
committerChristopher Ng <chrng8@gmail.com>2023-08-03 15:30:11 -0700
commit774e3e6d4b9af4a6b329247561f6f85ce354f58d (patch)
treefba65d3adce8772d46d43f351fb5d3e06382ec34
parent4fabd7743230be80f82543edd4905ead97f14a59 (diff)
downloadnextcloud-server-774e3e6d4b9af4a6b329247561f6f85ce354f58d.tar.gz
nextcloud-server-774e3e6d4b9af4a6b329247561f6f85ce354f58d.zip
enh: implement JsonSerializable
Signed-off-by: Christopher Ng <chrng8@gmail.com>
-rw-r--r--apps/files_reminders/lib/Model/RichReminder.php14
1 files changed, 13 insertions, 1 deletions
diff --git a/apps/files_reminders/lib/Model/RichReminder.php b/apps/files_reminders/lib/Model/RichReminder.php
index 21b42d9c2e7..76c3d8dd22b 100644
--- a/apps/files_reminders/lib/Model/RichReminder.php
+++ b/apps/files_reminders/lib/Model/RichReminder.php
@@ -26,12 +26,14 @@ declare(strict_types=1);
namespace OCA\FilesReminders\Model;
+use DateTimeInterface;
+use JsonSerializable;
use OCA\FilesReminders\Db\Reminder;
use OCA\FilesReminders\Exception\NodeNotFoundException;
use OCP\Files\IRootFolder;
use OCP\Files\Node;
-class RichReminder extends Reminder {
+class RichReminder extends Reminder implements JsonSerializable {
public function __construct(
private Reminder $reminder,
private IRootFolder $root,
@@ -59,4 +61,14 @@ class RichReminder extends Reminder {
public function __call(string $methodName, array $args) {
return $this->reminder->__call($methodName, $args);
}
+
+ public function jsonSerialize(): array {
+ return [
+ 'userId' => $this->getUserId(),
+ 'fileId' => $this->getFileId(),
+ 'remindAt' => $this->getRemindAt()->format(DateTimeInterface::ATOM), // ISO 8601
+ 'createdAt' => $this->getCreatedAt()->format(DateTimeInterface::ATOM), // ISO 8601
+ 'notified' => $this->getNotified(),
+ ];
+ }
}