add redirect field

This commit is contained in:
Dennis Eichhorn 2021-08-17 13:36:35 +02:00
parent 01c4e6c79b
commit dab378debe
4 changed files with 18 additions and 0 deletions

View File

@ -72,6 +72,11 @@
"default": null,
"null": true
},
"task_redirect": {
"name": "task_redirect",
"type": "VARCHAR(255)",
"null": false
},
"task_schedule": {
"name": "task_schedule",
"type": "INT",

View File

@ -107,6 +107,7 @@ final class ApiController extends Controller
$task->setCreatedBy(new NullAccount($request->header->account));
$task->setStatus(TaskStatus::OPEN);
$task->setType(TaskType::SINGLE);
$task->redirect = (string) ($request->getData('redirect') ?? '');
if (empty($request->getData('priority'))) {
$task->due = empty($request->getData('due')) ? null : new \DateTime($request->getData('due'));

View File

@ -48,6 +48,17 @@ class Task implements \JsonSerializable
*/
public string $title = '';
/**
* Redirect.
*
* Used as reference or for redirection when opened.
* This allows to open the task on a different page with a different layout if needed (e.g. ticket system, workflow, checklist, ...)
*
* @var string
* @since 1.0.0
*/
public string $redirect = '';
/**
* Creator.
*

View File

@ -54,6 +54,7 @@ final class TaskMapper extends DataMapperAbstract
'task_done' => ['name' => 'task_done', 'type' => 'DateTime', 'internal' => 'done'],
'task_schedule' => ['name' => 'task_schedule', 'type' => 'int', 'internal' => 'schedule'],
'task_start' => ['name' => 'task_start', 'type' => 'DateTime', 'internal' => 'start'],
'task_redirect' => ['name' => 'task_redirect', 'type' => 'string', 'internal' => 'redirect'],
'task_created_by' => ['name' => 'task_created_by', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true],
'task_created_at' => ['name' => 'task_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true],
];