
- 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
36 lines
849 B
Python
36 lines
849 B
Python
from pydantic import BaseModel
|
|
from typing import Optional
|
|
from datetime import datetime
|
|
|
|
class BeatBase(BaseModel):
|
|
title: str
|
|
description: Optional[str] = None
|
|
price: float
|
|
genre: str
|
|
bpm: Optional[int] = None
|
|
key: Optional[str] = None
|
|
|
|
class BeatCreate(BeatBase):
|
|
pass
|
|
|
|
class BeatUpdate(BaseModel):
|
|
title: Optional[str] = None
|
|
description: Optional[str] = None
|
|
price: Optional[float] = None
|
|
genre: Optional[str] = None
|
|
bpm: Optional[int] = None
|
|
key: Optional[str] = None
|
|
is_available: Optional[bool] = None
|
|
|
|
class BeatResponse(BeatBase):
|
|
id: int
|
|
file_path: str
|
|
preview_path: Optional[str] = None
|
|
artwork_path: Optional[str] = None
|
|
is_available: bool
|
|
producer_id: int
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True |