mirror of
https://github.com/grocy/grocy.git
synced 2025-09-29 19:12:24 +00:00
Finish first version of tasks feature
This commit is contained in:
@@ -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();
|
||||
|
Reference in New Issue
Block a user