continue optimizing todos

This commit is contained in:
Dennis Eichhorn 2020-01-05 21:38:42 +01:00
parent 05ed8a0fee
commit 3e21a270e7
3 changed files with 17 additions and 3 deletions

View File

@ -215,7 +215,7 @@ final class ApiController extends Controller
|| ($val['due'] = !((bool) \strtotime((string) $request->getData('due'))))
|| ($val['task'] = !(\is_numeric($request->getData('task'))))
|| ($val['forward'] = !(\is_numeric(empty($request->getData('forward')) ? $request->getHeader()->getAccount() : $request->getData('forward'))))
) { // todo: validate correct task
) {
return $val;
}
@ -243,6 +243,11 @@ final class ApiController extends Controller
return;
}
/**
* @todo Orange-Management/Moudles#201
* Validate that the user is allowed to create a task element for a specific task
*/
$element = $this->createTaskElementFromRequest($request);
$task = TaskMapper::get($element->getTask());
$task->setStatus($element->getStatus());
@ -331,7 +336,13 @@ final class ApiController extends Controller
$old = clone TaskElementMapper::get((int) $request->getData('id'));
$new = $this->updateTaskElementFromRequest($request);
$this->updateModel($request, $old, $new, TaskElementMapper::class, 'taskelement');
// todo: update task if element status change had effect on task status!!!
/**
* @todo Orange-Management/Modules#205
* Update task status depending on the new task element or updated task element
* The task status is not normalized and relates to the last task element.
* Depending on the task status of the last task element also the task status should change.
*/
//$this->updateModel($request, $task, $task, TaskMapper::class, 'task');
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Task element', 'Task element successfully updated.', $new);
}

View File

@ -200,6 +200,10 @@ final class BackendController extends Controller implements DashboardElementInte
*
* @return int Returns the amount of unread tasks
*
* @todo Orange-Management/Modules#206
* Implement has seen feature
* In order to allow a "user has seen task x" feature every task should have a user/account status for the different users (creator, cc, receiver).
*
* @since 1.0.0
*/
public function openNav(int $account) : int

View File

@ -190,7 +190,6 @@ final class TaskMapper extends DataMapperAbstract
->on(TaskElementMapper::getTable() . '.task_element_id', '=', AccountRelationMapper::getTable() . '.task_account_task_element')
->where(self::$table . '.task_status', '=', TaskStatus::OPEN)
->andWhere(AccountRelationMapper::getTable() . '.task_account_account', '=', $user);
// todo: ->orWhere(self::$table . '.createdBy', '=', $user) this needs a where condition so we can create (...) or created by
return self::getAllByQuery($query);
}