From edde9e441fb6b84e9d56215d6e2a8d9338b8f962 Mon Sep 17 00:00:00 2001 From: Christophe Besson Date: Tue, 11 Aug 2026 12:40:13 +0200 Subject: feat(hub): Phase 10.5–10.8, 10.10 — notifications, settings, search, version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 10.5: Notification model + CRUD API (list, mark read, mark all read) Triggered on: group invite, role change, suspend/unsuspend - 10.6: SettingsPage shows role, per-group notification mute (localStorage) - 10.7: GET /v1/groups?q= search filter (ilike on name) - 10.8: NotificationFeed on home page + bell with unread badge in navbar - 10.10: GET /v1/hub/version endpoint for client update checks - 8 new tests (test_notifications.py), 155 total Co-Authored-By: Claude Opus 4.6 --- packages/meshbay-hub/src/meshbay_hub/db/models.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'packages/meshbay-hub/src/meshbay_hub/db/models.py') diff --git a/packages/meshbay-hub/src/meshbay_hub/db/models.py b/packages/meshbay-hub/src/meshbay_hub/db/models.py index d06bcda..c420661 100644 --- a/packages/meshbay-hub/src/meshbay_hub/db/models.py +++ b/packages/meshbay-hub/src/meshbay_hub/db/models.py @@ -195,6 +195,26 @@ class SwarmSource(Base): __table_args__ = (Index("ix_swarm_hash", "content_hash"),) +class Notification(Base): + __tablename__ = "notifications" + + 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) + 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)) + read: Mapped[bool] = mapped_column(Boolean, default=False) + created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), default=_now) + + user: Mapped["User"] = relationship() + + __table_args__ = ( + Index("ix_notifications_user", "user_id"), + Index("ix_notifications_created", "created_at"), + ) + + class ContentReport(Base): """ Report of a public content hash for moderation. -- cgit v1.2.3