tango-app-api-trax 3.7.28 → 3.7.30

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,11 +1,11 @@
1
1
  {
2
2
  "name": "tango-app-api-trax",
3
- "version": "3.7.28",
3
+ "version": "3.7.30",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
7
7
  "scripts": {
8
- "start": "nodemon --exec \"eslint --fix . && node app.js\""
8
+ "start": "nodemon --exec \"eslint --fix . && node index.js\""
9
9
  },
10
10
  "engines": {
11
11
  "node": ">=18.10.0"
@@ -27,7 +27,7 @@
27
27
  "mongodb": "^6.8.0",
28
28
  "nodemon": "^3.1.4",
29
29
  "path": "^0.12.7",
30
- "tango-api-schema": "^2.5.31",
30
+ "tango-api-schema": "^2.5.32",
31
31
  "tango-app-api-middleware": "^3.5.2",
32
32
  "url": "^0.11.4",
33
33
  "winston": "^3.13.1",
@@ -305,7 +305,7 @@ export async function PCLconfigCreation( req, res ) {
305
305
  },
306
306
  } );
307
307
  let getSections = await CLquestions.aggregate( sectionQuery );
308
- if ( getSections.length || [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'queuealert', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance' ].includes( getCLconfig.checkListType ) ) {
308
+ if ( getSections.length || [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'queuealert', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking', 'halfshutter' ].includes( getCLconfig.checkListType ) ) {
309
309
  if ( getSections.length ) {
310
310
  for ( let element3 of getSections ) {
311
311
  let collectQuestions = {};
@@ -604,11 +604,11 @@ export async function PCLconfigCreation( req, res ) {
604
604
  // }
605
605
  }
606
606
  } else {
607
- if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'queuealert', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance' ].includes( getCLconfig.checkListType ) ) {
607
+ if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'queuealert', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking', 'halfshutter' ].includes( getCLconfig.checkListType ) ) {
608
608
  let storeNameList = allQuestion.map( ( item ) => item.store_id );
609
- let storeDetails = await storeService.find( { clientId: getCLconfig.client_id, status: 'active', ...( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance' ].includes( getCLconfig.checkListType ) ) ? { storeId: { $in: storeNameList } } : {} }, { storeId: 1 } );
609
+ let storeDetails = await storeService.find( { clientId: getCLconfig.client_id, status: 'active', ...( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking', 'halfshutter' ].includes( getCLconfig.checkListType ) ) ? { storeId: { $in: storeNameList } } : {} }, { storeId: 1 } );
610
610
  let storeList = storeDetails.map( ( store ) => store.storeId );
611
- if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance' ].includes( getCLconfig.checkListType ) ) {
611
+ if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking', 'halfshutter' ].includes( getCLconfig.checkListType ) ) {
612
612
  allQuestion = allQuestion.filter( ( ele ) => storeList.includes( ele?.store_id ) );
613
613
  } else {
614
614
  allQuestion = storeDetails.map( ( item ) => {
@@ -642,7 +642,7 @@ export async function PCLconfigCreation( req, res ) {
642
642
  client_id: getCLconfig.client_id,
643
643
  aiStoreList: allQuestion.length ? allQuestion.map( ( store ) => store.store_id ) : [],
644
644
  };
645
- if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance' ].includes( getCLconfig.checkListType ) ) {
645
+ if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking', 'halfshutter' ].includes( getCLconfig.checkListType ) ) {
646
646
  let processData = {
647
647
  aiStoreList: allQuestion.length ? allQuestion.map( ( store ) => {
648
648
  return { storeName: store.storeName, storeId: store.store_id, events: store.events };
@@ -883,7 +883,7 @@ async function insertData( requestData ) {
883
883
  },
884
884
  } );
885
885
  let getSections = await CLquestions.aggregate( sectionQuery );
886
- if ( getSections.length || [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'queuealert', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance' ].includes( getCLconfig.checkListType ) ) {
886
+ if ( getSections.length || [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'queuealert', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking', 'halfshutter' ].includes( getCLconfig.checkListType ) ) {
887
887
  if ( getSections.length ) {
888
888
  for ( let element3 of getSections ) {
889
889
  let collectQuestions = {};
@@ -1178,11 +1178,11 @@ async function insertData( requestData ) {
1178
1178
  // }
1179
1179
  }
1180
1180
  } else {
1181
- if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'queuealert', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance' ].includes( getCLconfig.checkListType ) ) {
1181
+ if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'queuealert', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking', 'halfshutter' ].includes( getCLconfig.checkListType ) ) {
1182
1182
  let storeNameList = allQuestion.map( ( item ) => item.store_id );
1183
- let storeDetails = await storeService.find( { clientId: getCLconfig.client_id, status: 'active', ...( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance' ].includes( getCLconfig.checkListType ) ) ? { storeId: { $in: storeNameList } } : {} }, { storeId: 1 } );
1183
+ let storeDetails = await storeService.find( { clientId: getCLconfig.client_id, status: 'active', ...( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking', 'halfshutter' ].includes( getCLconfig.checkListType ) ) ? { storeId: { $in: storeNameList } } : {} }, { storeId: 1 } );
1184
1184
  let storeList = storeDetails.map( ( store ) => store.storeId );
1185
- if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance' ].includes( getCLconfig.checkListType ) ) {
1185
+ if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking', 'halfshutter' ].includes( getCLconfig.checkListType ) ) {
1186
1186
  allQuestion = allQuestion.filter( ( ele ) => storeList.includes( ele?.store_id ) );
1187
1187
  } else {
1188
1188
  allQuestion = storeDetails.map( ( item ) => {
@@ -1216,7 +1216,7 @@ async function insertData( requestData ) {
1216
1216
  client_id: getCLconfig.client_id,
1217
1217
  aiStoreList: allQuestion.length ? allQuestion.map( ( store ) => store.store_id ) : [],
1218
1218
  };
1219
- if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance' ].includes( getCLconfig.checkListType ) ) {
1219
+ if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking', 'halfshutter' ].includes( getCLconfig.checkListType ) ) {
1220
1220
  let processData = {
1221
1221
  aiStoreList: allQuestion.length ? allQuestion.map( ( store ) => {
1222
1222
  return { storeName: store.storeName, storeId: store.store_id, events: store.events };
@@ -606,7 +606,7 @@ export const flagCardsV1 = async ( req, res ) => {
606
606
  {
607
607
  client_id: clientId,
608
608
  publish: true,
609
- checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance' ] },
609
+ checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum', 'outsidebusinesshoursqueuetracking', 'halfshutter' ] },
610
610
  },
611
611
  { checkListType: 1 },
612
612
  );
@@ -2738,7 +2738,7 @@ export const checklistDropdownV1 = async ( req, res ) => {
2738
2738
  $or: [
2739
2739
  { questionFlag: { $gte: 1 } },
2740
2740
  { timeFlag: { $gte: 1 } },
2741
- { checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance' ] } },
2741
+ { checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum', 'outsidebusinesshoursqueuetracking', 'halfshutter' ] } },
2742
2742
  {
2743
2743
  runAIQuestionCount: { $gte: 1 },
2744
2744
  },
@@ -2940,7 +2940,7 @@ export const flagComparisonCardsV2 = async ( req, res ) => {
2940
2940
  {
2941
2941
  client_id: requestData.clientId,
2942
2942
  publish: true,
2943
- checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance' ] },
2943
+ checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum', 'outsidebusinesshoursqueuetracking', 'halfshutter' ] },
2944
2944
  },
2945
2945
  { checkListType: 1 },
2946
2946
  );
@@ -3042,7 +3042,7 @@ export const flagTablesV2 = async ( req, res ) => {
3042
3042
  }
3043
3043
 
3044
3044
  if ( requestData?.filter === 'all' ) {
3045
- findAndQuery.push( { $or: [ { checkListType: { $in: [ 'custom', 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance' ] } } ] } );
3045
+ findAndQuery.push( { $or: [ { checkListType: { $in: [ 'custom', 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum', 'outsidebusinesshoursqueuetracking', 'halfshutter' ] } } ] } );
3046
3046
  } else if ( requestData?.filter === 'question' ) {
3047
3047
  findAndQuery.push( { checkListType: 'custom' } );
3048
3048
  findAndQuery.push( { questionFlag: { $gte: 1 } } );
@@ -3050,7 +3050,7 @@ export const flagTablesV2 = async ( req, res ) => {
3050
3050
  findAndQuery.push( { checkListType: 'custom' } );
3051
3051
  findAndQuery.push( { timeFlag: { $gte: 1 } } );
3052
3052
  } else if ( requestData?.filter === 'detection' ) {
3053
- findAndQuery.push( { checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance' ] } } );
3053
+ findAndQuery.push( { checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum', 'outsidebusinesshoursqueuetracking', 'halfshutter' ] } } );
3054
3054
  } else if ( requestData?.filter === 'runAI' ) {
3055
3055
  if ( req.body.runAIChecklistName ) {
3056
3056
  findAndQuery.push( { checkListName: { $in: req.body.runAIChecklistName } } );
@@ -596,7 +596,6 @@ export const zoneList = async ( req, res ) => {
596
596
  'Outside Business Hours Queue Tracking',
597
597
  'Store Half Shutter Detection',
598
598
  'Mobile usage detection',
599
- 'Store TV Compliance',
600
599
  ];
601
600
 
602
601
  if ( inputBody.checkListName && allowedChecklists.includes( inputBody.checkListName ) ) {
@@ -4050,7 +4049,7 @@ async function updateOpenSearch( user, data ) {
4050
4049
  export const aiChecklist = async ( req, res ) => {
4051
4050
  try {
4052
4051
  let storeDetails = await storeService.count( { clientId: req.query.clientId, status: 'active' } );
4053
- let aiList = [ 'mobileusagedetection', 'storeopenandclose', 'uniformdetection', 'staffleftinthemiddle', 'customerunattended', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'queuealert', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance' ];
4052
+ let aiList = [ 'mobileusagedetection', 'storeopenandclose', 'uniformdetection', 'staffleftinthemiddle', 'customerunattended', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'queuealert', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking', 'halfshutter' ];
4054
4053
  let checklistDetails = [];
4055
4054
  let publishList = [];
4056
4055
  let unpublishList = [];
@@ -4063,7 +4062,7 @@ export const aiChecklist = async ( req, res ) => {
4063
4062
  checklistDetails = [ ...publishList, ...unpublishList ];
4064
4063
 
4065
4064
  checklistDetails.forEach( ( item ) => {
4066
- if ( ![ 'mobileusagedetection', 'storeopenandclose', 'cleaning', 'scrum', 'uniformdetection', 'staffleftinthemiddle', 'customerunattended', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance' ].includes( item.checkListType ) ) {
4065
+ if ( ![ 'mobileusagedetection', 'storeopenandclose', 'cleaning', 'scrum', 'uniformdetection', 'staffleftinthemiddle', 'customerunattended', 'outsidebusinesshoursqueuetracking', 'halfshutter' ].includes( item.checkListType ) ) {
4067
4066
  item.storeCount = storeDetails;
4068
4067
  }
4069
4068
  } );
@@ -4512,6 +4511,10 @@ export async function updateAssign( req, res ) {
4512
4511
  },
4513
4512
  ];
4514
4513
  let assignUserDetails = await userService.aggregate( query );
4514
+ if ( req.body.coverage == 'store' ) {
4515
+ let storeList = req.body.assignedList.map( ( ele ) => ele?.storeId );
4516
+ storeProfileDetails = await storeService.find( { storeId: { $in: storeList } }, { storeId: 1, city: '$storeProfile.city', country: '$storeProfile.country', state: '$storeProfile.state' } );
4517
+ }
4515
4518
  for ( let assign of req.body.assignedList ) {
4516
4519
  let userDetails = assignUserDetails.find( ( ele ) => ele.email.toLowerCase() == assign.userEmail.toLowerCase() );
4517
4520
  if ( !userDetails ) {
@@ -4534,6 +4537,14 @@ export async function updateAssign( req, res ) {
4534
4537
  userId: userDetails?._id,
4535
4538
  checkListName: checklistDetails.checkListName,
4536
4539
  };
4540
+ if ( assign?.storeId ) {
4541
+ let findStore = storeProfileDetails.find( ( ele ) => ele.storeId == assign?.storeId )?.toObject();
4542
+ if ( findStore ) {
4543
+ data.city = findStore.city;
4544
+ data.country = findStore.country;
4545
+ data.state = findStore.state;
4546
+ }
4547
+ }
4537
4548
  delete data._id;
4538
4549
  assignedUserList.push( data );
4539
4550
  }