Add School schema

This commit is contained in:
Backend IM Bot 2025-03-27 21:20:25 +00:00
parent 33fe3ab7f5
commit d6699b157a

49
schemas/school.py Normal file
View File

@ -0,0 +1,49 @@
from pydantic import BaseModel, Field
from typing import Optional
class SchoolBase(BaseModel):
name: str = Field(..., description="School name", index=True)
address: str = Field(..., description="School address")
capacity: int = Field(..., gt=0, description="Total capacity")
storage_type: str = Field(..., description="Type of storage")
temperature_controlled: bool = Field(False, description="Temperature control status")
security_level: str = Field(..., description="Security level")
is_active: bool = Field(True, description="Active status")
square_footage: int = Field(..., gt=0, description="Total square footage")
available_space: int = Field(..., ge=0, description="Available space")
class SchoolCreate(SchoolBase):
class Config:
schema_extra = {
"example": {
"name": "Central School",
"address": "123 Education St",
"capacity": 1000,
"storage_type": "Standard",
"temperature_controlled": False,
"security_level": "Medium",
"is_active": True,
"square_footage": 50000,
"available_space": 20000
}
}
class School(SchoolBase):
id: int = Field(..., description="School ID")
class Config:
orm_mode = True
schema_extra = {
"example": {
"id": 1,
"name": "Central School",
"address": "123 Education St",
"capacity": 1000,
"storage_type": "Standard",
"temperature_controlled": False,
"security_level": "Medium",
"is_active": True,
"square_footage": 50000,
"available_space": 20000
}
}