from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_async_engine from api.config import get_settings from api.service.user import UserService from api.uow.uow_base import UnitOfWork async_engine = create_async_engine( url=get_settings().get_db_url, echo=True, ) async_session_factory = async_sessionmaker( async_engine, class_=AsyncSession, expire_on_commit=False, ) uow = UnitOfWork( session_factory=async_session_factory, ) user_service = UserService( uow=uow, ) def get_user_service(): return user_service