Add alerts ssytems to the frontend

This commit is contained in:
Urtzi Alfaro
2025-09-21 17:35:36 +02:00
parent 57fd2f22f0
commit f08667150d
17 changed files with 2086 additions and 786 deletions

View File

@@ -216,7 +216,7 @@ class AlertProcessorService:
tenant_id=item['tenant_id'],
item_type=item['item_type'], # 'alert' or 'recommendation'
alert_type=item['type'],
severity=AlertSeverity(item['severity']),
severity=AlertSeverity(item['severity'].lower()),
status=AlertStatus.ACTIVE,
service=item['service'],
title=item['title'],

View File

@@ -38,8 +38,8 @@ class Alert(Base):
# Alert classification
item_type = Column(String(50), nullable=False) # 'alert' or 'recommendation'
alert_type = Column(String(100), nullable=False) # e.g., 'overstock_warning'
severity = Column(Enum(AlertSeverity), nullable=False, index=True)
status = Column(Enum(AlertStatus), default=AlertStatus.ACTIVE, index=True)
severity = Column(Enum(AlertSeverity, values_callable=lambda obj: [e.value for e in obj]), nullable=False, index=True)
status = Column(Enum(AlertStatus, values_callable=lambda obj: [e.value for e in obj]), default=AlertStatus.ACTIVE, index=True)
# Source and content
service = Column(String(100), nullable=False) # originating service