async def addTodoList(listItem: schema.BaseTodoList): try: # print("listItem:", listItem) result = await todos.AddTodoList(listItem.title) # return {"message": "Add todo list"} # print("result:", result) return respOK(result) except Exception as e: return respErr(str(e))
async def deleteTodoItem(id: int, response: Response): try: result = await todos.DeleteTodoItem(id) if result == None: response.status_code = status.HTTP_400_BAD_REQUEST return respErr("Failed to delete list. Check id", 400, result) else: return respOK(result) except Exception as e: return respErr(str(e))
async def updateTodoItem(todo: schema.TodoItem): try: result = await todos.UpdateTodoItem(todo) return respOK(result) except Exception as e: return respErr(str(e))
async def addTodoItem(lid: int, todo: schema.BaseTodoItem): try: result = await todos.AddTodoItem(lid, todo) return respOK(result) except Exception as e: return respErr(str(e))
async def getTodoItems(lid: int): try: results = await todos.GetTodoItems(lid) return respOK(results) except Exception as e: return respErr(str(e))
async def updateTodoList(todoList: schema.TodoList): try: result = await todos.UpdateTodoList(todoList) return respOK(result) except Exception as e: return respErr(str(e))
async def getTodoLists(): lists = await todos.GetAllTodoLists() return respOK(lists)