diff --git a/src/services/email_monitor.py b/src/services/email_monitor.py index b874965..a9cf872 100644 --- a/src/services/email_monitor.py +++ b/src/services/email_monitor.py @@ -294,10 +294,10 @@ class EmailMonitor: """Seed the seen_emails table with existing emails on first run.""" async with get_session() as session: # Check if this mailbox has been seeded - result = await session.exec( + result = await session.execute( select(CacheMeta).where(CacheMeta.key == f"seeded_{mailbox}") ) - if result.first(): + if result.scalars().first(): logger.debug(f"Mailbox {mailbox} already seeded") return @@ -334,12 +334,12 @@ class EmailMonitor: async def _is_email_seen(self, email_uid: str, mailbox: str) -> bool: """Check if email has already been processed.""" async with get_session() as session: - result = await session.exec( + result = await session.execute( select(SeenEmail).where( SeenEmail.email_uid == email_uid, SeenEmail.mailbox == mailbox ) ) - return result.first() is not None + return result.scalars().first() is not None async def _mark_as_seen( self, email: EmailSummary, mailbox: str, notification_sent: bool = False @@ -367,12 +367,12 @@ class EmailMonitor: ): """Update the notification status for a seen email.""" async with get_session() as session: - result = await session.exec( + result = await session.execute( select(SeenEmail).where( SeenEmail.email_uid == email_uid, SeenEmail.mailbox == mailbox ) ) - seen = result.first() + seen = result.scalars().first() if seen: seen.notification_sent = success seen.notification_sent_at = datetime.utcnow() if success else None