mirror of
https://github.com/Karaka-Management/oms-Tasks.git
synced 2026-02-16 22:58:41 +00:00
optimize seen
This commit is contained in:
parent
3773d9eb40
commit
1cc6721c12
|
|
@ -207,12 +207,6 @@
|
||||||
"foreignTable": "account",
|
"foreignTable": "account",
|
||||||
"foreignKey": "account_id"
|
"foreignKey": "account_id"
|
||||||
},
|
},
|
||||||
"task_account_seen": {
|
|
||||||
"name": "task_account_seen",
|
|
||||||
"type": "TINYINT",
|
|
||||||
"default": 0,
|
|
||||||
"null": false
|
|
||||||
},
|
|
||||||
"task_account_duty": {
|
"task_account_duty": {
|
||||||
"name": "task_account_duty",
|
"name": "task_account_duty",
|
||||||
"type": "TINYINT",
|
"type": "TINYINT",
|
||||||
|
|
@ -317,12 +311,8 @@
|
||||||
"task_seen_at": {
|
"task_seen_at": {
|
||||||
"name": "task_seen_at",
|
"name": "task_seen_at",
|
||||||
"type": "DATETIME",
|
"type": "DATETIME",
|
||||||
"null": false
|
"null": true,
|
||||||
},
|
"default": null
|
||||||
"task_seen_flag": {
|
|
||||||
"name": "task_seen_flag",
|
|
||||||
"type": "TINYINT",
|
|
||||||
"null": false
|
|
||||||
},
|
},
|
||||||
"task_seen_by": {
|
"task_seen_by": {
|
||||||
"name": "task_seen_by",
|
"name": "task_seen_by",
|
||||||
|
|
@ -337,6 +327,25 @@
|
||||||
"null": false,
|
"null": false,
|
||||||
"foreignTable": "task",
|
"foreignTable": "task",
|
||||||
"foreignKey": "task_id"
|
"foreignKey": "task_id"
|
||||||
|
},
|
||||||
|
"task_seen_reminder": {
|
||||||
|
"name": "task_seen_reminder",
|
||||||
|
"type": "TINYINT",
|
||||||
|
"null": false
|
||||||
|
},
|
||||||
|
"task_seen_reminder_at": {
|
||||||
|
"name": "task_seen_reminder_at",
|
||||||
|
"type": "DATETIME",
|
||||||
|
"null": true,
|
||||||
|
"default": null
|
||||||
|
},
|
||||||
|
"task_seen_reminder_by": {
|
||||||
|
"name": "task_seen_reminder_by",
|
||||||
|
"type": "INT",
|
||||||
|
"null": true,
|
||||||
|
"default": null,
|
||||||
|
"foreignTable": "account",
|
||||||
|
"foreignKey": "account_id"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Modules\Tasks\Models;
|
namespace Modules\Tasks\Models;
|
||||||
|
|
||||||
|
use Modules\Admin\Models\Account;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Null model
|
* Null model
|
||||||
*
|
*
|
||||||
|
|
@ -38,16 +40,11 @@ class TaskSeen
|
||||||
|
|
||||||
public int $task = 0;
|
public int $task = 0;
|
||||||
|
|
||||||
/**
|
public ?\DateTime $reminderAt = null;
|
||||||
* The flag allows to set a task as not seen even it was already seen.
|
|
||||||
*
|
public bool $isRemindered = false;
|
||||||
* This is helpful for changes to a task or forwarding which should be signaled to the user.
|
|
||||||
* Another situation could be if a user wants to mark a task as unseen in order to check it out later on again.
|
public ?Account $reminderBy = null;
|
||||||
*
|
|
||||||
* @var bool
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public bool $flag = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,14 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Modules\Tasks\Models;
|
namespace Modules\Tasks\Models;
|
||||||
|
|
||||||
|
use Modules\Admin\Models\AccountMapper;
|
||||||
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tasks mapper class.
|
* Task seen mapper class.
|
||||||
|
*
|
||||||
|
* This class is used to mark a task as seen. Additionally, you may set a reminder flag which can be used to highlight
|
||||||
|
* a task.
|
||||||
*
|
*
|
||||||
* @package Modules\Tasks\Models
|
* @package Modules\Tasks\Models
|
||||||
* @license OMS License 1.0
|
* @license OMS License 1.0
|
||||||
|
|
@ -37,7 +41,22 @@ final class TaskSeenMapper extends DataMapperFactory
|
||||||
'task_seen_at' => ['name' => 'task_seen_at', 'type' => 'DateTime', 'internal' => 'seenAt'],
|
'task_seen_at' => ['name' => 'task_seen_at', 'type' => 'DateTime', 'internal' => 'seenAt'],
|
||||||
'task_seen_task' => ['name' => 'task_seen_task', 'type' => 'int', 'internal' => 'task'],
|
'task_seen_task' => ['name' => 'task_seen_task', 'type' => 'int', 'internal' => 'task'],
|
||||||
'task_seen_by' => ['name' => 'task_seen_by', 'type' => 'int', 'internal' => 'seenBy'],
|
'task_seen_by' => ['name' => 'task_seen_by', 'type' => 'int', 'internal' => 'seenBy'],
|
||||||
'task_seen_flag' => ['name' => 'task_seen_flag', 'type' => 'bool', 'internal' => 'flag'],
|
'task_seen_reminder' => ['name' => 'task_seen_reminder', 'type' => 'bool', 'internal' => 'isRemindered'],
|
||||||
|
'task_seen_reminder_at' => ['name' => 'task_seen_reminder_at', 'type' => 'DateTime', 'internal' => 'reminderAt'],
|
||||||
|
'task_seen_reminder_by' => ['name' => 'task_seen_reminder_by', 'type' => 'int', 'internal' => 'reminderBy'],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Belongs to.
|
||||||
|
*
|
||||||
|
* @var array<string, array{mapper:string, external:string}>
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public const BELONGS_TO = [
|
||||||
|
'reminderBy' => [
|
||||||
|
'mapper' => AccountMapper::class,
|
||||||
|
'external' => 'task_seen_reminder_by',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user