Changeset 9a34d31 in Klonkt for src/services/NotificationService.js
- Timestamp:
- 06/21/2026 06:41:31 PM (3 months ago)
- Branches:
- main
- Children:
- e25438a
- Parents:
- c9c6a2d
- File:
-
- 1 edited
-
src/services/NotificationService.js (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/services/NotificationService.js
rc9c6a2d r9a34d31 13 13 try { 14 14 db.prepare(` 15 INSERT INTO notifications (id, user_id, type, actor_id, actor_name, post_slug, post_title, url, read)15 INSERT INTO user_notifications (id, user_id, type, actor_id, actor_name, post_slug, post_title, url, read) 16 16 VALUES (?, ?, ?, ?, ?, ?, ?, ?, 0) 17 17 `).run(randomUUID(), userId, type, actorId || null, actorName || null, postSlug || null, postTitle || null, url || null); … … 21 21 export function unreadCount(userId) { 22 22 if (!userId) return 0; 23 try { return db.prepare('SELECT COUNT(*) AS c FROM notifications WHERE user_id = ? AND read = 0').get(userId).c; }23 try { return db.prepare('SELECT COUNT(*) AS c FROM user_notifications WHERE user_id = ? AND read = 0').get(userId).c; } 24 24 catch { return 0; } 25 25 } … … 27 27 export function list(userId, limit = 50) { 28 28 if (!userId) return []; 29 try { return db.prepare('SELECT * FROM notifications WHERE user_id = ? ORDER BY created_at DESC LIMIT ?').all(userId, limit); }29 try { return db.prepare('SELECT * FROM user_notifications WHERE user_id = ? ORDER BY created_at DESC LIMIT ?').all(userId, limit); } 30 30 catch { return []; } 31 31 } … … 33 33 export function markAllRead(userId) { 34 34 if (!userId) return; 35 try { db.prepare('UPDATE notifications SET read = 1 WHERE user_id = ? AND read = 0').run(userId); } catch { /* noop */ }35 try { db.prepare('UPDATE user_notifications SET read = 1 WHERE user_id = ? AND read = 0').run(userId); } catch { /* noop */ } 36 36 } 37 37
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)