- 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>
21 lines
444 B
Python
21 lines
444 B
Python
import os
|
|
from pathlib import Path
|
|
|
|
_SUPPORTED = {".stl", ".3mf", ".gcode"}
|
|
|
|
|
|
def get_stl_dir() -> Path:
|
|
d = Path(os.environ.get("STL_UPLOAD_DIR", "/data/stl"))
|
|
d.mkdir(parents=True, exist_ok=True)
|
|
return d
|
|
|
|
|
|
def list_stl_files() -> list[str]:
|
|
try:
|
|
return sorted(
|
|
f.name for f in get_stl_dir().iterdir()
|
|
if f.suffix.lower() in _SUPPORTED
|
|
)
|
|
except FileNotFoundError:
|
|
return []
|