Project

General

Profile

Actions

Activity #3529

open

Feature #3752: Design of the web framework for Data Centre Software

Feature #1850: Design and Development for web based ANRS

Module #3527: Development for in-app real-time notifications

Emit Notifications from Backend

Added by Thara S Pillai over 1 year ago. Updated about 1 year ago.

Status:
In Progress
Priority:
Normal
Assignee:
Start date:
04/25/2025
Due date:
% Done:

70%

Estimated time:
Planned Due Date:
04/28/2025

Description

upon a new user add, update notifications tables
app.post('/add-user', async (req, res) => {
const io = req.app.get('io');

// 1. Insert user
await addUserToDB(req.body);
// 2. Create a notification entry
await createNotification({
type: 'new_user',
message: 'A new user has been added.',
created_at: new Date(),
status: 'unread',
for_role: 'admin'
});
// 3. Notify connected clients
io.emit('new_user_notification');
res.send({ success: true });
});
Actions

Also available in: Atom PDF