Added the possibility to undo a task (closes #252)

This commit is contained in:
Bernd Bestel
2019-07-06 20:34:01 +02:00
parent 914dde4609
commit b4d2e2a20a
8 changed files with 103 additions and 1 deletions

View File

@@ -26,6 +26,22 @@ class TasksService extends BaseService
return true;
}
public function UndoTask($taskId)
{
if (!$this->TaskExists($taskId))
{
throw new \Exception('Task does not exist');
}
$taskRow = $this->Database->tasks()->where('id = :1', $taskId)->fetch();
$taskRow->update(array(
'done' => 0,
'done_timestamp' => null
));
return true;
}
private function TaskExists($taskId)
{
$taskRow = $this->Database->tasks()->where('id = :1', $taskId)->fetch();