Add State schema

This commit is contained in:
Backend IM Bot 2025-03-25 20:13:13 +01:00
parent 3f2897e729
commit 3c6e6e30a4

25
schemas/state.py Normal file
View File

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