Files
security-alert-center/backend/app/models/notification_cooldown.py
T
PTah 4167687dec feat: notification cooldown dedup for events and problems (notif-31)
Store last notify time by dedup_key/fingerprint, gate dispatch before
channels; config SAC_NOTIFY_*_COOLDOWN_SEC, migration 008.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-29 16:24:01 +10:00

17 lines
569 B
Python

from datetime import datetime
from sqlalchemy import DateTime, String
from sqlalchemy.orm import Mapped, mapped_column
from app.database import Base
class NotificationCooldown(Base):
"""Последняя отправка оповещения по ключу (dedup_key / fingerprint)."""
__tablename__ = "notification_cooldown"
cooldown_key: Mapped[str] = mapped_column(String(512), primary_key=True)
kind: Mapped[str] = mapped_column(String(16)) # event | problem
last_notified_at: Mapped[datetime] = mapped_column(DateTime(timezone=True))