the middle of the idiots

This commit is contained in:
2025-10-24 16:29:40 -05:00
parent 6a58e19b10
commit 721301c779
2472 changed files with 237076 additions and 418 deletions

View File

@@ -3,7 +3,7 @@ Database initialization and session management
"""
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from sqlalchemy.orm import sessionmaker, Session
from .config.settings import settings
# Create database engine
@@ -20,4 +20,14 @@ Base = declarative_base()
def init_db():
"""Initialize the database with all tables"""
Base.metadata.create_all(bind=engine)
Base.metadata.create_all(bind=engine)
def get_db() -> Session:
"""
Dependency function to get database session
"""
db = SessionLocal()
try:
yield db
finally:
db.close()