mirror of
https://github.com/Karaka-Management/oms-Notification.git
synced 2026-01-11 16:18:40 +00:00
code fixes
This commit is contained in:
parent
155b1ca196
commit
5b43c81993
|
|
@ -14,10 +14,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\Notification\Admin;
|
||||
|
||||
use phpOMS\Application\ApplicationAbstract;
|
||||
use phpOMS\Config\SettingsInterface;
|
||||
use phpOMS\Module\InstallerAbstract;
|
||||
use phpOMS\Module\ModuleInfo;
|
||||
|
||||
/**
|
||||
* Installer class.
|
||||
|
|
@ -36,12 +33,4 @@ final class Installer extends InstallerAbstract
|
|||
* @since 1.0.0
|
||||
*/
|
||||
public const PATH = __DIR__;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function install(ApplicationAbstract $app, ModuleInfo $info, SettingsInterface $cfgHandler) : void
|
||||
{
|
||||
parent::install($app, $info, $cfgHandler);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,6 +47,8 @@ final class ApiController extends Controller
|
|||
public function apiNotificationSeenCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
|
||||
{
|
||||
$now = new \DateTimeImmutable('now');
|
||||
|
||||
/** @var \Modules\Notification\Models\Notification[] $notifications */
|
||||
$notifications = NotificationMapper::getAll()
|
||||
->where('createdFor', $request->header->account)
|
||||
->where('seenAt', null)
|
||||
|
|
@ -55,7 +57,7 @@ final class ApiController extends Controller
|
|||
->execute();
|
||||
|
||||
foreach ($notifications as $notification) {
|
||||
$new = clone $notification;
|
||||
$new = clone $notification;
|
||||
$new->seenAt = $now;
|
||||
|
||||
$this->updateModel($request->header->account, $notification, $new, NotificationMapper::class, 'notification', $request->getOrigin());
|
||||
|
|
@ -79,7 +81,7 @@ final class ApiController extends Controller
|
|||
*/
|
||||
public function apiNotificationsGet(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
|
||||
{
|
||||
$now = new \DateTimeImmutable('now');
|
||||
$now = new \DateTimeImmutable('now');
|
||||
$notifications = NotificationMapper::getAll()
|
||||
->where('createdFor', $request->header->account)
|
||||
->where('seenAt', null)
|
||||
|
|
|
|||
|
|
@ -131,9 +131,9 @@ class Notification implements \JsonSerializable
|
|||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->createdBy = new NullAccount();
|
||||
$this->createdBy = new NullAccount();
|
||||
$this->createdFor = new NullAccount();
|
||||
$this->createdAt = new \DateTimeImmutable('now');
|
||||
$this->createdAt = new \DateTimeImmutable('now');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -43,14 +43,14 @@ final class NotificationMapper extends DataMapperFactory
|
|||
'notification_desc_raw' => ['name' => 'notification_desc_raw', 'type' => 'string', 'internal' => 'descriptionRaw'],
|
||||
'notification_type' => ['name' => 'notification_type', 'type' => 'int', 'internal' => 'type'],
|
||||
'notification_status' => ['name' => 'notification_status', 'type' => 'int', 'internal' => 'status'],
|
||||
'notification_module' => ['name' => 'notification_module', 'type' => 'string', 'internal' => 'module'],
|
||||
'notification_category' => ['name' => 'notification_category', 'type' => 'int', 'internal' => 'category'],
|
||||
'notification_element' => ['name' => 'notification_element', 'type' => 'int', 'internal' => 'element'],
|
||||
'notification_module' => ['name' => 'notification_module', 'type' => 'string', 'internal' => 'module'],
|
||||
'notification_category' => ['name' => 'notification_category', 'type' => 'int', 'internal' => 'category'],
|
||||
'notification_element' => ['name' => 'notification_element', 'type' => 'int', 'internal' => 'element'],
|
||||
'notification_redirect' => ['name' => 'notification_redirect', 'type' => 'string', 'internal' => 'redirect'],
|
||||
'notification_created_by' => ['name' => 'notification_created_by', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true],
|
||||
'notification_for' => ['name' => 'notification_for', 'type' => 'int', 'internal' => 'createdFor'],
|
||||
'notification_created_at' => ['name' => 'notification_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true],
|
||||
'notification_seen_at' => ['name' => 'notification_seen_at', 'type' => 'DateTimeImmutable', 'internal' => 'seenAt'],
|
||||
'notification_seen_at' => ['name' => 'notification_seen_at', 'type' => 'DateTimeImmutable', 'internal' => 'seenAt'],
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -13,5 +13,5 @@
|
|||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'Notifications' => 'Notifications',
|
||||
'Notifications' => 'Notifications',
|
||||
]];
|
||||
|
|
|
|||
|
|
@ -13,13 +13,13 @@
|
|||
declare(strict_types=1);
|
||||
|
||||
return ['Notification' => [
|
||||
'Notifications' => 'Nachrichten',
|
||||
'Title' => 'Titel',
|
||||
'Date' => 'Datum',
|
||||
'Notifications' => 'Nachrichten',
|
||||
'Title' => 'Titel',
|
||||
'Date' => 'Datum',
|
||||
':status-text-1' => 'Neues %s Element erstellt',
|
||||
':status-text-2' => '%s Element upgedated',
|
||||
':status-text-3' => 'Neues Element zu %s hinzugefügt',
|
||||
':status-1' => 'Neu',
|
||||
':status-2' => 'Update',
|
||||
':status-3' => 'Update',
|
||||
]];
|
||||
':status-1' => 'Neu',
|
||||
':status-2' => 'Update',
|
||||
':status-3' => 'Update',
|
||||
]];
|
||||
|
|
|
|||
|
|
@ -13,14 +13,14 @@
|
|||
declare(strict_types=1);
|
||||
|
||||
return ['Notification' => [
|
||||
'Notifications' => 'Notifications',
|
||||
'Title' => 'Title',
|
||||
'Date' => 'Date',
|
||||
'MarkSeen' => 'Mark Seen',
|
||||
'Notifications' => 'Notifications',
|
||||
'Title' => 'Title',
|
||||
'Date' => 'Date',
|
||||
'MarkSeen' => 'Mark Seen',
|
||||
':status-text-1' => 'New %s element created',
|
||||
':status-text-2' => '%s element updated',
|
||||
':status-text-3' => 'New element added to %s',
|
||||
':status-1' => 'New',
|
||||
':status-2' => 'Update',
|
||||
':status-3' => 'Update',
|
||||
]];
|
||||
':status-1' => 'New',
|
||||
':status-2' => 'Update',
|
||||
':status-3' => 'Update',
|
||||
]];
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user