From ee68fb86d26c37143c829123e7d01c7e9f216f2c Mon Sep 17 00:00:00 2001 From: CREDO23 Date: Thu, 15 Jan 2026 16:37:46 +0200 Subject: [PATCH] Add ChatCommentMention model to db.py --- surfsense_backend/app/db.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/surfsense_backend/app/db.py b/surfsense_backend/app/db.py index c31909860..f59dc48e9 100644 --- a/surfsense_backend/app/db.py +++ b/surfsense_backend/app/db.py @@ -479,6 +479,32 @@ class ChatComment(BaseModel, TimestampMixin): ) +class ChatCommentMention(BaseModel, TimestampMixin): + """ + Tracks @mentions in chat comments for notification purposes. + """ + + __tablename__ = "chat_comment_mentions" + + comment_id = Column( + Integer, + ForeignKey("chat_comments.id", ondelete="CASCADE"), + nullable=False, + index=True, + ) + mentioned_user_id = Column( + UUID(as_uuid=True), + ForeignKey("user.id", ondelete="CASCADE"), + nullable=False, + index=True, + ) + read = Column(Boolean, nullable=False, default=False) + + # Relationships + comment = relationship("ChatComment", back_populates="mentions") + mentioned_user = relationship("User") + + class Document(BaseModel, TimestampMixin): __tablename__ = "documents"