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.
iTi-Flask/iti/applications/models/iot/iot_alert_push.py

31 lines
1.1 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 IotAlertPush(TimeModelMixin, db.Model):
"""
告警推送表
"""
__tablename__ = "iot_alert_push"
id = db.Column(db.Integer, primary_key=True, autoincrement=True, comment="标识")
target_name = db.Column(db.String(255), nullable=False, comment="接收对象名称")
push_url = db.Column(db.String(2048), nullable=False, comment="告警推送URL")
alert_level = db.Column(db.String(255), nullable=False, comment="告警等级")
status = db.Column(db.Integer, nullable=False, default=1, comment="状态 1-启用,0-禁用")
class IotAlertPushSchema(BaseSchema):
"""
告警推送表响应结构
"""
class Meta:
name = "IotAlertPush"
id = Integer()
target_name = String()
push_url = String()
alert_level = String()
status = Integer()
created_at = DateTime(format="%Y-%m-%d %H:%M:%S")
updated_at = DateTime(format="%Y-%m-%d %H:%M:%S")