From bf84d419d80cd088c50baa84a6d2f60a0f1461e1 Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Wed, 26 Mar 2025 12:44:02 +0000 Subject: [PATCH] Add Football schema --- schemas/football.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 schemas/football.py diff --git a/schemas/football.py b/schemas/football.py new file mode 100644 index 0000000..f23056b --- /dev/null +++ b/schemas/football.py @@ -0,0 +1,40 @@ +from pydantic import BaseModel, Field +from typing import Optional + +class FootballBase(BaseModel): + team_name: str = Field(..., description="Name of the football team", min_length=1) + league: str = Field(..., description="League the team plays in", min_length=1) + player_count: int = Field(default=11, description="Number of players in the team") + is_active: bool = Field(default=True, description="Whether the team is active") + team_ranking: Optional[int] = Field(None, description="Current ranking of the team") + stadium_name: Optional[str] = Field(None, description="Name of the team's stadium") + +class FootballCreate(FootballBase): + class Config: + schema_extra = { + "example": { + "team_name": "Manchester United", + "league": "Premier League", + "player_count": 11, + "is_active": True, + "team_ranking": 3, + "stadium_name": "Old Trafford" + } + } + +class Football(FootballBase): + id: int = Field(..., description="Unique identifier for the team") + + class Config: + orm_mode = True + schema_extra = { + "example": { + "id": 1, + "team_name": "Manchester United", + "league": "Premier League", + "player_count": 11, + "is_active": True, + "team_ranking": 3, + "stadium_name": "Old Trafford" + } + } \ No newline at end of file