Add job creation with UUID, STL upload/library, search, job log, TZ, and CLAUDE.md
- PrintJob: job_uuid (UUID4), customer, logs relationship - JobLog model + migration 0004 (also includes job_logs table) - POST /jobs: upload STL or select from library, auto-logs 'Job created' - GET /jobs?q=: search by customer or filename across all statuses - app/stl.py: STL_UPLOAD_DIR helper (from env, default /data/stl) - docker-compose: named volume stl_files mounted at /data/stl - .env.install: added STL_UPLOAD_DIR and TZ=Europe/Berlin - CLAUDE.md: full project context for future sessions Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import enum
|
||||
import uuid as _uuid
|
||||
from datetime import datetime
|
||||
from decimal import Decimal
|
||||
|
||||
@@ -20,9 +21,11 @@ class PrintJob(Base):
|
||||
__tablename__ = "print_jobs"
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
job_uuid: Mapped[str | None] = mapped_column(String(36), unique=True, default=lambda: str(_uuid.uuid4()))
|
||||
printer_id: Mapped[int] = mapped_column(ForeignKey("printers.id"))
|
||||
filament_id: Mapped[int | None] = mapped_column(ForeignKey("filaments.id"))
|
||||
name: Mapped[str] = mapped_column(String(200))
|
||||
customer: Mapped[str | None] = mapped_column(String(200))
|
||||
file_name: Mapped[str | None] = mapped_column(String(255))
|
||||
status: Mapped[JobStatus] = mapped_column(Enum(JobStatus), default=JobStatus.queued)
|
||||
queue_position: Mapped[int | None] = mapped_column(Integer)
|
||||
@@ -39,3 +42,6 @@ class PrintJob(Base):
|
||||
|
||||
printer: Mapped["Printer"] = relationship(back_populates="jobs")
|
||||
filament: Mapped["Filament | None"] = relationship(back_populates="jobs")
|
||||
logs: Mapped[list["JobLog"]] = relationship(
|
||||
back_populates="job", order_by="JobLog.created_at.desc()"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user