Add printer types with bed volume + add-printer UI
- PrinterType model: name, bed_x_mm/y/z, linked to Printer via type_id - Migration 0002: creates printer_types, adds type_id to printers, drops model - /printer-types page: table + Add Type modal form - /printers page: Add Printer modal with type dropdown (disabled if no types) - API: GET/POST/DELETE /api/printer-types Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import enum
|
||||
from datetime import datetime
|
||||
|
||||
from sqlalchemy import DateTime, Enum, String, func
|
||||
from sqlalchemy import DateTime, Enum, ForeignKey, String, func
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
||||
from app.models.base import Base
|
||||
@@ -19,8 +19,8 @@ class Printer(Base):
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
name: Mapped[str] = mapped_column(String(100))
|
||||
model: Mapped[str | None] = mapped_column(String(100))
|
||||
location: Mapped[str | None] = mapped_column(String(100))
|
||||
type_id: Mapped[int | None] = mapped_column(ForeignKey("printer_types.id"))
|
||||
status: Mapped[PrinterStatus] = mapped_column(
|
||||
Enum(PrinterStatus), default=PrinterStatus.offline
|
||||
)
|
||||
@@ -29,5 +29,6 @@ class Printer(Base):
|
||||
DateTime, server_default=func.now(), onupdate=func.now()
|
||||
)
|
||||
|
||||
printer_type: Mapped["PrinterType | None"] = relationship(back_populates="printers")
|
||||
jobs: Mapped[list["PrintJob"]] = relationship(back_populates="printer")
|
||||
todos: Mapped[list["Todo"]] = relationship(back_populates="printer")
|
||||
|
||||
Reference in New Issue
Block a user