slot_refresh_status.py 761 B

123456789101112131415161718192021222324252627282930313233343536
  1. from pydantic import BaseModel
  2. from datetime import datetime
  3. from typing import Optional
  4. class RefreshBase(BaseModel):
  5. routing_key: str
  6. country: Optional[str] = None
  7. city: Optional[str] = None
  8. visa_type: Optional[str] = None
  9. snapshot_source: str
  10. class RefreshStart(BaseModel):
  11. routing_key: str
  12. country: str
  13. city: str
  14. visa_type: str
  15. snapshot_source: str
  16. class RefreshFail(RefreshBase):
  17. error: str
  18. class RefreshStatusOut(BaseModel):
  19. routing_key: str
  20. country: str
  21. city: str
  22. visa_type: str
  23. snapshot_source: str
  24. last_refresh_at: datetime
  25. last_success_at: Optional[datetime]
  26. last_error: Optional[str]
  27. updated_at: datetime
  28. model_config = {
  29. "from_attributes": True
  30. }