This commit is contained in:
HotSwapp
2025-08-18 20:20:04 -05:00
parent 89b2bc0aa2
commit bac8cc4bd5
114 changed files with 30258 additions and 1341 deletions

View File

@@ -188,4 +188,33 @@ class FileAlert(BaseModel):
def __repr__(self):
status = "🔔" if self.is_active and not self.is_acknowledged else ""
return f"<FileAlert({status} {self.alert_type} - {self.file_no} on {self.alert_date})>"
return f"<FileAlert({status} {self.alert_type} - {self.file_no} on {self.alert_date})>"
class FileRelationship(BaseModel):
"""
Track relationships between files (e.g., related, parent/child, duplicate).
Enables cross-referencing and conflict checks.
"""
__tablename__ = "file_relationships"
id = Column(Integer, primary_key=True, autoincrement=True)
source_file_no = Column(String(45), ForeignKey("files.file_no"), nullable=False, index=True)
target_file_no = Column(String(45), ForeignKey("files.file_no"), nullable=False, index=True)
# Relationship metadata
relationship_type = Column(String(45), nullable=False) # related, parent, child, duplicate, conflict, referral
notes = Column(Text)
# Who created it (cached for reporting)
created_by_user_id = Column(Integer, ForeignKey("users.id"))
created_by_name = Column(String(100))
# Relationships
source_file = relationship("File", foreign_keys=[source_file_no])
target_file = relationship("File", foreign_keys=[target_file_no])
def __repr__(self):
return (
f"<FileRelationship({self.source_file_no} -[{self.relationship_type}]-> {self.target_file_no})>"
)