def delete(self, id): try: task = TaskService.getTask(id) if task is not None: TaskService.deleteTask(task) return {"result": 'task deleted successfully'} raise Exception('task not found') except Exception as e: return {"error", e.message}
def delete(self): tasks = TaskService.getTasks() for task in tasks: TaskService.deleteTask(task) return {"result": 'done'}