diff --git a/Admin/Install/db.json b/Admin/Install/db.json index 5bd73cf..870ad33 100755 --- a/Admin/Install/db.json +++ b/Admin/Install/db.json @@ -303,5 +303,41 @@ "foreignKey": "tag_id" } } + }, + "task_seen": { + "name": "task_seen", + "fields": { + "task_seen_id": { + "name": "task_seen_id", + "type": "INT", + "null": false, + "primary": true, + "autoincrement": true + }, + "task_seen_at": { + "name": "task_seen_at", + "type": "DATETIME", + "null": false + }, + "task_seen_flag": { + "name": "task_seen_flag", + "type": "TINYINT", + "null": false + }, + "task_seen_by": { + "name": "task_seen_by", + "type": "INT", + "null": false, + "foreignTable": "account", + "foreignKey": "account_id" + }, + "task_seen_task": { + "name": "task_seen_task", + "type": "INT", + "null": false, + "foreignTable": "task", + "foreignKey": "task_id" + } + } } } \ No newline at end of file diff --git a/Controller/BackendController.php b/Controller/BackendController.php index 9a85299..8b8b3e5 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -15,6 +15,7 @@ declare(strict_types=1); namespace Modules\Tasks\Controller; use Modules\Dashboard\Models\DashboardElementInterface; +use Modules\Media\Models\MediaMapper; use Modules\Tasks\Models\PermissionState; use Modules\Tasks\Models\TaskMapper; use Modules\Tasks\Views\TaskView; @@ -134,6 +135,10 @@ final class BackendController extends Controller implements DashboardElementInte { $view = new TaskView($this->app->l11nManager, $request, $response); + $profileImage = $this->app->appSettings->get(names: 'default_profile_image', module: 'Profile'); + $image = MediaMapper::get()->where('id', (int) $profileImage->content)->execute(); + $view->defaultProfileImage = $image; + if (!TaskMapper::hasReadingPermission($request->header->account, (int) $request->getData('id'))) { $response->header->status = RequestStatusCode::R_403; $view->setTemplate('/Web/Backend/Error/403'); diff --git a/Controller/SearchController.php b/Controller/SearchController.php index 9e358e1..b1fdeb6 100755 --- a/Controller/SearchController.php +++ b/Controller/SearchController.php @@ -49,7 +49,6 @@ final class SearchController extends Controller $tags = []; - // @todo: probably cleanup return for link generation + sort by best match $response->header->set('Content-Type', MimeType::M_JSON . '; charset=utf-8', true); $response->set($request->uri->__toString(), $tags); diff --git a/Models/TaskSeen.php b/Models/TaskSeen.php new file mode 100644 index 0000000..daf3cc8 --- /dev/null +++ b/Models/TaskSeen.php @@ -0,0 +1,73 @@ +seenAt = new \DateTime('now'); + } + + /** + * Get id + * + * @return int + * + * @since 1.0.0 + */ + public function getId() : int + { + return $this->id; + } +} diff --git a/Models/TaskSeenMapper.php b/Models/TaskSeenMapper.php new file mode 100644 index 0000000..c7b8c52 --- /dev/null +++ b/Models/TaskSeenMapper.php @@ -0,0 +1,58 @@ + + * @since 1.0.0 + */ + public const COLUMNS = [ + 'task_seen_id' => ['name' => 'task_seen_id', 'type' => 'int', 'internal' => 'id'], + 'task_seen_at' => ['name' => 'task_seen_at', 'type' => 'DateTime', 'internal' => 'seenAt'], + 'task_seen_task' => ['name' => 'task_seen_task', 'type' => 'int', 'internal' => 'task'], + 'task_seen_by' => ['name' => 'task_seen_by', 'type' => 'int', 'internal' => 'seenBy'], + 'task_seen_flag' => ['name' => 'task_seen_flag', 'type' => 'bool', 'internal' => 'flag'], + ]; + + /** + * Primary table. + * + * @var string + * @since 1.0.0 + */ + public const TABLE = 'task_seen'; + + /** + * Primary field name. + * + * @var string + * @since 1.0.0 + */ + public const PRIMARYFIELD ='task_seen_id'; +}