@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.
@@ -9853,14 +9853,16 @@ async function notifyUsers({
9853
9853
  try {
9854
9854
  await sendPushNotifications(payload);
9855
9855
  const uniqueUserIds = await saveNotificationsInDb(payload);
9856
- if (!pubsub) {
9857
- return;
9858
- }
9859
- for (const userId of uniqueUserIds) {
9860
- await publishNotificationEvents(userId, pubsub);
9856
+ const persisted = payload.userIds.length === 0 || uniqueUserIds.length > 0;
9857
+ if (pubsub) {
9858
+ for (const userId of uniqueUserIds) {
9859
+ await publishNotificationEvents(userId, pubsub);
9860
+ }
9861
9861
  }
9862
+ return persisted;
9862
9863
  } catch (error) {
9863
9864
  console.error("Error in notifyUsers:", error);
9865
+ return false;
9864
9866
  }
9865
9867
  }
9866
9868