Add Football schema

This commit is contained in:
Backend IM Bot 2025-03-26 12:44:02 +00:00
parent 2f6fa82e36
commit bf84d419d8

40
schemas/football.py Normal file
View File

@ -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"
}
}