Automated Action 4e92bb1338 Create FastAPI E-commerce API with SQLite
This commit includes:
- Project structure setup with FastAPI
- Database models with SQLAlchemy (users, products, categories, orders)
- SQLite database configuration
- Alembic migration scripts
- API endpoints for authentication, users, products, categories, and orders
- JWT authentication
- Comprehensive documentation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-11 18:51:15 +00:00

21 lines
494 B
Python

from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from app.core.config import settings
engine = create_engine(
settings.SQLALCHEMY_DATABASE_URL,
connect_args={"check_same_thread": False}
)
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
Base = declarative_base()
# Dependency
def get_db():
db = SessionLocal()
try:
yield db
finally:
db.close()