Merge: t-paliad-249 Slice A — inbox overhaul (project_event feed + read cursor + dispatch) (m/paliad#80)

This commit is contained in:
mAi
2026-05-25 15:50:27 +02:00
23 changed files with 1875 additions and 157 deletions

View File

@@ -0,0 +1,4 @@
-- t-paliad-249 — drop inbox read cursor.
ALTER TABLE paliad.users
DROP COLUMN IF EXISTS inbox_seen_at;

View File

@@ -0,0 +1,21 @@
-- t-paliad-249 — /inbox overhaul, Slice A.
-- Add a per-user high-watermark read cursor for the inbox feed
-- (approval requests + curated project_events). The cursor advances
-- only when the user POSTs to /api/inbox/mark-all-seen. NULL means
-- "never visited" → every row counts as unread on first paint.
--
-- Note on the carve-out enforced in service code: pending
-- approval_requests count toward the inbox's unread state regardless
-- of this column. The cursor narrows the project_event source only,
-- so a stale cursor never buries a high-value pending approval.
--
-- Design ref: docs/design-inbox-overhaul-2026-05-25.md §3.
ALTER TABLE paliad.users
ADD COLUMN IF NOT EXISTS inbox_seen_at timestamptz NULL;
COMMENT ON COLUMN paliad.users.inbox_seen_at IS
'High-watermark cursor for the /inbox feed. project_events newer '
'than this timestamp are unread for the caller; NULL = never '
'visited (everything unread). Pending approval_requests bypass '
'this column and stay unread until decided.';