
- 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
25 lines
583 B
Python
25 lines
583 B
Python
from pydantic import BaseModel
|
|
from typing import Optional
|
|
from datetime import datetime
|
|
from app.models.transaction import TransactionStatus
|
|
|
|
class TransactionBase(BaseModel):
|
|
beat_id: int
|
|
amount: float
|
|
|
|
class TransactionCreate(TransactionBase):
|
|
pass
|
|
|
|
class TransactionUpdate(BaseModel):
|
|
status: Optional[TransactionStatus] = None
|
|
|
|
class TransactionResponse(TransactionBase):
|
|
id: int
|
|
buyer_id: int
|
|
status: TransactionStatus
|
|
transaction_reference: str
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True |