mirror of
https://github.com/nextcloud/server.git
synced 2026-06-13 18:50:47 -04:00
enh: use datetime
Signed-off-by: Christopher Ng <chrng8@gmail.com>
This commit is contained in:
parent
c8a32a70cd
commit
163b059c11
4 changed files with 9 additions and 8 deletions
|
|
@ -26,7 +26,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\FilesReminders\Command;
|
||||
|
||||
use DateTime;
|
||||
use DateTimeInterface;
|
||||
use OC\Core\Command\Base;
|
||||
use OCA\FilesReminders\Model\RichReminder;
|
||||
|
|
@ -81,7 +80,7 @@ class ListCommand extends Base {
|
|||
fn (RichReminder $reminder) => [
|
||||
$reminder->getUserId(),
|
||||
$reminder->getNode()->getPath(),
|
||||
DateTime::createFromFormat('U', (string)$reminder->getRemindAt())->format(DateTimeInterface::ATOM), // ISO 8601
|
||||
$reminder->getRemindAt()->format(DateTimeInterface::ATOM), // ISO 8601
|
||||
$reminder->getNotified() ? 'true' : 'false',
|
||||
],
|
||||
$reminders,
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\FilesReminders\Db;
|
||||
|
||||
use DateTime;
|
||||
use OCP\AppFramework\Db\Entity;
|
||||
|
||||
/**
|
||||
|
|
@ -35,8 +36,8 @@ use OCP\AppFramework\Db\Entity;
|
|||
* @method void setFileId(int $fileId)
|
||||
* @method int getFileId()
|
||||
*
|
||||
* @method void setRemindAt(int $remindAt)
|
||||
* @method int getRemindAt()
|
||||
* @method void setRemindAt(DateTime $remindAt)
|
||||
* @method DateTime getRemindAt()
|
||||
*
|
||||
* @method void setNotified(bool $notified)
|
||||
* @method bool getNotified()
|
||||
|
|
@ -50,7 +51,7 @@ class Reminder extends Entity {
|
|||
public function __construct() {
|
||||
$this->addType('userId', 'string');
|
||||
$this->addType('fileId', 'integer');
|
||||
$this->addType('remindAt', 'integer');
|
||||
$this->addType('remindAt', 'datetime');
|
||||
$this->addType('notified', 'boolean');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,9 +55,10 @@ class Version10000Date20230725162149 extends SimpleMigrationStep {
|
|||
$table->addColumn('file_id', Types::BIGINT, [
|
||||
'notnull' => true,
|
||||
'length' => 20,
|
||||
'unsigned' => true,
|
||||
]);
|
||||
$table->addColumn('remind_at', Types::BIGINT, [
|
||||
'notnull' => true,
|
||||
$table->addColumn('remind_at', Types::DATETIME, [
|
||||
'notnull' => false,
|
||||
]);
|
||||
$table->addColumn('notified', Types::BOOLEAN, [
|
||||
'notnull' => false,
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ class ReminderService {
|
|||
->setUser($user->getUID())
|
||||
->setObject('reminder', (string)$reminder->getId())
|
||||
->setSubject('reminder-due')
|
||||
->setDateTime(DateTime::createFromFormat('U', (string)$reminder->getRemindAt()));
|
||||
->setDateTime($reminder->getRemindAt());
|
||||
|
||||
try {
|
||||
$this->notificationManager->notify($notification);
|
||||
|
|
|
|||
Loading…
Reference in a new issue