mirror of
https://github.com/Dvorinka/Bookra.git
synced 2026-10-28 15:51:15 +00:00
notification_cursors table stores one read-cursor per user per tenant; GET /v1/activity returns unreadCount + readAt, POST /v1/activity/read persists the cursor. Reminder dispatches now append reminder.sent / reminder.failed system events so delivery history reaches the feed. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
16 lines
603 B
SQL
16 lines
603 B
SQL
-- +goose Up
|
|
-- Persistent read state for the notification feed: one cursor per
|
|
-- dashboard user per tenant. Events with created_at <= read_at count as
|
|
-- read; everything newer is unread. Per-event flags were rejected — the
|
|
-- feed is an audit list, not a per-item inbox.
|
|
CREATE TABLE notification_cursors (
|
|
tenant_id uuid NOT NULL REFERENCES tenants(id) ON DELETE CASCADE,
|
|
user_subject text NOT NULL,
|
|
read_at timestamptz NOT NULL,
|
|
updated_at timestamptz NOT NULL DEFAULT now(),
|
|
PRIMARY KEY (tenant_id, user_subject)
|
|
);
|
|
|
|
-- +goose Down
|
|
DROP TABLE IF EXISTS notification_cursors;
|