@timardex/cluemart-server-shared 1.0.291 → 1.0.292

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -9904,14 +9904,16 @@ async function notifyUsers({
9904
9904
  try {
9905
9905
  await sendPushNotifications(payload);
9906
9906
  const uniqueUserIds = await saveNotificationsInDb(payload);
9907
- if (!pubsub) {
9908
- return;
9909
- }
9910
- for (const userId of uniqueUserIds) {
9911
- await publishNotificationEvents(userId, pubsub);
9907
+ const persisted = payload.userIds.length === 0 || uniqueUserIds.length > 0;
9908
+ if (pubsub) {
9909
+ for (const userId of uniqueUserIds) {
9910
+ await publishNotificationEvents(userId, pubsub);
9911
+ }
9912
9912
  }
9913
+ return persisted;
9913
9914
  } catch (error) {
9914
9915
  console.error("Error in notifyUsers:", error);
9916
+ return false;
9915
9917
  }
9916
9918
  }
9917
9919