Files
maziggy f761a3ae97 fix(queue): every way of adding a job announces it, applies the default print options and keeps its cost centre
- File Manager, webhook, virtual printer, pipeline runs and order dispatch
  send the "Job added" notification (one summary per printer) and the MQTT
  queue/job_added event (one per job), after the commit, never failing the add.
- File Manager, webhook and pipeline jobs use the default print options; the
  VP reads them from the same helper.
- Order copies keep their cost centre; with billing on, dispatch is refused
  when the dispatcher may not use it, the copies have none, or its budget
  cannot cover every copy.
- A scheduled_time with a UTC offset is converted to UTC (queue create/edit/
  bulk edit, webhook); the Postgres bind hook converts instead of stripping.
2026-10-17 15:33:17 +02:00

38 lines
1.1 KiB
Python

from pydantic import BaseModel, Field
from backend.app.schemas.print_queue import NaiveUTCDatetime, UTCDatetime
class ScheduledDryingCreate(BaseModel):
printer_id: int
ams_id: int = 0
temp: int = Field(ge=45, le=85)
duration_hours: int = Field(ge=1, le=24)
# max_length matches the String(50) column: without it PostgreSQL 500s on
# an over-long value and SQLite silently accepts it.
filament: str = Field("", max_length=50)
rotate_tray: bool = False
start_after: NaiveUTCDatetime = None
class ScheduledDryingResponse(BaseModel):
id: int
printer_id: int
ams_id: int
temp: int
duration_hours: int
filament: str
rotate_tray: bool
# UTCDatetime, not a bare datetime: every queue route sends the Z suffix and
# the frontend parses these the same way.
start_after: UTCDatetime
status: str
waiting_reason: str | None
error_message: str | None
error_code: str | None = None
created_at: UTCDatetime
started_at: UTCDatetime
completed_at: UTCDatetime
model_config = {"from_attributes": True}