diff options
-rw-r--r-- | apps/files_reminders/lib/Model/RichReminder.php | 14 |
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(), + ]; + } } |