Notifications
All checks were successful
Build And Test / publish (push) Successful in 45s

This commit is contained in:
2025-12-30 15:45:50 -08:00
parent 4f6098e8c2
commit 0bbb5a5a2c
10 changed files with 752 additions and 3 deletions

View File

@@ -68,3 +68,28 @@ class SyncState(SQLModel, table=True):
resource_id: str = Field(primary_key=True)
last_sync: Optional[datetime] = None
sync_token: Optional[str] = None
class SeenEmail(SQLModel, table=True):
"""Track emails that have been processed for notifications."""
__tablename__ = "seen_emails"
id: Optional[int] = Field(default=None, primary_key=True)
email_uid: str = Field(index=True, description="IMAP UID of the email")
mailbox: str = Field(index=True, description="Mailbox path (e.g., INBOX)")
message_id: Optional[str] = Field(
default=None,
index=True,
description="RFC 2822 Message-ID header for cross-server dedup"
)
from_address: Optional[str] = Field(default=None, description="Sender email for logging")
subject: Optional[str] = Field(default=None, description="Subject for logging")
email_date: Optional[datetime] = Field(default=None, description="Email date")
seen_at: datetime = Field(default_factory=datetime.utcnow)
notification_sent: bool = Field(default=False)
notification_sent_at: Optional[datetime] = None
notification_error: Optional[str] = Field(
default=None,
description="Last error if notification failed"
)