mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-26 01:06:23 +02:00
feat: add archived column to notifications and implement archiving functionality
- Introduced an archived boolean column in the notifications table to allow users to archive inbox items without deletion. - Updated Notification model to include the archived field with default value. - Added ArchiveRequest and ArchiveResponse models for handling archive/unarchive operations. - Implemented API endpoint to archive or unarchive notifications, ensuring real-time updates with Electric SQL. - Enhanced InboxSidebar to filter and display archived notifications appropriately.
This commit is contained in:
parent
93aa1dcf3c
commit
22b2d6e400
8 changed files with 178 additions and 39 deletions
|
|
@ -53,8 +53,9 @@ const activeSyncHandles = new Map<string, SyncHandle>();
|
|||
const pendingSyncs = new Map<string, Promise<SyncHandle>>();
|
||||
|
||||
// Version for sync state - increment this to force fresh sync when Electric config changes
|
||||
// Set to v2 for user-specific database architecture
|
||||
const SYNC_VERSION = 2;
|
||||
// v2: user-specific database architecture
|
||||
// v3: added archived column to notifications
|
||||
const SYNC_VERSION = 3;
|
||||
|
||||
// Database name prefix for identifying SurfSense databases
|
||||
const DB_PREFIX = "surfsense-";
|
||||
|
|
@ -181,6 +182,7 @@ export async function initElectric(userId: string): Promise<ElectricClient> {
|
|||
title TEXT NOT NULL,
|
||||
message TEXT NOT NULL,
|
||||
read BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
archived BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
metadata JSONB DEFAULT '{}',
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMPTZ
|
||||
|
|
@ -188,6 +190,7 @@ export async function initElectric(userId: string): Promise<ElectricClient> {
|
|||
|
||||
CREATE INDEX IF NOT EXISTS idx_notifications_user_id ON notifications(user_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_notifications_read ON notifications(read);
|
||||
CREATE INDEX IF NOT EXISTS idx_notifications_archived ON notifications(archived);
|
||||
`);
|
||||
|
||||
// Create the search_source_connectors table schema in PGlite
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue