scheduled_drying.py 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. from pydantic import BaseModel, Field
  2. from backend.app.schemas.print_queue import NaiveUTCDatetime, UTCDatetime
  3. class ScheduledDryingCreate(BaseModel):
  4. printer_id: int
  5. ams_id: int = 0
  6. temp: int = Field(ge=45, le=85)
  7. duration_hours: int = Field(ge=1, le=24)
  8. # max_length matches the String(50) column: without it PostgreSQL 500s on
  9. # an over-long value and SQLite silently accepts it.
  10. filament: str = Field("", max_length=50)
  11. rotate_tray: bool = False
  12. start_after: NaiveUTCDatetime = None
  13. class ScheduledDryingResponse(BaseModel):
  14. id: int
  15. printer_id: int
  16. ams_id: int
  17. temp: int
  18. duration_hours: int
  19. filament: str
  20. rotate_tray: bool
  21. # UTCDatetime, not a bare datetime: every queue route sends the Z suffix and
  22. # the frontend parses these the same way.
  23. start_after: UTCDatetime
  24. status: str
  25. waiting_reason: str | None
  26. error_message: str | None
  27. error_code: str | None = None
  28. created_at: UTCDatetime
  29. started_at: UTCDatetime
  30. completed_at: UTCDatetime
  31. model_config = {"from_attributes": True}