organization.py 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. """
  2. Pydantic schemas for Organization model.
  3. """
  4. from datetime import datetime
  5. from pydantic import BaseModel, EmailStr
  6. class OrganizationBase(BaseModel):
  7. """Base organization schema."""
  8. name: str
  9. contact_email: EmailStr
  10. contact_phone: str | None = None
  11. class OrganizationCreate(OrganizationBase):
  12. """Schema for creating an organization."""
  13. wifi_enabled: bool = False
  14. ble_enabled: bool = False
  15. class OrganizationUpdate(BaseModel):
  16. """Schema for updating an organization."""
  17. name: str | None = None
  18. contact_email: EmailStr | None = None
  19. contact_phone: str | None = None
  20. wifi_enabled: bool | None = None
  21. ble_enabled: bool | None = None
  22. status: str | None = None
  23. notes: str | None = None
  24. class OrganizationResponse(OrganizationBase):
  25. """Schema for organization response."""
  26. id: int
  27. wifi_enabled: bool
  28. ble_enabled: bool
  29. status: str
  30. notes: str | None
  31. created_at: datetime
  32. class Config:
  33. from_attributes = True
  34. class OrganizationListResponse(BaseModel):
  35. """Schema for list of organizations."""
  36. organizations: list[OrganizationResponse]
  37. total: int