netadm/authentication/dependencies/user_manager.py

20 lines
406 B
Python
Raw Normal View History

2024-10-02 15:50:50 +00:00
from typing import Annotated, TYPE_CHECKING
from fastapi import Depends
from authentication.user_manager import UserManager
from .users import get_users_db
if TYPE_CHECKING:
from fastapi_users_db_sqlalchemy import SQLAlchemyUserDatabase
async def get_user_manager(
users_db: Annotated[
"SQLAlchemyUserDatabase",
Depends(get_users_db),
]
):
yield UserManager(users_db)