feat: add account toggle, message dedup tracking, SMTP per-user and Gmail OAuth flow plan

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
Agent-Logs-Url: https://github.com/christianlouis/pop_puller_to_gmail/sessions/b77800ca-b452-4427-b0bf-63403e906916
This commit is contained in:
copilot-swe-agent[bot]
2026-03-25 11:20:22 +00:00
parent a1d258de01
commit a15216c630
6 changed files with 245 additions and 48 deletions
+38
View File
@@ -446,6 +446,44 @@ class AuditLog(Base):
)
class DownloadedMessageId(Base):
"""
Tracks unique message IDs that have already been downloaded and forwarded.
- For POP3: stores the UIDL string returned by the server.
- For IMAP: stores the IMAP UID (numeric string) of the message.
This prevents re-processing the same message when delete_after_forward=False.
"""
__tablename__ = "downloaded_message_ids"
id = Column(Integer, primary_key=True, index=True)
mail_account_id = Column(
Integer, ForeignKey("mail_accounts.id", ondelete="CASCADE"), nullable=False
)
# Unique message identifier (UIDL for POP3, UID for IMAP)
message_uid = Column(String(512), nullable=False)
downloaded_at = Column(
DateTime(timezone=True),
default=lambda: datetime.now(timezone.utc),
nullable=False,
)
# Indexes — unique constraint prevents duplicates
__table_args__ = (
Index(
"idx_account_message_uid",
"mail_account_id",
"message_uid",
unique=True,
),
Index("idx_downloaded_at", "downloaded_at"),
)
class GmailCredential(Base):
"""Stores OAuth2 credentials for Gmail API access (per-user)"""