tango-app-api-trax 3.9.38 → 3.9.40

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.9.38",
3
+ "version": "3.9.40",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -30,7 +30,7 @@
30
30
  "path": "^0.12.7",
31
31
  "puppeteer": "^24.39.1",
32
32
  "swagger-ui-express": "^5.0.1",
33
- "tango-api-schema": "^2.6.20",
33
+ "tango-api-schema": "^2.6.17",
34
34
  "tango-app-api-middleware": "^3.5.2",
35
35
  "url": "^0.11.4",
36
36
  "winston": "^3.13.1",
@@ -931,7 +931,7 @@ async function insertData( requestData ) {
931
931
  },
932
932
  } );
933
933
  let getSections = await CLquestions.aggregate( sectionQuery );
934
- if ( getSections.length || [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'cleaning', 'scrum', 'suspiciousactivity', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert', 'staffgrouping', 'boxalert', 'employeeCount', 'unattendeddetection', 'employeemonitoring', 'activitymonitoring' ].includes( getCLconfig.checkListType ) ) {
934
+ if ( getSections.length || [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'cleaning', 'scrum', 'suspiciousactivity', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert', 'staffgrouping', 'boxalert', 'employeeCount', 'unattendeddetection', 'employeemonitoring' ].includes( getCLconfig.checkListType ) ) {
935
935
  if ( getSections.length ) {
936
936
  for ( let element3 of getSections ) {
937
937
  let collectQuestions = {};
@@ -1226,11 +1226,11 @@ async function insertData( requestData ) {
1226
1226
  // }
1227
1227
  }
1228
1228
  } else {
1229
- if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'cleaning', 'scrum', 'suspiciousactivity', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert', 'staffgrouping', 'boxalert', 'employeeCount', 'unattendeddetection', 'employeemonitoring', 'activitymonitoring' ].includes( getCLconfig.checkListType ) ) {
1229
+ if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'cleaning', 'scrum', 'suspiciousactivity', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert', 'staffgrouping', 'boxalert', 'employeeCount', 'unattendeddetection', 'employeemonitoring' ].includes( getCLconfig.checkListType ) ) {
1230
1230
  let storeNameList = allQuestion.map( ( item ) => item.store_id );
1231
- let storeDetails = await storeService.find( { clientId: getCLconfig.client_id, status: 'active', ...( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert', 'staffgrouping', 'boxalert', 'employeeCount', 'unattendeddetection', 'employeemonitoring', 'activitymonitoring' ].includes( getCLconfig.checkListType ) ) ? { storeId: { $in: storeNameList } } : {} }, { storeId: 1 } );
1231
+ let storeDetails = await storeService.find( { clientId: getCLconfig.client_id, status: 'active', ...( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert', 'staffgrouping', 'boxalert', 'employeeCount', 'unattendeddetection', 'employeemonitoring' ].includes( getCLconfig.checkListType ) ) ? { storeId: { $in: storeNameList } } : {} }, { storeId: 1 } );
1232
1232
  let storeList = storeDetails.map( ( store ) => store.storeId );
1233
- if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert', 'staffgrouping', 'boxalert', 'employeeCount', 'unattendeddetection', 'employeemonitoring', 'activitymonitoring' ].includes( getCLconfig.checkListType ) ) {
1233
+ if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert', 'staffgrouping', 'boxalert', 'employeeCount', 'unattendeddetection', 'employeemonitoring' ].includes( getCLconfig.checkListType ) ) {
1234
1234
  allQuestion = allQuestion.filter( ( ele ) => storeList.includes( ele?.store_id ) );
1235
1235
  } else {
1236
1236
  allQuestion = storeDetails.map( ( item ) => {
@@ -1334,6 +1334,7 @@ export async function insertTimeDelayFlags( req, res ) {
1334
1334
  checkListName: 1,
1335
1335
  client_id: 1,
1336
1336
  date_iso: 1,
1337
+ coverage: 1,
1337
1338
  },
1338
1339
  } );
1339
1340
 
@@ -1359,6 +1360,13 @@ export async function insertTimeDelayFlags( req, res ) {
1359
1360
  { storeId: data.store_id, clientId: data.client_id },
1360
1361
  { storeProfile: 1 },
1361
1362
  );
1363
+ if ( data.coverage == 'user' ) {
1364
+ getStoreZone = {
1365
+ storeProfile: {
1366
+ timeZone: 'Asia/Kolkata',
1367
+ },
1368
+ };
1369
+ }
1362
1370
  if ( getStoreZone ) {
1363
1371
  let checklistDate = dayjs.utc( data.scheduleEndTime_iso ).format();
1364
1372
  let date = dayjs.utc().tz( getStoreZone.storeProfile.timeZone ).format();
@@ -2515,6 +2523,7 @@ export async function internalAISendPushNotification( req, res ) {
2515
2523
  storeId: req.body?.storeId,
2516
2524
  date: req.body?.date,
2517
2525
  clientId: req.body?.clientId,
2526
+ ...( req.body?.checklistType && { checklistType: req.body?.checklistType } ),
2518
2527
  };
2519
2528
  let responseData = await sendAiPushNotification( userData.fcmToken, custom, userData.loginFrom );
2520
2529
  if ( responseData ) {
@@ -2781,7 +2790,7 @@ export async function countUpdateRunAI( req, res ) {
2781
2790
  };
2782
2791
 
2783
2792
  // complianceCount is already populated for the other answer types; add the image/video scores on top.
2784
- let complianceCount = getDetails.userComplianceCount || 0;
2793
+ let userComplianceTotal = getDetails.userComplianceCount || 0;
2785
2794
 
2786
2795
  // Pull every "Matched/Not Matched" verdict out of a runAIData array, tolerating both shapes we store:
2787
2796
  // 1) [ { answerImage, results: [ { featureName, value } ] } ] (verdict nested under results)
@@ -2820,12 +2829,12 @@ export async function countUpdateRunAI( req, res ) {
2820
2829
  ua.complianceScore = score;
2821
2830
  } );
2822
2831
 
2823
- complianceCount += score;
2832
+ userComplianceTotal += score;
2824
2833
  }
2825
2834
  } );
2826
2835
  } );
2827
2836
 
2828
- updateData.complianceCount = complianceCount;
2837
+ updateData.userComplianceCount = userComplianceTotal;
2829
2838
 
2830
2839
  await processedchecklist.updateOne( { _id: req.body.id }, updateData );
2831
2840
  return res.sendSuccess( 'RunAI Count updated successfully' );