Replace notifications with activity feed
This commit is contained in:
14
backend/services/activityService.js
Normal file
14
backend/services/activityService.js
Normal file
@@ -0,0 +1,14 @@
|
||||
const crypto = require('crypto');
|
||||
|
||||
const recordActivity = async (db, { userId, type = 'info', title, message, link = null }) => {
|
||||
if (!userId || !title || !message) return;
|
||||
|
||||
await db.query(
|
||||
'INSERT INTO notifications (id, user_id, type, title, message, link) VALUES (?, ?, ?, ?, ?, ?)',
|
||||
[crypto.randomUUID(), userId, type, title, message, link]
|
||||
);
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
recordActivity,
|
||||
};
|
||||
Reference in New Issue
Block a user