Added h2h communication.
This commit is contained in:
58
backend/app/schemas/match_comment.py
Normal file
58
backend/app/schemas/match_comment.py
Normal file
@ -0,0 +1,58 @@
|
||||
from pydantic import BaseModel, Field
|
||||
from datetime import datetime
|
||||
from decimal import Decimal
|
||||
from typing import Optional, List
|
||||
from app.models.spread_bet import TeamSide, SpreadBetStatus
|
||||
|
||||
|
||||
class MatchCommentCreate(BaseModel):
|
||||
content: str = Field(..., min_length=1, max_length=500)
|
||||
|
||||
|
||||
class MatchComment(BaseModel):
|
||||
id: int
|
||||
spread_bet_id: int
|
||||
user_id: int
|
||||
username: str
|
||||
content: str
|
||||
created_at: datetime
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class MatchUser(BaseModel):
|
||||
id: int
|
||||
username: str
|
||||
|
||||
|
||||
class MatchBetDetail(BaseModel):
|
||||
id: int
|
||||
event_id: int
|
||||
spread: float
|
||||
team: TeamSide
|
||||
stake_amount: Decimal
|
||||
house_commission_percent: Decimal
|
||||
status: SpreadBetStatus
|
||||
payout_amount: Optional[Decimal] = None
|
||||
winner_id: Optional[int] = None
|
||||
created_at: datetime
|
||||
matched_at: Optional[datetime] = None
|
||||
completed_at: Optional[datetime] = None
|
||||
# Event info
|
||||
home_team: str
|
||||
away_team: str
|
||||
game_time: datetime
|
||||
official_spread: float
|
||||
# User info
|
||||
creator: MatchUser
|
||||
taker: Optional[MatchUser] = None
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class MatchDetailResponse(BaseModel):
|
||||
bet: MatchBetDetail
|
||||
comments: List[MatchComment]
|
||||
can_comment: bool # True if current user is creator or taker
|
||||
Reference in New Issue
Block a user