Initial commit
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
from datetime import datetime, timezone
|
||||
from typing import Optional
|
||||
from sqlalchemy import Integer, String, DateTime, Text, ForeignKey
|
||||
from sqlalchemy.orm import mapped_column, Mapped
|
||||
from app.database import Base
|
||||
|
||||
|
||||
class NotificationLog(Base):
|
||||
__tablename__ = "notification_logs"
|
||||
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True, index=True)
|
||||
webhook_config_id: Mapped[int] = mapped_column(
|
||||
Integer, ForeignKey("webhook_configs.id", ondelete="CASCADE"), index=True
|
||||
)
|
||||
webhook_name: Mapped[str] = mapped_column(String(255), default="")
|
||||
event_type: Mapped[str] = mapped_column(String(64), nullable=False)
|
||||
payload_json: Mapped[str] = mapped_column(Text, default="{}")
|
||||
# success | failed
|
||||
status: Mapped[str] = mapped_column(String(16), nullable=False)
|
||||
response_text: Mapped[Optional[str]] = mapped_column(Text, nullable=True)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime, default=lambda: datetime.now(timezone.utc), index=True)
|
||||
Reference in New Issue
Block a user