Skip to content

Commit b14e314

Browse files
author
Sachin Maheshwari
committed
typo and adding sql query to get duplicate broadcast notifications
1 parent 9b337d7 commit b14e314

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

migrations/v2.0.4.sql

+8
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,11 @@ AND type = 'admin.notification.broadcast';
2727

2828
-- make unique column to avoid duplicate insert
2929
ALTER TABLE bulk_message_user_refs ADD UNIQUE (bulk_message_id, user_id);
30+
31+
-- get duplicate broadcast rows
32+
SELECT * FROM "Notifications" AS a
33+
LEFT JOIN "bulk_message_user_refs" AS b
34+
ON a.id=b.notification_id
35+
WHERE a.type='admin.notification.broadcast'
36+
AND b.id IS NULL;
37+

src/hooks/hookBulkMessage.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ async function insertUserRefs(userId, bulkMessageId, notificationObj) {
136136
if (notificationId && notificationObj) {
137137
try {
138138
await notificationObj.destroy()
139-
logger.info(`Deleted duplicate/ref-transaction failed, broadcast notification ${notificationId} for user: ${userid}`)
139+
logger.info(`Deleted/reverted duplicate/ref-transaction failed, broadcast notification ${notificationId} for user: ${userId}`)
140140
} catch (error) {
141141
logger.error(`Error in deleting duplicate notification record, ${error}`)
142142
}

0 commit comments

Comments
 (0)