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())
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())
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())
async def get_todos() -> Todos: """ Get all todos """ effect = get_environment(HasModel).and_then( lambda env: env.model.get_todos()) return await effect(HasModelAndSQL())