
- Set up project structure with FastAPI and SQLite - Implement user authentication with JWT - Create database models for users, events, bets, and transactions - Add API endpoints for user management - Add API endpoints for events and betting functionality - Add wallet management for deposits and withdrawals - Configure Alembic for database migrations - Add linting with Ruff - Add documentation in README
33 lines
745 B
Python
33 lines
745 B
Python
from datetime import datetime
|
|
from typing import Optional
|
|
|
|
from pydantic import BaseModel
|
|
|
|
from app.models.transaction import TransactionStatus, TransactionType
|
|
|
|
|
|
class TransactionBase(BaseModel):
|
|
amount: float
|
|
transaction_type: TransactionType
|
|
status: TransactionStatus = TransactionStatus.PENDING
|
|
reference: Optional[str] = None
|
|
bet_id: Optional[int] = None
|
|
|
|
|
|
class TransactionCreate(BaseModel):
|
|
amount: float
|
|
transaction_type: TransactionType = TransactionType.DEPOSIT
|
|
reference: Optional[str] = None
|
|
|
|
|
|
class TransactionUpdate(BaseModel):
|
|
status: TransactionStatus
|
|
|
|
|
|
class Transaction(TransactionBase):
|
|
id: int
|
|
user_id: int
|
|
created_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True |