"""Layout model – stores a floor-plan / property map with placed device widgets.""" from datetime import datetime from app import db class Layout(db.Model): __tablename__ = "layouts" id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(128), nullable=False) description = db.Column(db.String(256), nullable=True) # Custom JSON schema (not raw Konva JSON) so we stay schema-independent: # { # "structure": [ {id, tool, x, y, w, h, rotation, text, points}, … ], # "devices": [ {id, boardId, entityType, entityNum, x, y}, … ] # } canvas_json = db.Column(db.Text, nullable=True) # PNG data-url for thumbnail shown on the list page thumbnail_b64 = db.Column(db.Text, nullable=True) created_at = db.Column(db.DateTime, default=datetime.utcnow) updated_at = db.Column(db.DateTime, default=datetime.utcnow, onupdate=datetime.utcnow) def __repr__(self): return f""