tango-app-api-trax 3.5.2-alpha-6 → 3.5.2-alpha-8

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.5.2-alpha-6",
3
+ "version": "3.5.2-alpha-8",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -286,7 +286,8 @@ export async function approveChecklist( req, res ) {
286
286
  toDate.setUTCHours( 23, 59, 59, 59 );
287
287
  let query = { sourceCheckList_id: req.body.sourceCheckList_id, date_iso: { $gte: req.body.fromDate, $lte: toDate }, $or: [ { checklistStatus: 'submit' }, { redoStatus: true } ], approvalEnable: true };
288
288
  if ( req.body?.storeId?.length ) {
289
- query['store_id'] = { $in: req.body.storeId };
289
+ const filteredStoreIds = req.body.storeId.filter( ( store ) => req.body.assignedStores.includes( store ) );
290
+ query['store_id'] = { $in: filteredStoreIds };
290
291
  }
291
292
  let checklistDetails = await processedChecklist.find( query, { _id: 1, checklistStatus: 1, storeName: 1, store_id: 1, userEmail: 1, client_id: 1, coverage: 1, checkListName: 1 } );
292
293
  if ( !checklistDetails.length ) {
@@ -324,7 +325,7 @@ export async function approveChecklist( req, res ) {
324
325
  approvalByEmail: req.user.email,
325
326
  },
326
327
  };
327
-
328
+ console.log( params );
328
329
  const requestOptions = {
329
330
  method: 'POST',
330
331
  headers: {
@@ -334,6 +335,8 @@ export async function approveChecklist( req, res ) {
334
335
  };
335
336
  let url = JSON.parse( process.env.LAMBDAURL );
336
337
  let searchResponse = await fetch( url.approveChecklist, requestOptions );
338
+ console.log( searchResponse );
339
+ const filteredStoreIds = req.body.storeId.filter( ( store ) => req.body.assignedStores.includes( store ) );
337
340
  let logData= {
338
341
  'client_id': checklistDetails[0].client_id,
339
342
  'createAt': new Date(),
@@ -351,6 +354,7 @@ export async function approveChecklist( req, res ) {
351
354
  'approved': storeNames,
352
355
  },
353
356
  'userType': req.user.userType,
357
+ 'requestedStores': filteredStoreIds,
354
358
  };
355
359
  console.log( 'logData', logData );
356
360
  let urlopensearch = JSON.parse( process.env.OPENSEARCH );
@@ -296,7 +296,7 @@ export async function PCLconfigCreation( req, res ) {
296
296
  },
297
297
  } );
298
298
  let getSections = await CLquestions.aggregate( sectionQuery );
299
- 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' ].includes( getCLconfig.checkListType ) ) {
299
+ 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' ].includes( getCLconfig.checkListType ) ) {
300
300
  if ( getSections.length ) {
301
301
  for ( let element3 of getSections ) {
302
302
  let collectQuestions = {};
@@ -591,7 +591,7 @@ export async function PCLconfigCreation( req, res ) {
591
591
  // }
592
592
  }
593
593
  } else {
594
- if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'queuealert', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo','vehicle_check_in' ].includes( getCLconfig.checkListType ) ) {
594
+ if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'queuealert', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in' ].includes( getCLconfig.checkListType ) ) {
595
595
  let storeNameList = allQuestion.map( ( item ) => item.store_id );
596
596
  let storeDetails = await storeService.find( { clientId: getCLconfig.client_id, status: 'active', ...( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning' ].includes( getCLconfig.checkListType ) ) ? { storeId: { $in: storeNameList } } : {} }, { storeId: 1 } );
597
597
  let storeList = storeDetails.map( ( store ) => store.storeId );
@@ -864,7 +864,7 @@ async function insertData( requestData ) {
864
864
  },
865
865
  } );
866
866
  let getSections = await CLquestions.aggregate( sectionQuery );
867
- 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' ].includes( getCLconfig.checkListType ) ) {
867
+ 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' ].includes( getCLconfig.checkListType ) ) {
868
868
  if ( getSections.length ) {
869
869
  for ( let element3 of getSections ) {
870
870
  let collectQuestions = {};
@@ -1158,7 +1158,7 @@ async function insertData( requestData ) {
1158
1158
  // }
1159
1159
  }
1160
1160
  } else {
1161
- if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'queuealert', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo','vehicle_check_in' ].includes( getCLconfig.checkListType ) ) {
1161
+ if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'queuealert', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in' ].includes( getCLconfig.checkListType ) ) {
1162
1162
  let storeNameList = allQuestion.map( ( item ) => item.store_id );
1163
1163
  let storeDetails = await storeService.find( { clientId: getCLconfig.client_id, status: 'active', ...( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning' ].includes( getCLconfig.checkListType ) ) ? { storeId: { $in: storeNameList } } : {} }, { storeId: 1 } );
1164
1164
  let storeList = storeDetails.map( ( store ) => store.storeId );
@@ -3821,7 +3821,7 @@ async function updateOpenSearch( user, data ) {
3821
3821
  export const aiChecklist = async ( req, res ) => {
3822
3822
  try {
3823
3823
  let storeDetails = await storeService.count( { clientId: req.query.clientId, status: 'active' } );
3824
- let aiList = [ 'mobileusagedetection', 'storeopenandclose', 'uniformdetection', 'staffleftinthemiddle', 'customerunattended', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'queuealert', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo','vehicle_check_in' ];
3824
+ let aiList = [ 'mobileusagedetection', 'storeopenandclose', 'uniformdetection', 'staffleftinthemiddle', 'customerunattended', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'queuealert', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in' ];
3825
3825
  let checklistDetails = [];
3826
3826
  let publishList = [];
3827
3827
  let unpublishList = [];
@@ -2947,13 +2947,13 @@ export const overallComparisonCardsV1 = async ( req, res ) => {
2947
2947
  processedchecklistService.aggregate( rangeTwoFindQuery ),
2948
2948
  ] );
2949
2949
 
2950
- console.log( 'rangeOneFromDate =>', rangeOneFromDate );
2951
- console.log( 'rangeOneToDate =>', rangeOneToDate );
2952
- console.log( 'rangeOneData =>', rangeOneData );
2950
+ // console.log( 'rangeOneFromDate =>', rangeOneFromDate );
2951
+ // console.log( 'rangeOneToDate =>', rangeOneToDate );
2952
+ // console.log( 'rangeOneData =>', rangeOneData );
2953
2953
 
2954
- console.log( 'rangeTwoFromDate =>', rangeTwoFromDate );
2955
- console.log( 'rangeTwoToDate =>', rangeTwoToDate );
2956
- console.log( 'rangeTwoData =>', rangeTwoData );
2954
+ // console.log( 'rangeTwoFromDate =>', rangeTwoFromDate );
2955
+ // console.log( 'rangeTwoToDate =>', rangeTwoToDate );
2956
+ // console.log( 'rangeTwoData =>', rangeTwoData );
2957
2957
 
2958
2958
  if ( rangeOneData.length >0 && rangeTwoData.length >0 ) {
2959
2959
  overallComparisonCards.flags.comparisonData = Math.round( ( ( ( rangeOneData[0].flaggedChecklist - rangeTwoData[0].flaggedChecklist )/rangeTwoData[0].flaggedChecklist )*100 ) ); // .toFixed( 2 )
@@ -22,7 +22,7 @@ galleryRouter
22
22
 
23
23
 
24
24
  galleryRouter
25
- .post( '/updateApprove', isAllowedSessionHandler, approveChecklist )
25
+ .post( '/updateApprove', isAllowedSessionHandler, getAssinedStore, approveChecklist )
26
26
  .post( '/redo', isAllowedSessionHandler, redoChecklist )
27
27
  .post( '/multiredo', isAllowedSessionHandler, redomultiChecklist )
28
28
  .post( '/approvalstatus', isAllowedSessionHandler, approvalstatus )