From 050dab34267f84b234736c10502738e723d4a5ab Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Wed, 26 Mar 2025 13:24:03 +0000 Subject: [PATCH] Add City schema --- schemas/city.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 schemas/city.py 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