
- Set up FastAPI project structure with main.py and requirements.txt - Created SQLite database models for users, beats, and transactions - Implemented Alembic database migrations - Added user authentication system with JWT tokens - Created beat management endpoints (CRUD operations) - Implemented purchase/transaction system - Added file upload/download functionality for beat files - Created health endpoint and API documentation - Updated README with comprehensive documentation - Fixed all linting issues with Ruff Environment variables needed: - SECRET_KEY: JWT secret key for authentication
16 lines
430 B
Python
16 lines
430 B
Python
from app.db.base import SessionLocal, engine, Base
|
|
|
|
def get_db():
|
|
db = SessionLocal()
|
|
try:
|
|
yield db
|
|
finally:
|
|
db.close()
|
|
|
|
def init_db():
|
|
# Import models to register them with SQLAlchemy
|
|
from app.models.user import User # noqa: F401
|
|
from app.models.beat import Beat # noqa: F401
|
|
from app.models.transaction import Transaction # noqa: F401
|
|
|
|
Base.metadata.create_all(bind=engine) |