forked from iti-framework/iTi-Flask
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.4 KiB
Python
41 lines
1.4 KiB
Python
from iti.applications.extensions import db
|
|
from iti.applications.common.crud import TimeModelMixin
|
|
from iti.applications.common.utils import BaseSchema
|
|
from apiflask.fields import String, Integer, DateTime, Nested
|
|
|
|
|
|
class IotAlertLog(db.Model, TimeModelMixin):
|
|
"""
|
|
告警日志表
|
|
"""
|
|
__tablename__ = "iot_alert_log"
|
|
id = db.Column(
|
|
db.Integer,
|
|
primary_key=True,
|
|
autoincrement=True,
|
|
comment="标识",
|
|
)
|
|
alert_tag = db.Column(db.String(255), nullable=False, comment="告警标签")
|
|
alert_target_name = db.Column(db.String(255), nullable=False, comment="告警对象名称")
|
|
alert_content = db.Column(db.String(2048), nullable=False, comment="告警文本")
|
|
alert_level = db.Column(db.Integer, nullable=False, comment="告警级别 0-预警,1-一般,2-紧急,3-严重")
|
|
status = db.Column(db.Integer, nullable=False, default=1, comment="状态 1-告警中,0-已恢复")
|
|
trigger_count = db.Column(db.Integer, nullable=False, default=0, comment="触发次数")
|
|
|
|
class IotAlertLogSchema(BaseSchema):
|
|
"""
|
|
告警日志表响应结构
|
|
"""
|
|
class Meta:
|
|
name = "IotAlertLog"
|
|
|
|
id = Integer()
|
|
alert_tag = String()
|
|
alert_target_name = String()
|
|
alert_content = String()
|
|
alert_level = Integer()
|
|
status = Integer()
|
|
trigger_count = Integer()
|
|
created_at = DateTime(format="%Y-%m-%d %H:%M:%S")
|
|
updated_at = DateTime(format="%Y-%m-%d %H:%M:%S")
|