15 lines
406 B
JavaScript
15 lines
406 B
JavaScript
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,
|
|
};
|