From 3c6e6e30a4e82cd781ecf2805b183bd9c5276e28 Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Tue, 25 Mar 2025 20:13:13 +0100 Subject: [PATCH] Add State schema --- schemas/state.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 schemas/state.py diff --git a/schemas/state.py b/schemas/state.py new file mode 100644 index 0000000..68a31b0 --- /dev/null +++ b/schemas/state.py @@ -0,0 +1,25 @@ +# Base Schema +class StateBase(BaseModel): + name: str = Field(..., unique=True, index=True, description="Name of the state") + abbreviation: str = Field(..., unique=True, index=True, description="Abbreviation of the state") + is_active: bool = Field(True, description="Whether the state is active or not") + + class Config: + schema_extra = { + "example": { + "name": "California", + "abbreviation": "CA", + "is_active": True + } + } + +# Create Schema +class StateCreate(StateBase): + pass + +# Response Schema +class StateResponse(StateBase): + id: int + + class Config: + orm_mode = True \ No newline at end of file