Source code for orghandbookapi.schemas.building
from pydantic import BaseModel
[docs]
class BuildingBase(BaseModel):
"""Схема валидации базовой модели здания."""
address: str
longitude: float
latitude: float
[docs]
class BuildingCreate(BuildingBase):
"""Схема валидации создания модели здания."""
[docs]
class BuildingUpdate(BaseModel):
"""Схема валидации обновления модели здания."""
address: str | None = None
longitude: float | None = None
latitude: float | None = None
[docs]
class Building(BuildingBase):
"""Схема валидации модели здания."""
id: int
[docs]
class Config:
from_attributes = True
[docs]
class BuildingWithRelations(Building):
"""Схема валидации модели здания с отношениями.""" # noqa: RUF002
organizations: list["Organization"] = []
from .organization import Organization # noqa: E402
BuildingWithRelations.update_forward_refs()