committed

This commit is contained in:
2025-01-10 13:03:41 +05:30
parent 4ba496b8eb
commit 52f746308f
17 changed files with 1689 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
const Notification = require('../models/notification');
async function checkDuplication(notification) {
const oneHourAgo = new Date(Date.now() - 60 * 60 * 1000);
const similarNotification = await Notification.findOne({
userId: notification.userId,
message: notification.message,
createdAt: { $gte: oneHourAgo },
status: 'sent'
});
return !!similarNotification;
}
module.exports = { checkDuplication };