
- Set up FastAPI application structure - Implemented SQLite database integration with SQLAlchemy - Added Alembic migrations for database versioning - Created bet model and API endpoints for CRUD operations - Added comprehensive README with setup and usage instructions - Added health check endpoint and CORS support
46 lines
855 B
Python
46 lines
855 B
Python
from datetime import datetime
|
|
from typing import Optional
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
# Shared properties
|
|
class BetBase(BaseModel):
|
|
user_id: str
|
|
event_id: str
|
|
amount: float = Field(..., gt=0)
|
|
odds: float
|
|
prediction: str
|
|
|
|
|
|
# Properties to receive on item creation
|
|
class BetCreate(BetBase):
|
|
pass
|
|
|
|
|
|
# Properties to receive on item update
|
|
class BetUpdate(BaseModel):
|
|
is_verified: Optional[bool] = None
|
|
result: Optional[str] = None
|
|
|
|
|
|
# Properties shared by models stored in DB
|
|
class BetInDBBase(BetBase):
|
|
id: int
|
|
is_verified: bool
|
|
created_at: datetime
|
|
verified_at: Optional[datetime] = None
|
|
result: Optional[str] = None
|
|
|
|
class Config:
|
|
orm_mode = True
|
|
|
|
|
|
# Properties to return to client
|
|
class Bet(BetInDBBase):
|
|
pass
|
|
|
|
|
|
# Properties stored in DB
|
|
class BetInDB(BetInDBBase):
|
|
pass |