From 8dbd7300a30b5ea34851af5fbebab602680307dd Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Thu, 27 Mar 2025 21:23:28 +0000 Subject: [PATCH] Add Glory schema --- schemas/glory.py | 55 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 schemas/glory.py diff --git a/schemas/glory.py b/schemas/glory.py new file mode 100644 index 0000000..0d83e8c --- /dev/null +++ b/schemas/glory.py @@ -0,0 +1,55 @@ +from pydantic import BaseModel, Field +from typing import Optional + +class GloryBase(BaseModel): + team_name: str = Field(..., description="Team name", index=True) + league: str = Field(..., description="League name") + points: int = Field(default=0, description="Total points") + matches_played: int = Field(default=0, description="Number of matches played") + wins: int = Field(default=0, description="Number of wins") + draws: int = Field(default=0, description="Number of draws") + losses: int = Field(default=0, description="Number of losses") + goals_for: int = Field(default=0, description="Goals scored") + goals_against: int = Field(default=0, description="Goals conceded") + goal_difference: int = Field(default=0, description="Goal difference") + position: int = Field(..., description="Current position in league") + is_active: bool = Field(default=True, description="Team active status") + season: str = Field(..., description="Season identifier") + coach: Optional[str] = Field(None, description="Team coach name") + home_stadium: Optional[str] = Field(None, description="Home stadium name") + +class GloryCreate(GloryBase): + class Config: + schema_extra = { + "example": { + "team_name": "Manchester United", + "league": "Premier League", + "position": 1, + "season": "2023/2024", + "coach": "Erik ten Hag", + "home_stadium": "Old Trafford" + } + } + +class Glory(GloryBase): + class Config: + orm_mode = True + schema_extra = { + "example": { + "team_name": "Manchester United", + "league": "Premier League", + "points": 75, + "matches_played": 38, + "wins": 23, + "draws": 6, + "losses": 9, + "goals_for": 68, + "goals_against": 36, + "goal_difference": 32, + "position": 1, + "is_active": True, + "season": "2023/2024", + "coach": "Erik ten Hag", + "home_stadium": "Old Trafford" + } + } \ No newline at end of file