Files
2026-10-30 12:10:49 +00:00

28 lines
550 B
Python

"""
Database utilities for authentication.
"""
from sqlalchemy.orm import Session
from .models import Base
def utcnow():
"""Return current UTC timestamp for database columns."""
from datetime import datetime
return datetime.utcnow()
def get_db() -> Session:
"""
Dependency factory that yields a database session.
Should be imported and used with Depends(get_db) in endpoint functions.
"""
from db.session import SessionLocal
db = SessionLocal()
try:
yield db
finally:
db.close()