type fixes

This commit is contained in:
Yuri Kuznetsov
2021-11-04 10:59:48 +02:00
parent 9469b66c61
commit 17d2791d40
9 changed files with 106 additions and 38 deletions
+10 -5
View File
@@ -29,6 +29,8 @@
namespace Espo\Controllers;
use Espo\Services\Notification as Service;
use Espo\Core\{
Controllers\RecordBase,
Api\Request,
@@ -58,9 +60,7 @@ class Notification extends RecordBase
'after' => $after,
];
$recordCollection = $this->recordServiceContainer
->get('Notification')
->getList($userId, $params);
$recordCollection = $this->getNotificationService()->getList($userId, $params);
return (object) [
'total' => $recordCollection->getTotal(),
@@ -72,15 +72,20 @@ class Notification extends RecordBase
{
$userId = $this->user->getId();
return $this->recordServiceContainer->get('Notification')->getNotReadCount($userId);
return $this->getNotificationService()->getNotReadCount($userId);
}
public function postActionMarkAllRead(Request $request): bool
{
$userId = $this->user->getId();
$this->recordServiceContainer->get('Notification')->markAllRead($userId);
$this->getNotificationService()->markAllRead($userId);
return true;
}
private function getNotificationService(): Service
{
return $this->recordServiceContainer->get('Notification');
}
}