Exemple #1
0
async def delete_todo(todo_id: int) -> None:
    """
    Delete a todo
    """
    effect = get_environment(HasModel).and_then(
        lambda env: env.model.delete_todo(todo_id))
    return await effect(HasModelAndSQL())
Exemple #2
0
async def patch_todo(todo: Todo) -> Todo:
    """
    Update a todo
    """
    effect = get_environment(HasModel).and_then(
        lambda env: env.model.patch_todo(todo))
    return await effect(HasModelAndSQL())
Exemple #3
0
async def get_todo(todo_id: int) -> Union[None, Todo]:
    """
    Get a todo
    """
    effect = get_environment(HasModel).and_then(
        lambda env: env.model.get_todo(todo_id))
    return await effect(HasModelAndSQL())
Exemple #4
0
async def get_todos() -> Todos:
    """
    Get all todos
    """
    effect = get_environment(HasModel).and_then(
        lambda env: env.model.get_todos())
    return await effect(HasModelAndSQL())