auth and raw sql in alchemy
This commit is contained in:
@@ -1,16 +1,15 @@
|
||||
from fastapi import FastAPI
|
||||
from sqlalchemy.ext.asyncio import AsyncEngine, AsyncSession, async_sessionmaker
|
||||
from sqlalchemy.ext.asyncio import (AsyncEngine, AsyncSession,
|
||||
async_sessionmaker)
|
||||
|
||||
from api.application.abstractions.uow import UnitOfWork
|
||||
from api.application.protocols.password_hasher import PasswordHasher
|
||||
from api.application.usecase.user.create_user import CreateUser
|
||||
from api.application.usecase.auth.create_user import CreateUser
|
||||
from api.domain.user.repository import UserRepository
|
||||
from api.infrastructure.dependencies.adapters import (
|
||||
create_engine,
|
||||
create_session_maker,
|
||||
new_session,
|
||||
new_unit_of_work,
|
||||
)
|
||||
from api.infrastructure.dependencies.adapters import (create_engine,
|
||||
create_session_maker,
|
||||
new_session,
|
||||
new_unit_of_work)
|
||||
from api.infrastructure.dependencies.configs import app_settings
|
||||
from api.infrastructure.dependencies.protocols import get_password_hasher
|
||||
from api.infrastructure.dependencies.repositories import get_user_repository
|
||||
|
@@ -21,6 +21,7 @@ async def lifespan(app: FastAPI) -> AsyncGenerator:
|
||||
engine = app.dependency_overrides[AsyncEngine](app.dependency_overrides[Settings]())
|
||||
|
||||
async with engine.begin() as conn:
|
||||
await conn.run_sync(Base.metadata.drop_all)
|
||||
await conn.run_sync(Base.metadata.create_all)
|
||||
yield
|
||||
|
||||
|
@@ -1,8 +1,10 @@
|
||||
from fastapi import FastAPI
|
||||
|
||||
from api.presentation.routers import healthcheck_router, user_router
|
||||
from api.presentation.routers import (auth_router, healthcheck_router,
|
||||
user_router)
|
||||
|
||||
|
||||
def init_routers(app: FastAPI) -> None:
|
||||
app.include_router(user_router)
|
||||
app.include_router(auth_router)
|
||||
app.include_router(healthcheck_router)
|
||||
|
Reference in New Issue
Block a user