- add chat_notification_settings table and migration - add chat notifications API (get/update muted) - skip message notifications for muted recipients - add mute/unmute control in chat info panel
This commit is contained in:
@@ -57,3 +57,19 @@ class ChatMember(Base):
|
||||
|
||||
chat: Mapped["Chat"] = relationship(back_populates="members")
|
||||
user: Mapped["User"] = relationship(back_populates="memberships")
|
||||
|
||||
|
||||
class ChatNotificationSetting(Base):
|
||||
__tablename__ = "chat_notification_settings"
|
||||
__table_args__ = (UniqueConstraint("chat_id", "user_id", name="uq_chat_notification_settings_chat_user"),)
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True, index=True)
|
||||
chat_id: Mapped[int] = mapped_column(ForeignKey("chats.id", ondelete="CASCADE"), nullable=False, index=True)
|
||||
user_id: Mapped[int] = mapped_column(ForeignKey("users.id", ondelete="CASCADE"), nullable=False, index=True)
|
||||
muted: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False, server_default="false")
|
||||
updated_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True),
|
||||
server_default=func.now(),
|
||||
onupdate=func.now(),
|
||||
nullable=False,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user