Automated Action c8aed27755 Create SaaS invoicing application with FastAPI and SQLite
- Set up project structure with modular organization
- Implement database models for users, organizations, clients, invoices
- Create Alembic migration scripts for database setup
- Implement JWT-based authentication and authorization
- Create API endpoints for users, organizations, clients, invoices
- Add PDF generation for invoices using ReportLab
- Add comprehensive documentation in README
2025-06-06 11:21:11 +00:00

21 lines
517 B
Python

from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from app.core.config import settings
# Ensure the DB directory exists
settings.DB_DIR.mkdir(parents=True, exist_ok=True)
engine = create_engine(
settings.SQLALCHEMY_DATABASE_URL,
connect_args={"check_same_thread": False}
)
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
# Dependency for database session
def get_db():
db = SessionLocal()
try:
yield db
finally:
db.close()