mirror of
https://github.com/clucraft/PriceGhost.git
synced 2026-05-12 09:12:40 +02:00
Add Clear button to notification bell dropdown
- Add notifications_cleared_at column to users table - Clear button marks notifications as seen without deleting history - Badge and dropdown only show notifications after last clear - History page still shows all notifications Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
262a91b558
commit
28d6523959
5 changed files with 69 additions and 11 deletions
|
|
@ -69,4 +69,16 @@ router.get('/count', async (req: AuthRequest, res: Response) => {
|
|||
}
|
||||
});
|
||||
|
||||
// Clear notifications (marks as seen, doesn't delete history)
|
||||
router.post('/clear', async (req: AuthRequest, res: Response) => {
|
||||
try {
|
||||
const userId = req.userId!;
|
||||
await notificationHistoryQueries.clear(userId);
|
||||
res.json({ message: 'Notifications cleared' });
|
||||
} catch (error) {
|
||||
console.error('Error clearing notifications:', error);
|
||||
res.status(500).json({ error: 'Failed to clear notifications' });
|
||||
}
|
||||
});
|
||||
|
||||
export default router;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue