From 98bdf94eb8ea5b8b76557a7e182a4babe87bed49 Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Wed, 26 Mar 2025 22:28:59 +0000 Subject: [PATCH] Add Country schema --- schemas/country.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 schemas/country.py diff --git a/schemas/country.py b/schemas/country.py new file mode 100644 index 0000000..9a76d61 --- /dev/null +++ b/schemas/country.py @@ -0,0 +1,28 @@ +from pydantic import BaseModel, Field +from typing import Optional + +class CountryBase(BaseModel): + name: str = Field(..., min_length=1, max_length=100) + code: str = Field(..., min_length=2, max_length=2) + +class CountryCreate(CountryBase): + class Config: + schema_extra = { + "example": { + "name": "United States", + "code": "US" + } + } + +class Country(CountryBase): + id: int + + class Config: + orm_mode = True + schema_extra = { + "example": { + "id": 1, + "name": "United States", + "code": "US" + } + } \ No newline at end of file