Flask + Vue rewrite of the classic-ASP shopdb, built as a plugin framework so sister GE Aerospace sites can adopt it. Product version 0.7.0-pre-0.8.0, plugin contract 0.11.0, 966 backend tests. Key entry points: - docs/INSTALL-WINDOWS-IIS.md - tested Windows + IIS install runbook (own-site and subpath deployment methods) - docs/PILOT-DEPLOY.md - production pilot: stand up + import + verify - docs/IMPORT-API.md - schema-agnostic legacy data import contract - scripts/site_imports/wjf/ - West Jefferson reference import loader - docs/adr/ - twelve accepted architecture decision records
32 lines
866 B
Python
32 lines
866 B
Python
"""Business Unit model."""
|
|
|
|
from shopdb.extensions import db
|
|
from .base import BaseModel
|
|
|
|
|
|
class BusinessUnit(BaseModel):
|
|
"""Business unit / department model."""
|
|
__tablename__ = 'businessunits'
|
|
|
|
businessunitid = db.Column(db.Integer, primary_key=True)
|
|
businessunit = db.Column(db.String(100), unique=True, nullable=False)
|
|
code = db.Column(db.String(20), unique=True, comment='Short code')
|
|
description = db.Column(db.Text)
|
|
|
|
# Optional parent for hierarchy
|
|
parentid = db.Column(
|
|
db.Integer,
|
|
db.ForeignKey('businessunits.businessunitid'),
|
|
nullable=True
|
|
)
|
|
|
|
# Self-referential relationship for hierarchy
|
|
parent = db.relationship(
|
|
'BusinessUnit',
|
|
remote_side=[businessunitid],
|
|
backref='children'
|
|
)
|
|
|
|
def __repr__(self):
|
|
return f"<BusinessUnit {self.businessunit}>"
|