Finish first version of tasks feature

This commit is contained in:
Bernd Bestel
2018-09-23 19:26:13 +02:00
parent f85a67a1ff
commit 06f25b7006
16 changed files with 239 additions and 24 deletions

View File

@@ -10,6 +10,22 @@ class TasksService extends BaseService
return $this->DatabaseService->ExecuteDbQuery($sql)->fetchAll(\PDO::FETCH_OBJ);
}
public function MarkTaskAsCompleted($taskId, $doneTime)
{
if (!$this->TaskExists($taskId))
{
throw new \Exception('Task does not exist');
}
$taskRow = $this->Database->tasks()->where('id = :1', $taskId)->fetch();
$taskRow->update(array(
'done' => 1,
'done_timestamp' => $doneTime
));
return true;
}
private function TaskExists($taskId)
{
$taskRow = $this->Database->tasks()->where('id = :1', $taskId)->fetch();