예제 #1
0
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))
예제 #2
0
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))
예제 #3
0
async def updateTodoItem(todo: schema.TodoItem):
    try:
        result = await todos.UpdateTodoItem(todo)
        return respOK(result)
    except Exception as e:
        return respErr(str(e))
예제 #4
0
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))
예제 #5
0
async def getTodoItems(lid: int):
    try:
        results = await todos.GetTodoItems(lid)
        return respOK(results)
    except Exception as e:
        return respErr(str(e))
예제 #6
0
async def updateTodoList(todoList: schema.TodoList):
    try:
        result = await todos.UpdateTodoList(todoList)
        return respOK(result)
    except Exception as e:
        return respErr(str(e))
예제 #7
0
async def getTodoLists():
    lists = await todos.GetAllTodoLists()
    return respOK(lists)