tango-app-api-trax 3.3.1-hotfix-15 → 3.3.1-hotfix-17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-app-api-trax",
3
- "version": "3.3.1-hotfix-15",
3
+ "version": "3.3.1-hotfix-17",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -26,8 +26,8 @@
26
26
  "mongodb": "^6.8.0",
27
27
  "nodemon": "^3.1.4",
28
28
  "path": "^0.12.7",
29
- "tango-api-schema": "^2.2.70",
30
- "tango-app-api-middleware": "^3.1.68",
29
+ "tango-api-schema": "^2.2.78",
30
+ "tango-app-api-middleware": "^3.1.70",
31
31
  "url": "^0.11.4",
32
32
  "winston": "^3.13.1",
33
33
  "winston-daily-rotate-file": "^5.0.0"
@@ -1663,26 +1663,28 @@ export async function internalAISendPushNotification( req, res ) {
1663
1663
  return res.sendError( 'Description is Required', 400 );
1664
1664
  }
1665
1665
 
1666
- let fcmToken;
1666
+ let userData;
1667
1667
  if ( requestData.email && requestData.email !='' ) {
1668
- fcmToken = await getUserToken( requestData.clientId, requestData.email );
1668
+ // fcmToken = await getUserToken( requestData.clientId, requestData.email );
1669
+ userData = await userService.findOne( { clientId: requestData.clientId, email: requestData.email }, { fcmToken: 1, loginFrom: 1 } );
1669
1670
  } else {
1670
1671
  let storeData = await storeService.findOne( { clientId: requestData.clientId, storeId: requestData.storeId }, { spocDetails: 1 } );
1671
1672
  if ( storeData && storeData.spocDetails.length > 0 && storeData.spocDetails[0].email ) {
1672
- fcmToken = await getUserToken( storeData.spocDetails[0].email );
1673
+ // fcmToken = await getUserToken( storeData.spocDetails[0].email );
1674
+ userData = await userService.findOne( { clientId: requestData.clientId, email: requestData.email }, { fcmToken: 1, loginFrom: 1 } );
1673
1675
  }
1674
1676
  }
1675
- if ( !fcmToken ) {
1677
+ if ( !userData ) {
1676
1678
  return res.sendSuccess( 'Notification Send Successfully' );
1677
1679
  }
1678
1680
  let custom = {
1679
1681
  title: requestData.title,
1680
- description: requestData.description,
1682
+ body: requestData.description,
1681
1683
  type: req.body?.type,
1682
1684
  storeId: req.body?.storeId,
1683
1685
  date: req.body?.date,
1684
1686
  };
1685
- let responseData = await sendAiPushNotification( fcmToken, custom );
1687
+ let responseData = await sendAiPushNotification( userData.fcmToken, custom, userData.loginFrom );
1686
1688
  if ( responseData ) {
1687
1689
  return res.sendSuccess( 'Notification Send Successfully' );
1688
1690
  } else {