feat(api): migracion completa de Flask API a FastAPI ASGI con arquitectura en 4 capas v3.6.0

This commit is contained in:
2026-10-16 17:36:44 -03:00
parent 5057d648c9
commit 37c21e1cd8
28 changed files with 1956 additions and 309 deletions
+21
View File
@@ -0,0 +1,21 @@
"""
Database & Persistence Management for FastAPI (Capa 4)
Integrates SQLAlchemy Engine, SessionLocal and get_db dependency.
"""
from typing import Generator
from sqlalchemy.orm import Session
from app import create_app, db as flask_db
# Initialize shared application context
flask_app = create_app()
def get_db() -> Generator[Session, None, None]:
"""
FastAPI dependency yielding the SQLAlchemy session within Flask app context
to guarantee all models, ORM queries and services work seamlessly.
"""
with flask_app.app_context():
yield flask_db.session
def get_flask_app():
return flask_app