diff options
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/db/models.py')
| -rw-r--r-- | packages/meshbay-hub/src/meshbay_hub/db/models.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/db/models.py b/packages/meshbay-hub/src/meshbay_hub/db/models.py index a75217b..f749204 100644 --- a/packages/meshbay-hub/src/meshbay_hub/db/models.py +++ b/packages/meshbay-hub/src/meshbay_hub/db/models.py @@ -103,6 +103,10 @@ class GroupMember(Base): group_id: Mapped[str] = mapped_column(ForeignKey("groups.id"), primary_key=True) user_id: Mapped[str] = mapped_column(ForeignKey("users.id"), primary_key=True) + # Set here rather than in the browser: a notification nobody wants should not + # be created at all. It used to be a checkbox in localStorage that nothing + # read, so muting a group did nothing whatsoever. + muted: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False) joined_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), default=_now) group: Mapped["Group"] = relationship(back_populates="members") @@ -184,6 +188,10 @@ class Notification(Base): id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True) user_id: Mapped[str] = mapped_column(ForeignKey("users.id"), nullable=False) kind: Mapped[str] = mapped_column(String(32), nullable=False) + # Which group this is about, when it is about one. Chat keeps a single row per + # group and moves its date, so a busy conversation is one line that says when + # it last spoke — not forty lines saying it spoke. + group_id: Mapped[str | None] = mapped_column(ForeignKey("groups.id")) title: Mapped[str] = mapped_column(String(256), nullable=False) detail: Mapped[str | None] = mapped_column(String(512)) link: Mapped[str | None] = mapped_column(String(256)) |