From 9e7cfe7737f4fd5e17f77de43b306acd573d2ff8 Mon Sep 17 00:00:00 2001 From: huangzhuang_3rd Date: Thu, 13 Aug 2026 00:46:09 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20V1=20-=20DAG=E7=BC=96=E6=8E=92/?= =?UTF-8?q?=E5=91=8A=E8=AD=A6=E7=B3=BB=E7=BB=9F/Agent=E5=BE=AA=E7=8E=AF/?= =?UTF-8?q?=E7=9F=A5=E8=AF=86=E5=BA=93RAG/Webhook=20+=20=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=AF=8C=E4=B8=8A=E4=B8=8B=E6=96=87=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/models/alert.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 backend/app/models/alert.py diff --git a/backend/app/models/alert.py b/backend/app/models/alert.py new file mode 100644 index 0000000..a67582a --- /dev/null +++ b/backend/app/models/alert.py @@ -0,0 +1,16 @@ +"""Alert model - budget warnings, task failures, system events.""" +from sqlalchemy import Column, String, Integer, Text, Boolean, ForeignKey +from app.models.base import Base, TimestampMixin, TenantMixin + + +class Alert(Base, TimestampMixin, TenantMixin): + """System alerts: budget warnings, task failures, worker offline.""" + __tablename__ = "alerts" + + id = Column(Integer, primary_key=True, autoincrement=True) + alert_type = Column(String(50), nullable=False) # budget_warning, budget_exceeded, task_failed, worker_offline + severity = Column(String(20), nullable=False, default="warning") # info, warning, critical + message = Column(Text, nullable=False) + project_id = Column(Integer, ForeignKey("projects.id"), nullable=True) + worker_id = Column(Integer, ForeignKey("ai_workers.id"), nullable=True) + is_read = Column(Boolean, default=False, nullable=False)