Initial commit: Shop Database Flask Application

Flask backend with Vue 3 frontend for shop floor machine management.
Includes database schema export for MySQL shopdb_flask database.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
cproudlock
2026-01-13 16:07:34 -05:00
commit 1196de6e88
188 changed files with 19921 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
"""PrinterData model - printer-specific fields linked to machines."""
from shopdb.extensions import db
from shopdb.core.models.base import BaseModel
class PrinterData(BaseModel):
"""
Printer-specific data linked to Machine table.
Printers are stored in the machines table (machinetype.category = 'Printer').
This table only holds printer-specific fields not in machines.
IP address is stored in the communications table.
Zabbix data is queried in real-time via API (not cached here).
"""
__tablename__ = 'printerdata'
id = db.Column(db.Integer, primary_key=True)
# Link to machine
machineid = db.Column(
db.Integer,
db.ForeignKey('machines.machineid', ondelete='CASCADE'),
unique=True,
nullable=False,
index=True
)
# Windows/Network naming
windowsname = db.Column(
db.String(255),
comment='Windows printer name (e.g., \\\\server\\printer)'
)
sharename = db.Column(
db.String(100),
comment='CSF/share name'
)
# Installation
iscsf = db.Column(db.Boolean, default=False, comment='Is CSF printer')
installpath = db.Column(db.String(255), comment='Driver install path')
# Printer PIN (for secure print)
pin = db.Column(db.String(20))
# Relationship
machine = db.relationship(
'Machine',
backref=db.backref('printerdata', uselist=False, lazy='joined')
)
__table_args__ = (
db.Index('idx_printer_windowsname', 'windowsname'),
)
def __repr__(self):
return f"<PrinterData machineid={self.machineid}>"