mirror of
https://github.com/RichieCahill/dotfiles.git
synced 2026-04-17 04:58:19 -04:00
migrated to tanasty and added dead letter queue
This commit is contained in:
@@ -11,6 +11,7 @@ from python.orm.richie.contact import (
|
||||
Need,
|
||||
RelationshipType,
|
||||
)
|
||||
from python.orm.richie.dead_letter_message import DeadLetterMessage
|
||||
from python.orm.richie.signal_device import SignalDevice
|
||||
|
||||
__all__ = [
|
||||
@@ -18,6 +19,7 @@ __all__ = [
|
||||
"Contact",
|
||||
"ContactNeed",
|
||||
"ContactRelationship",
|
||||
"DeadLetterMessage",
|
||||
"Legislator",
|
||||
"Need",
|
||||
"RelationshipType",
|
||||
|
||||
26
python/orm/richie/dead_letter_message.py
Normal file
26
python/orm/richie/dead_letter_message.py
Normal file
@@ -0,0 +1,26 @@
|
||||
"""Dead letter queue for Signal bot messages that fail processing."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from sqlalchemy import DateTime, Text
|
||||
from sqlalchemy.dialects.postgresql import ENUM
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
|
||||
from python.orm.richie.base import TableBase
|
||||
from python.signal_bot.models import MessageStatus
|
||||
|
||||
|
||||
class DeadLetterMessage(TableBase):
|
||||
"""A Signal message that failed processing and was sent to the dead letter queue."""
|
||||
|
||||
__tablename__ = "dead_letter_message"
|
||||
|
||||
source: Mapped[str]
|
||||
message: Mapped[str] = mapped_column(Text)
|
||||
received_at: Mapped[datetime] = mapped_column(DateTime(timezone=True))
|
||||
status: Mapped[MessageStatus] = mapped_column(
|
||||
ENUM(MessageStatus, name="message_status", create_type=True, schema="main"),
|
||||
default=MessageStatus.UNPROCESSED,
|
||||
)
|
||||
Reference in New Issue
Block a user