diff --git a/schemas/city.py b/schemas/city.py new file mode 100644 index 0000000..514ab16 --- /dev/null +++ b/schemas/city.py @@ -0,0 +1,34 @@ +from pydantic import BaseModel, Field +from typing import Optional + +class CityBase(BaseModel): + name: str = Field(..., min_length=1, max_length=100, description="City name") + endpoint: str = Field(..., min_length=1, max_length=200, description="City endpoint") + description: Optional[str] = Field(None, description="City description") + is_active: bool = Field(default=True, description="City active status") + +class CityCreate(CityBase): + class Config: + schema_extra = { + "example": { + "name": "New York", + "endpoint": "/new-york", + "description": "The Big Apple", + "is_active": True + } + } + +class City(CityBase): + id: int = Field(..., description="City ID") + + class Config: + orm_mode = True + schema_extra = { + "example": { + "id": 1, + "name": "New York", + "endpoint": "/new-york", + "description": "The Big Apple", + "is_active": True + } + } \ No newline at end of file