tango-app-api-trax 3.3.1-hotfix-10 → 3.3.1-hotfix-12

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-10",
3
+ "version": "3.3.1-hotfix-12",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -18,7 +18,7 @@ import timeZone from 'dayjs/plugin/timezone.js';
18
18
  import utc from 'dayjs/plugin/utc.js';
19
19
  import { logger } from 'tango-app-api-middleware';
20
20
  import mongoose from 'mongoose';
21
- import { sendPushNotification } from 'tango-app-api-middleware';
21
+ import { sendPushNotification, sendAiPushNotification } from 'tango-app-api-middleware';
22
22
  // import * as planoService from '../services/planogram.service.js';
23
23
  import * as clusterServices from '../services/cluster.service.js';
24
24
  import * as teamsServices from '../services/teams.service.js';
@@ -1676,11 +1676,13 @@ export async function internalAISendPushNotification( req, res ) {
1676
1676
  return res.sendSuccess( 'Notification Send Successfully' );
1677
1677
  }
1678
1678
  let custom = {
1679
+ title: requestData.title,
1680
+ description: requestData.description,
1679
1681
  type: req.body?.type,
1680
1682
  storeId: req.body?.storeId,
1681
1683
  date: req.body?.date,
1682
1684
  };
1683
- let responseData = await sendPushNotification( requestData.title, requestData.description, fcmToken, custom );
1685
+ let responseData = await sendAiPushNotification( fcmToken, custom );
1684
1686
  if ( responseData ) {
1685
1687
  return res.sendSuccess( 'Notification Send Successfully' );
1686
1688
  } else {
@@ -3426,11 +3426,19 @@ export async function updatePlanoStatus( req, res ) {
3426
3426
  if ( !processCheckDetails ) {
3427
3427
  return res.sendError( 'No data found', 204 );
3428
3428
  }
3429
- processCheckDetails.checklistStatus = req.body.status;
3430
- processCheckDetails.save();
3429
+ let storeTimeZone = await storeService.findOne( { storeName: { $regex: processCheckDetails.storeName, $options: 'i' }, clientId: processCheckDetails.client_id }, { 'storeProfile.timeZone': 1 } );
3430
+ let currentDateTime;
3431
+ if ( storeTimeZone?.storeProfile?.timeZone ) {
3432
+ currentDateTime = dayjs().tz( storeTimeZone?.storeProfile?.timeZone );
3433
+ } else {
3434
+ currentDateTime = requestData?.currentTime ? dayjs( requestData.currentTime, 'HH:mm:ss' ) : dayjs();
3435
+ }
3436
+ let submitTimeString = currentDateTime.format( 'hh:mm A, DD MMM YYYY' );
3437
+ await processedchecklist.updateOne( { _id: req.body.id }, { checklistStatus: req.body.status, ...( req.body.status == 'inprogress' ) ? { startTime_string: submitTimeString } : { submitTime_string: submitTimeString } } );
3431
3438
  return res.sendSuccess( 'Status updated Successfully' );
3432
3439
  } catch ( e ) {
3433
3440
  logger.error( { error: e, function: 'updatePlanoStatus' } );
3434
3441
  return res.sendError( e, 500 );
3435
3442
  }
3436
3443
  }
3444
+