From d6699b157a84134d3e02e6ad4ad092206b9be4fe Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Thu, 27 Mar 2025 21:20:25 +0000 Subject: [PATCH] Add School schema --- schemas/school.py | 49 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 schemas/school.py diff --git a/schemas/school.py b/schemas/school.py new file mode 100644 index 0000000..1f823f8 --- /dev/null +++ b/schemas/school.py @@ -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 + } + } \ No newline at end of file