Skip to content

Self-hosted homelab infrastructure visualizer — interactive network diagram with live status monitoring

fix: declare transient node timestamp attrs on PendingDevice

Pouzor3020b400ed69
diff --git a/backend/app/db/models.py b/backend/app/db/models.py
index 9209b2b..f749cc7 100644
--- a/backend/app/db/models.py
+++ b/backend/app/db/models.py
@@ -100,6 +100,9 @@ class CanvasState(Base):
class PendingDevice(Base):
__tablename__ = "pending_devices"
+ # Permit the plain (non-Mapped[]) annotations on the transient request-only
+ # attributes below; without this SQLAlchemy 2.0 tries to map them as columns.
+ __allow_unmapped__ = True
id: Mapped[str] = mapped_column(String, primary_key=True, default=_uuid)
ip: Mapped[str | None] = mapped_column(String, nullable=True)
@@ -121,6 +124,12 @@ class PendingDevice(Base):
# Transient (not persisted): populated per-request by the scan routes to report
# how many canvases this device already appears on. Not a mapped column.
canvas_count: int = 0
+ # Transient (not persisted): timestamps from the linked canvas node(s),
+ # correlated by ip / ieee_address. None when the device is not on any canvas.
+ node_created_at: datetime | None = None
+ node_last_scan: datetime | None = None
+ node_last_modified: datetime | None = None
+ node_last_seen: datetime | None = None
class PendingDeviceLink(Base):