tango-app-api-trax 3.7.55 → 3.7.57

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.7.55",
3
+ "version": "3.7.57",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -307,7 +307,7 @@ export async function PCLconfigCreation( req, res ) {
307
307
  },
308
308
  } );
309
309
  let getSections = await CLquestions.aggregate( sectionQuery );
310
- if ( getSections.length || [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering','queuealert' ].includes( getCLconfig.checkListType ) ) {
310
+ if ( getSections.length || [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert' ].includes( getCLconfig.checkListType ) ) {
311
311
  if ( getSections.length ) {
312
312
  for ( let element3 of getSections ) {
313
313
  let collectQuestions = {};
@@ -631,11 +631,11 @@ export async function PCLconfigCreation( req, res ) {
631
631
  // }
632
632
  }
633
633
  } else {
634
- if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering','queuealert' ].includes( getCLconfig.checkListType ) ) {
634
+ if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert' ].includes( getCLconfig.checkListType ) ) {
635
635
  let storeNameList = allQuestion.map( ( item ) => item.store_id );
636
- let storeDetails = await storeService.find( { clientId: getCLconfig.client_id, status: 'active', ...( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering','queuealert' ].includes( getCLconfig.checkListType ) ) ? { storeId: { $in: storeNameList } } : {} }, { storeId: 1 } );
636
+ let storeDetails = await storeService.find( { clientId: getCLconfig.client_id, status: 'active', ...( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert' ].includes( getCLconfig.checkListType ) ) ? { storeId: { $in: storeNameList } } : {} }, { storeId: 1 } );
637
637
  let storeList = storeDetails.map( ( store ) => store.storeId );
638
- if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering','queuealert' ].includes( getCLconfig.checkListType ) ) {
638
+ if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert' ].includes( getCLconfig.checkListType ) ) {
639
639
  allQuestion = allQuestion.filter( ( ele ) => storeList.includes( ele?.store_id ) );
640
640
  } else {
641
641
  allQuestion = storeDetails.map( ( item ) => {
@@ -669,7 +669,7 @@ export async function PCLconfigCreation( req, res ) {
669
669
  client_id: getCLconfig.client_id,
670
670
  aiStoreList: allQuestion.length ? allQuestion.map( ( store ) => store.store_id ) : [],
671
671
  };
672
- if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering' ,'queuealert'].includes( getCLconfig.checkListType ) ) {
672
+ if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert' ].includes( getCLconfig.checkListType ) ) {
673
673
  let processData = {
674
674
  aiStoreList: allQuestion.length ? allQuestion.map( ( store ) => {
675
675
  return { storeName: store.storeName, storeId: store.store_id, events: store.events };
@@ -910,7 +910,7 @@ async function insertData( requestData ) {
910
910
  },
911
911
  } );
912
912
  let getSections = await CLquestions.aggregate( sectionQuery );
913
- if ( getSections.length || [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering','queuealert' ].includes( getCLconfig.checkListType ) ) {
913
+ if ( getSections.length || [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert' ].includes( getCLconfig.checkListType ) ) {
914
914
  if ( getSections.length ) {
915
915
  for ( let element3 of getSections ) {
916
916
  let collectQuestions = {};
@@ -1205,11 +1205,11 @@ async function insertData( requestData ) {
1205
1205
  // }
1206
1206
  }
1207
1207
  } else {
1208
- if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering' ,'queuealert'].includes( getCLconfig.checkListType ) ) {
1208
+ if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert' ].includes( getCLconfig.checkListType ) ) {
1209
1209
  let storeNameList = allQuestion.map( ( item ) => item.store_id );
1210
- let storeDetails = await storeService.find( { clientId: getCLconfig.client_id, status: 'active', ...( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering','queuealert' ].includes( getCLconfig.checkListType ) ) ? { storeId: { $in: storeNameList } } : {} }, { storeId: 1 } );
1210
+ let storeDetails = await storeService.find( { clientId: getCLconfig.client_id, status: 'active', ...( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert' ].includes( getCLconfig.checkListType ) ) ? { storeId: { $in: storeNameList } } : {} }, { storeId: 1 } );
1211
1211
  let storeList = storeDetails.map( ( store ) => store.storeId );
1212
- if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering','queuealert' ].includes( getCLconfig.checkListType ) ) {
1212
+ if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert' ].includes( getCLconfig.checkListType ) ) {
1213
1213
  allQuestion = allQuestion.filter( ( ele ) => storeList.includes( ele?.store_id ) );
1214
1214
  } else {
1215
1215
  allQuestion = storeDetails.map( ( item ) => {
@@ -1243,7 +1243,7 @@ async function insertData( requestData ) {
1243
1243
  client_id: getCLconfig.client_id,
1244
1244
  aiStoreList: allQuestion.length ? allQuestion.map( ( store ) => store.store_id ) : [],
1245
1245
  };
1246
- if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering','queuealert' ].includes( getCLconfig.checkListType ) ) {
1246
+ if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert' ].includes( getCLconfig.checkListType ) ) {
1247
1247
  let processData = {
1248
1248
  aiStoreList: allQuestion.length ? allQuestion.map( ( store ) => {
1249
1249
  return { storeName: store.storeName, storeId: store.store_id, events: store.events };
@@ -301,7 +301,8 @@ export const checklistPerformance = async ( req, res ) => {
301
301
  findQuery.push( { $addFields: { cheklistlowercase: { $toLower: '$checkListName' } } } );
302
302
  query = { cheklistlowercase: { $in: checkListSearch } };
303
303
  } else {
304
- query = { checkListName: { $regex: requestData.searchValue.trim(), $options: 'i' } };
304
+ const safeSearch = escapeRegex( req.body?.searchValue );
305
+ query = { checkListName: { $regex: safeSearch, $options: 'i' } };
305
306
  }
306
307
  findQuery.push( { $match: { $or: [ query ] } } );
307
308
  }
@@ -4253,7 +4254,9 @@ export async function getUserEmails( req, res ) {
4253
4254
  return res.sendError( e, 500 );
4254
4255
  }
4255
4256
  }
4256
-
4257
+ function escapeRegex( text ) {
4258
+ return text.replace( /[.*+?^${}()|[\]\\]/g, '\\$&' );
4259
+ }
4257
4260
  // async function getChecklistUsers( loginUser ) {
4258
4261
  // try {
4259
4262
  // // userType, role, clientId, userEmail All Key Required Fields