Automated Action 0fc3927871 Build comprehensive SaaS invoicing application with FastAPI
- Implemented complete authentication system with JWT tokens
- Created user management with registration and profile endpoints
- Built client management with full CRUD operations
- Developed invoice system with line items and automatic calculations
- Set up SQLite database with proper migrations using Alembic
- Added health monitoring and API documentation
- Configured CORS for cross-origin requests
- Included comprehensive README with usage examples
2025-06-23 14:56:50 +00:00

22 lines
520 B
Python

from pathlib import Path
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
DB_DIR = Path("/app") / "storage" / "db"
DB_DIR.mkdir(parents=True, exist_ok=True)
SQLALCHEMY_DATABASE_URL = f"sqlite:///{DB_DIR}/db.sqlite"
engine = create_engine(
SQLALCHEMY_DATABASE_URL,
connect_args={"check_same_thread": False}
)
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
def get_db():
db = SessionLocal()
try:
yield db
finally:
db.close()