tango-app-api-trax 3.9.40 → 3.9.42

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.
@@ -14,10 +14,6 @@ import mongoose from 'mongoose';
14
14
  export const overallFlagMetrics = async ( req, res ) => {
15
15
  try {
16
16
  let requestData = req.body;
17
- // Get User Based Checklist //
18
- // let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
19
- // let getUserEmails = await getChecklistUsers( loginUser );
20
- // End: Get User Based Checklist////
21
17
  const pipeline = [
22
18
  {
23
19
  $facet: {
@@ -105,7 +101,6 @@ export const overallFlagMetrics = async ( req, res ) => {
105
101
  { client_id: req.body.clientId },
106
102
  { date_iso: { $gte: dayjs.utc( req.body.endDate ).subtract( 7, 'days' ).startOf( 'day' ).toDate() } },
107
103
  { date_iso: { $lte: dayjs.utc( req.body.startDate ).subtract( 1, 'day' ).startOf( 'day' ).toDate() } },
108
- // { store_id: { $in: req.body.stores } },
109
104
  { $or: [ { store_id: { $in: req.body.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ] },
110
105
  ],
111
106
  },
@@ -158,30 +153,6 @@ export const overallFlagMetrics = async ( req, res ) => {
158
153
  },
159
154
  },
160
155
  },
161
- // {
162
- // $addFields: {
163
- // questionFlag: {
164
- // $round: [
165
- // { $divide: [ '$questionFlag', 7 ] },
166
- // 0,
167
- // ],
168
- // },
169
- // timeFlag: {
170
- // $round: [
171
- // { $divide: [ '$timeFlag', 7 ] },
172
- // 0,
173
- // ],
174
- // },
175
- // detectionFlags: {
176
- // $round: [
177
- // {
178
- // $divide: [ '$detectionFlags', 7 ],
179
- // },
180
- // 0,
181
- // ],
182
- // },
183
- // },
184
- // },
185
156
  ],
186
157
  },
187
158
  },
@@ -218,9 +189,6 @@ export const overallFlagMetrics = async ( req, res ) => {
218
189
  };
219
190
 
220
191
  function calculatePercentage( currentPeriod, last7Days ) {
221
- // const current = currentPeriod[0];
222
- // const last7 = last7Days[0];
223
-
224
192
  const calculateDiffPercentage = ( currentValue, last7Value ) => {
225
193
  if ( last7Value === 0 ) {
226
194
  return currentValue === 0 ? 0 : ( currentValue > 0 ? 100 : -100 );
@@ -256,10 +224,6 @@ export const overallFlagMetrics = async ( req, res ) => {
256
224
  export const checklistFlagsTable = async ( req, res ) => {
257
225
  try {
258
226
  let requestData = req.body;
259
- // Get User Based Checklist //
260
- // let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
261
- // let getUserEmails = await getChecklistUsers( loginUser );
262
- // End: Get User Based Checklist////
263
227
  const matchStage = {
264
228
  $match: {
265
229
  $and: [
@@ -273,7 +237,6 @@ export const checklistFlagsTable = async ( req, res ) => {
273
237
  { storeOpenCloseFlag: { $gt: 0 } },
274
238
  { uniformDetectionFlag: { $gt: 0 } },
275
239
  ] },
276
- // { store_id: { $in: req.body.stores } },
277
240
  { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ] },
278
241
  ],
279
242
  },
@@ -439,90 +402,6 @@ export const checklistFlagsTable = async ( req, res ) => {
439
402
  }
440
403
  };
441
404
 
442
- export const flagChecklistCards = async ( req, res ) => {
443
- try {
444
- let requestData = req.body;
445
- let resultData = await checklistCardData( requestData.checklistType );
446
- return res.sendSuccess( resultData );
447
- } catch ( error ) {
448
- console.log( 'error =>', error );
449
- logger.error( { error: error, function: 'subscribedStoreList' } );
450
- return res.sendError( error, 500 );
451
- }
452
- };
453
-
454
- export const flagChecklistComparisonCards = async ( req, res ) => {
455
- try {
456
- let requestData = req.body;
457
- let resultData = await checklistComparisonData( requestData.checklistType );
458
- return res.sendSuccess( resultData );
459
- } catch ( error ) {
460
- console.log( 'error =>', error );
461
- logger.error( { error: error, function: 'subscribedStoreList' } );
462
- return res.sendError( error, 500 );
463
- }
464
- };
465
-
466
- export const flagChecklistTable = async ( req, res ) => {
467
- try {
468
- let requestData = req.body;
469
- let resultData = await tableData( requestData.checklistType );
470
- return res.sendSuccess( resultData );
471
- } catch ( error ) {
472
- console.log( 'error =>', error );
473
- logger.error( { error: error, function: 'subscribedStoreList' } );
474
- return res.sendError( error, 500 );
475
- }
476
- };
477
-
478
- export const flagCards = async ( req, res ) => {
479
- try {
480
- let requestData = req.body;
481
- let resultData = await flagCardData( requestData.checklistType );
482
- return res.sendSuccess( resultData );
483
- } catch ( error ) {
484
- console.log( 'error =>', error );
485
- logger.error( { error: error, function: 'subscribedStoreList' } );
486
- return res.sendError( error, 500 );
487
- }
488
- };
489
-
490
- export const flagComparisonCards = async ( req, res ) => {
491
- try {
492
- let requestData = req.body;
493
- let resultData = await falgComparisonData( requestData.checklistType );
494
- return res.sendSuccess( resultData );
495
- } catch ( error ) {
496
- console.log( 'error =>', error );
497
- logger.error( { error: error, function: 'subscribedStoreList' } );
498
- return res.sendError( error, 500 );
499
- }
500
- };
501
-
502
- export const flagTables = async ( req, res ) => {
503
- try {
504
- let requestData = req.body;
505
- let resultData = await flagTableData( requestData.checklistType );
506
- return res.sendSuccess( resultData );
507
- } catch ( error ) {
508
- console.log( 'error =>', error );
509
- logger.error( { error: error, function: 'subscribedStoreList' } );
510
- return res.sendError( error, 500 );
511
- }
512
- };
513
-
514
- export const checklistDropdown = async ( req, res ) => {
515
- try {
516
- let requestData = req.body;
517
- let resultData = await checklistDropdownData( requestData.checklistType );
518
- return res.sendSuccess( resultData );
519
- } catch ( error ) {
520
- console.log( 'error =>', error );
521
- logger.error( { error: error, function: 'subscribedStoreList' } );
522
- return res.sendError( error, 500 );
523
- }
524
- };
525
-
526
405
  export const flagCardsV1 = async ( req, res ) => {
527
406
  try {
528
407
  const { clientId, storeId, fromDate, toDate } = req.body;
@@ -537,18 +416,12 @@ export const flagCardsV1 = async ( req, res ) => {
537
416
  };
538
417
 
539
418
  let requestData = req.body;
540
- // Get User Based Checklist //
541
- // let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
542
- // let getUserEmails = await getChecklistUsers( loginUser );
543
- // End: Get User Based Checklist////
419
+
544
420
  const findQuery = [
545
421
  {
546
422
  $match: {
547
423
  client_id: clientId,
548
- // $or: [ { store_id: { $in: storeId } }, { aiStoreList: { $in: storeId } } ],
549
424
  date_iso: { $gte: adjustedFromDate, $lte: adjustedToDate },
550
- // $or: [ { store_id: { $in: storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } }, { aiStoreList: { $in: storeId } } ],
551
- // $or: [ { store_id: { $in: storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ],
552
425
  $or: clientId === '11' ?
553
426
  [
554
427
  { store_id: { $in: storeId } },
@@ -579,7 +452,6 @@ export const flagCardsV1 = async ( req, res ) => {
579
452
  ];
580
453
 
581
454
  const getOverallChecklistData = await processedchecklistService.aggregate( findQuery );
582
- console.log( '🚀 ~ flagCardsV1 ~ getOverallChecklistData:', getOverallChecklistData );
583
455
 
584
456
  if ( !getOverallChecklistData.length ) {
585
457
  const resVal = {
@@ -608,15 +480,11 @@ export const flagCardsV1 = async ( req, res ) => {
608
480
  {
609
481
  client_id: clientId,
610
482
  publish: true,
611
- checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert', 'staffgrouping', 'boxalert', 'employeeCount', 'storehygienemonitoring', 'unattendeddetection', 'employeemonitoring' ] },
483
+ checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert', 'staffgrouping', 'boxalert', 'employeeCount', 'storehygienemonitoring', 'unattendeddetection', 'employeemonitoring', 'activitymonitoring' ] },
612
484
  },
613
485
  { checkListType: 1 },
614
486
  );
615
487
 
616
- // if ( !publishedAiChecklists?.length ) {
617
- // return res.sendError( { error: 'No Data Found' }, 204 );
618
- // }
619
-
620
488
  const detectionPayload = { fromDate, toDate, storeId, clientId };
621
489
  const lambdaURL = 'https://f65azvtljclaxp6l7rnx65cdmm0lcgvp.lambda-url.ap-south-1.on.aws/';
622
490
  const resultData = await LamdaServiceCall( lambdaURL, detectionPayload );
@@ -697,13 +565,8 @@ export const flagComparisonCardsV1 = async ( req, res ) => {
697
565
  rangeTwoToDate.setUTCHours( 23, 59, 59, 59 );
698
566
  }
699
567
 
700
- // Get User Based Checklist //
701
- // let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
702
- // let getUserEmails = await getChecklistUsers( loginUser );
703
- // End: Get User Based Checklist////
704
568
  const createFindQuery = ( fromDate, toDate ) => [
705
569
  { $match: { client_id: requestData.clientId,
706
- // $or: [ { store_id: { $in: requestData.storeId } }, { aiStoreList: { $in: requestData.storeId } } ],
707
570
  date_iso: { $gte: fromDate, $lte: toDate },
708
571
  $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } }, { aiStoreList: { $in: requestData.storeId } } ],
709
572
  } },
@@ -743,16 +606,11 @@ export const flagComparisonCardsV1 = async ( req, res ) => {
743
606
  clientId: requestData.clientId,
744
607
  };
745
608
 
746
- // console.log( dayjs( fromDate ).format( 'YYYY-MM-DD' ), 'from date' );
747
- // console.log( dayjs( toDate ).subtract( 1, 'day' ).format( 'YYYY-MM-DD' ), 'current' );
748
- // console.log( dayjs( toDate ).format( 'YYYY-MM-DD' ), 'previous' );
749
- // console.log( dayjs( toDate ).startOf( 'day' ).subtract( 1, 'day' ).format( 'YYYY-MM-DD' ), 'new start of' );
750
-
751
609
  const publishedAiChecklists = await checklistconfigService.find(
752
610
  {
753
611
  client_id: requestData.clientId,
754
612
  publish: true,
755
- checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum' ] },
613
+ checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum', 'employeeCount', 'employeemonitoring', 'activitymonitoring' ] },
756
614
  },
757
615
  { checkListType: 1 },
758
616
  );
@@ -812,24 +670,16 @@ export const flagTablesV1 = async ( req, res ) => {
812
670
  toDate = new Date( toDate.getTime() - userTimezoneOffset );
813
671
  toDate.setUTCHours( 23, 59, 59, 59 );
814
672
  let result = {};
815
-
816
- // Get User Based Checklist //
817
- // let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
818
- // let getUserEmails = await getChecklistUsers( loginUser );
819
- // End: Get User Based Checklist////
820
-
821
673
  let findQuery = [];
822
674
  let findAndQuery = [];
823
675
  findAndQuery.push(
824
676
  { client_id: requestData.clientId },
825
- // { $or: [ { store_id: { $in: requestData.storeId } }, { aiStoreList: { $in: requestData.storeId } } ] },
826
677
  { date_iso: { $gte: fromDate, $lte: toDate } },
827
678
  { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } }, { aiStoreList: { $in: requestData.storeId } } ] },
828
679
  );
829
680
 
830
681
  if ( requestData?.filter === 'all' ) {
831
- // findAndQuery.push( { $or: [ { questionFlag: { $gte: 1 } }, { timeFlag: { $gte: 1 } }, { checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection' ] } } ] } );
832
- findAndQuery.push( { $or: [ { checkListType: { $in: [ 'custom', 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum' ] } } ] } );
682
+ findAndQuery.push( { $or: [ { checkListType: { $in: [ 'custom', 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum', 'employeeCount', 'employeemonitoring', 'activitymonitoring' ] } } ] } );
833
683
  } else if ( requestData?.filter === 'question' ) {
834
684
  findAndQuery.push( { checkListType: 'custom' } );
835
685
  findAndQuery.push( { questionFlag: { $gte: 1 } } );
@@ -837,7 +687,7 @@ export const flagTablesV1 = async ( req, res ) => {
837
687
  findAndQuery.push( { checkListType: 'custom' } );
838
688
  findAndQuery.push( { timeFlag: { $gte: 1 } } );
839
689
  } else if ( requestData?.filter === 'detection' ) {
840
- findAndQuery.push( { checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum' ] } } );
690
+ findAndQuery.push( { checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum', 'employeeCount', 'employeemonitoring', 'activitymonitoring' ] } } );
841
691
  } else if ( requestData?.filter === 'runAI' ) {
842
692
  findAndQuery.push( { runAIQuestionCount: { $gte: 1 } } );
843
693
  }
@@ -881,25 +731,6 @@ export const flagTablesV1 = async ( req, res ) => {
881
731
  checkListType: { $last: '$checkListType' },
882
732
  storeCount: { $sum: 1 },
883
733
  storeCountAi: { $max: '$storeCount' },
884
- // flaggedStores: {
885
- // $addToSet: {
886
- // $cond: [
887
- // {
888
- // $or: [
889
- // { $gt: [ '$timeFlag', 0 ] },
890
- // { $gt: [ '$questionFlag', 0 ] },
891
- // { $gt: [ '$mobileDetectionFlag', 0 ] },
892
- // { $gt: [ '$storeOpenCloseFlag', 0 ] },
893
- // { $gt: [ '$uniformDetectionFlag', 0 ] },
894
- // { $gt: [ '$customerUnattended', 0 ] },
895
- // { $gt: [ '$staffLeftInTheMiddle', 0 ] },
896
- // ],
897
- // },
898
- // '$store_id',
899
- // '$$REMOVE',
900
- // ],
901
- // },
902
- // },
903
734
  flaggedStores: { $sum: { $cond: [
904
735
  {
905
736
  $or: [
@@ -912,6 +743,9 @@ export const flagTablesV1 = async ( req, res ) => {
912
743
  { '$gt': [ '$staffLeftInTheMiddle', 0 ] },
913
744
  { '$gt': [ '$cleaning', 0 ] },
914
745
  { '$gt': [ '$scrum', 0 ] },
746
+ { '$gt': [ '$employeeCount', 0 ] },
747
+ { '$gt': [ '$employeemonitoring', 0 ] },
748
+ { '$gt': [ '$activitymonitoring', 0 ] },
915
749
  ],
916
750
  },
917
751
  1,
@@ -921,17 +755,6 @@ export const flagTablesV1 = async ( req, res ) => {
921
755
  $sum: {
922
756
  $add: [ '$questionFlag', '$timeFlag' ],
923
757
  },
924
- // $sum: {
925
- // $cond: [ {
926
- // $or: [
927
- // { $gt: [ '$timeFlag', 0 ] },
928
- // { $gt: [ '$questionFlag', 0 ] },
929
- // { $gt: [ '$mobileDetectionFlag', 0 ] },
930
- // { $gt: [ '$storeOpenCloseFlag', 0 ] },
931
- // { $gt: [ '$uniformDetectionFlag', 0 ] },
932
- // ],
933
- // }, 1, 0 ],
934
- // },
935
758
  },
936
759
  submittedChecklist: {
937
760
  $sum: {
@@ -940,18 +763,12 @@ export const flagTablesV1 = async ( req, res ) => {
940
763
  },
941
764
  questionFlag: {
942
765
  $sum: '$questionFlag',
943
- // $sum: {
944
- // $cond: [ { $gt: [ '$questionFlag', 0 ] }, 1, 0 ],
945
- // },
946
766
  },
947
767
  timeFlag: {
948
768
  $sum: '$timeFlag',
949
769
  },
950
770
  questionCount: {
951
771
  $sum: '$questionCount',
952
- // $sum: {
953
- // $cond: [ { $gt: [ '$questionCount', 0 ] }, 1, 0 ],
954
- // },
955
772
  },
956
773
  aiStoreList: { $max: '$aiStoreList' },
957
774
  aiStoreListNew: { $sum: { $size: '$aiStoreList' } },
@@ -978,20 +795,12 @@ export const flagTablesV1 = async ( req, res ) => {
978
795
  checkListType: 1,
979
796
  flagType: 1,
980
797
  uniqueFlaggedStores: 1,
981
- // flaggedStores: { $size: '$flaggedStores' },
982
798
  flaggedStores: '$flaggedStores',
983
799
  flagCount: 1,
984
800
  questionCount: 1,
985
801
  correctAnswers: { $subtract: [ '$submittedQuestionCount', '$questionFlag' ] },
986
- // customType: {
987
- // $cond: { if: { $gte: [ '$questionFlag', 1 ] }, then: 'question', else: {
988
- // $cond: { if: { $gte: [ '$timeFlag', 1 ] }, then: 'time', else: '' },
989
- // },
990
- // },
991
- // },
992
802
  customQuestionFlagCount: '$questionFlag',
993
803
  customTimeFlagCount: '$timeFlag',
994
- // correctAnswers: '$questionFlag',
995
804
  aiStoreList: 1,
996
805
  },
997
806
  } );
@@ -1130,752 +939,6 @@ export const flagTablesV1 = async ( req, res ) => {
1130
939
  }
1131
940
  };
1132
941
 
1133
- async function checklistCardData( checklistType ) {
1134
- try {
1135
- let resData = {};
1136
- switch ( checklistType ) {
1137
- case 'storeopenandclose':
1138
- resData.storeopenandcloseCards = {};
1139
- resData.storeopenandcloseCards = {
1140
- 'totalAssignedStores': { 'count': 300 },
1141
- 'lateOpenStores': { 'count': 200 },
1142
- 'earlyClosedStores': { 'count': 100 },
1143
- 'complianceRate': { 'rate': 100 },
1144
- };
1145
- break;
1146
- case 'mobileusagedetection':
1147
- resData.mobileusagedetectionCards = {};
1148
- resData.mobileusagedetectionCards = {
1149
- 'totalAssignedStores': { 'count': 300 },
1150
- 'flagIncidents': { 'count': 200 },
1151
- 'complianceRate': { 'rate': 100 },
1152
- };
1153
- break;
1154
- case 'uniformdetection':
1155
- resData.uniformdetectionCards = {};
1156
- resData.uniformdetectionCards = {
1157
- 'totalAssignedStores': { 'count': 300 },
1158
- 'flagIncidents': { 'count': 200 },
1159
- 'complianceRate': { 'rate': 100 },
1160
- };
1161
- break;
1162
- case 'customerunattended':
1163
- resData.customerunattendedCards = {};
1164
- resData.customerunattendedCards = {
1165
- 'averageFootfall': {
1166
- 'count': 300,
1167
- },
1168
- 'stafftoCustomerRatio': {
1169
- 'ratio': '6:5',
1170
- },
1171
- 'attendedCustomers': {
1172
- 'count': 100,
1173
- },
1174
- 'unattendedCustomers': {
1175
- 'count': 100,
1176
- },
1177
- 'timeTakentoAssist': {
1178
- 'mins': 100,
1179
- },
1180
- 'timeSpentwithCustomer': {
1181
- 'mins': 100,
1182
- },
1183
- 'unattendedSummaryChart': {
1184
- 'chart1': [
1185
- {
1186
- 'category': 'Un-Attended Peak Hours',
1187
- 'value': 60,
1188
- },
1189
- {
1190
- 'category': 'Un-Attended Non Peak Hours',
1191
- 'value': 30,
1192
- },
1193
- {
1194
- 'category': 'Un-Attended Customer Rate',
1195
- 'value': 10,
1196
- },
1197
- ],
1198
- 'chart2': [
1199
- {
1200
- 'category': 'Customer Attended Within Threshold',
1201
- 'value': 60,
1202
- },
1203
- {
1204
- 'category': 'Customer Attended After Threshold',
1205
- 'value': 40,
1206
- },
1207
- ],
1208
- },
1209
- };
1210
- break;
1211
- case 'staffleftinthemiddle':
1212
- resData.staffleftinthemiddleCards = {};
1213
- resData.staffleftinthemiddleCards = {
1214
- 'avgStaffPresent': {
1215
- 'count': 300,
1216
- },
1217
- 'avgStaffleft': {
1218
- 'count': 200,
1219
- },
1220
- 'avgStaffPresentInPeakHours': {
1221
- 'rate': '6:5',
1222
- },
1223
- 'staffAvgPunctualityRate': {
1224
- 'rate': 50,
1225
- },
1226
- 'staffAvgBreakHours': {
1227
- 'mins': 100,
1228
- },
1229
- 'staffAvgProductiveHours': {
1230
- 'mins': 100,
1231
- },
1232
- };
1233
- break;
1234
- case 'custom':
1235
- resData.customCards = {};
1236
- resData.customCards = {
1237
- 'totalAssignedStores': {
1238
- 'count': 300,
1239
- },
1240
- 'flagIncidents': {
1241
- 'count': 200,
1242
- },
1243
- 'complianceRate': {
1244
- 'count': 100,
1245
- },
1246
- };
1247
- break;
1248
- default:
1249
- break;
1250
- }
1251
- return resData;
1252
- } catch ( error ) {
1253
- console.log( 'error =>', error );
1254
- logger.error( { error: error, message: data, function: 'returnServerError' } );
1255
- }
1256
- }
1257
-
1258
- async function checklistComparisonData( checklistType ) {
1259
- try {
1260
- let resData = {};
1261
- switch ( checklistType ) {
1262
- case 'storeopenandclose':
1263
- resData.storeopenandcloseCards = {};
1264
- resData.storeopenandcloseCards = {
1265
- 'totalAssignedStores': {
1266
- 'comparisonData': 40,
1267
- 'ComparisonFlag': true,
1268
- },
1269
- 'lateOpenStores': {
1270
- 'comparisonData': 50,
1271
- 'ComparisonFlag': true,
1272
- },
1273
- 'earlyClosedStores': {
1274
- 'comparisonData': 20,
1275
- 'ComparisonFlag': false,
1276
- },
1277
- 'complianceRate': {
1278
- 'comparisonData': 10,
1279
- 'ComparisonFlag': false,
1280
- },
1281
- };
1282
- break;
1283
- case 'mobileusagedetection':
1284
- resData.mobileusagedetectionCards = {};
1285
- resData.mobileusagedetectionCards = {
1286
- 'totalAssignedStores': {
1287
- 'comparisonData': 40,
1288
- 'ComparisonFlag': true,
1289
- },
1290
- 'flagIncidents': {
1291
- 'comparisonData': 50,
1292
- 'ComparisonFlag': false,
1293
- },
1294
- 'complianceRate': {
1295
- 'comparisonData': 40,
1296
- 'ComparisonFlag': true,
1297
- },
1298
- };
1299
- break;
1300
- case 'uniformdetection':
1301
- resData.uniformdetectionCards = {};
1302
- resData.uniformdetectionCards = {
1303
- 'totalAssignedStores': {
1304
- 'comparisonData': 40,
1305
- 'ComparisonFlag': true,
1306
- },
1307
- 'flagIncidents': {
1308
- 'comparisonData': 50,
1309
- 'ComparisonFlag': false,
1310
- },
1311
- 'complianceRate': {
1312
- 'comparisonData': 40,
1313
- 'ComparisonFlag': true,
1314
- },
1315
- };
1316
- break;
1317
- case 'customerunattended':
1318
- resData.customerunattendedCards = {};
1319
- resData.customerunattendedCards = {
1320
- 'averageFootfall': {
1321
- 'comparisonData': 40,
1322
- 'ComparisonFlag': true,
1323
- },
1324
- 'stafftoCustomerRatio': {
1325
- 'comparisonData': 50,
1326
- 'ComparisonFlag': true,
1327
- },
1328
- 'attendedCustomers': {
1329
- 'comparisonData': 40,
1330
- 'ComparisonFlag': false,
1331
- },
1332
- 'unattendedCustomers': {
1333
- 'comparisonData': 10,
1334
- 'ComparisonFlag': true,
1335
- },
1336
- 'timeTakentoAssist': {
1337
- 'comparisonData': 30,
1338
- 'ComparisonFlag': false,
1339
- },
1340
- 'timeSpentwithCustomer': {
1341
- 'comparisonData': 40,
1342
- 'ComparisonFlag': true,
1343
- },
1344
- };
1345
- break;
1346
- case 'staffleftinthemiddle':
1347
- resData.staffleftinthemiddleCards = {};
1348
- resData.staffleftinthemiddleCards = {
1349
- 'avgStaffPresent': {
1350
- 'comparisonData': 40,
1351
- 'ComparisonFlag': false,
1352
- },
1353
- 'avgStaffleft': {
1354
- 'comparisonData': 50,
1355
- 'ComparisonFlag': true,
1356
- },
1357
- 'avgStaffPresentInPeakHours': {
1358
- 'comparisonData': 30,
1359
- 'ComparisonFlag': true,
1360
- },
1361
- 'staffAvgPunctualityRate': {
1362
- 'comparisonData': 50,
1363
- 'ComparisonFlag': true,
1364
- },
1365
- 'staffAvgBreakHours': {
1366
- 'comparisonData': 40,
1367
- 'ComparisonFlag': false,
1368
- },
1369
- 'staffAvgProductiveHours': {
1370
- 'comparisonData': 60,
1371
- 'ComparisonFlag': true,
1372
- },
1373
- };
1374
- break;
1375
- case 'custom':
1376
- resData.customCards = {};
1377
- resData.customCards = {
1378
- 'totalAssignedStores': {
1379
- 'comparisonData': 40,
1380
- 'ComparisonFlag': true,
1381
- },
1382
- 'flagIncidents': {
1383
- 'comparisonData': 20,
1384
- 'ComparisonFlag': false,
1385
- },
1386
- 'complianceRate': {
1387
- 'comparisonData': 10,
1388
- 'ComparisonFlag': false,
1389
- },
1390
- };
1391
- break;
1392
- default:
1393
- break;
1394
- }
1395
- return resData;
1396
- } catch ( error ) {
1397
- console.log( 'error =>', error );
1398
- logger.error( { error: error, message: data, function: 'returnServerError' } );
1399
- }
1400
- }
1401
-
1402
- async function tableData( checklistType ) {
1403
- try {
1404
- let resData = {};
1405
- resData.totalCount = 300;
1406
- switch ( checklistType ) {
1407
- case 'storeopenandclose':
1408
- resData.storeopenandcloseData = {};
1409
- resData.storeopenandcloseData = [
1410
- {
1411
- 'date': '02 Aug, 2024',
1412
- 'dateString': '2024-10-10',
1413
- 'storeName': 'LKST400',
1414
- 'storeId': '11-10',
1415
- 'storeSpocEmail': 'olivia@yopmail.com',
1416
- 'openTime': '09:00 AM',
1417
- 'openTimeFlag': false,
1418
- 'closeTime': '10:00 PM',
1419
- 'closeTimeFlag': false,
1420
- },
1421
- {
1422
- 'date': '02 Aug, 2024',
1423
- 'dateString': '2024-10-10',
1424
- 'storeName': 'LKST401',
1425
- 'storeId': '11-11',
1426
- 'storeSpocEmail': 'yamini@yopmail.com',
1427
- 'openTime': '09:10 AM',
1428
- 'openTimeFlag': true,
1429
- 'closeTime': '10:00 PM',
1430
- 'closeTimeFlag': false,
1431
- },
1432
- {
1433
- 'date': '02 Aug, 2024',
1434
- 'dateString': '2024-10-10',
1435
- 'storeName': 'LKST402',
1436
- 'storeId': '11-12',
1437
- 'storeSpocEmail': 'balaji@yopmail.com',
1438
- 'openTime': '09:00 AM',
1439
- 'openTimeFlag': false,
1440
- 'closeTime': '09:50 PM',
1441
- 'closeTimeFlag': true,
1442
- },
1443
- {
1444
- 'date': '02 Aug, 2024',
1445
- 'dateString': '2024-10-10',
1446
- 'storeName': 'LKST402',
1447
- 'storeId': '11-12',
1448
- 'storeSpocEmail': 'balaji@yopmail.com',
1449
- 'openTime': '09:10 AM',
1450
- 'openTimeFlag': true,
1451
- 'closeTime': '09:50 PM',
1452
- 'closeTimeFlag': true,
1453
- },
1454
- ];
1455
- break;
1456
- case 'mobileusagedetection':
1457
- resData.mobileusagedetectionData = {};
1458
- resData.mobileusagedetectionData = [
1459
- {
1460
- 'date': '02 Aug, 2024',
1461
- 'dateString': '2024-10-10',
1462
- 'storeName': 'LKST400',
1463
- 'storeId': '11-10',
1464
- 'storeSpocEmail': 'olivia@yopmail.com',
1465
- 'detections': 50,
1466
- },
1467
- {
1468
- 'date': '02 Aug, 2024',
1469
- 'dateString': '2024-10-10',
1470
- 'storeName': 'LKST401',
1471
- 'storeId': '11-11',
1472
- 'storeSpocEmail': 'yamini@yopmail.com',
1473
- 'detections': 60,
1474
- },
1475
- {
1476
- 'date': '02 Aug, 2024',
1477
- 'dateString': '2024-10-10',
1478
- 'storeName': 'LKST402',
1479
- 'storeId': '11-12',
1480
- 'storeSpocEmail': 'balaji@yopmail.com',
1481
- 'detections': 70,
1482
- },
1483
- {
1484
- 'date': '02 Aug, 2024',
1485
- 'dateString': '2024-10-10',
1486
- 'storeName': 'LKST402',
1487
- 'storeId': '11-12',
1488
- 'storeSpocEmail': 'balaji@yopmail.com',
1489
- 'detections': 90,
1490
- },
1491
- ];
1492
- break;
1493
- case 'uniformdetection':
1494
- resData.uniformdetectionData = {};
1495
- resData.uniformdetectionData = [
1496
- {
1497
- 'date': '02 Aug, 2024',
1498
- 'dateString': '2024-10-10',
1499
- 'storeName': 'LKST400',
1500
- 'storeId': '11-10',
1501
- 'storeSpocEmail': 'olivia@yopmail.com',
1502
- 'detections': 50,
1503
- },
1504
- {
1505
- 'date': '02 Aug, 2024',
1506
- 'dateString': '2024-10-10',
1507
- 'storeName': 'LKST401',
1508
- 'storeId': '11-11',
1509
- 'storeSpocEmail': 'yamini@yopmail.com',
1510
- 'detections': 60,
1511
- },
1512
- {
1513
- 'date': '02 Aug, 2024',
1514
- 'dateString': '2024-10-10',
1515
- 'storeName': 'LKST402',
1516
- 'storeId': '11-12',
1517
- 'storeSpocEmail': 'balaji@yopmail.com',
1518
- 'detections': 70,
1519
- },
1520
- {
1521
- 'date': '02 Aug, 2024',
1522
- 'dateString': '2024-10-10',
1523
- 'storeName': 'LKST402',
1524
- 'storeId': '11-12',
1525
- 'storeSpocEmail': 'balaji@yopmail.com',
1526
- 'detections': 90,
1527
- },
1528
- ];
1529
- break;
1530
- case 'customerunattended':
1531
- resData.customerunattendedData = {};
1532
- resData.customerunattendedData = [
1533
- {
1534
- 'date': '02 Aug, 2024',
1535
- 'dateString': '2024-10-10',
1536
- 'storeName': 'LKST400',
1537
- 'storeId': '11-10',
1538
- 'storeSpocEmail': 'olivia@yopmail.com',
1539
- 'detections': 50,
1540
- },
1541
- {
1542
- 'date': '02 Aug, 2024',
1543
- 'dateString': '2024-10-10',
1544
- 'storeName': 'LKST401',
1545
- 'storeId': '11-11',
1546
- 'storeSpocEmail': 'yamini@yopmail.com',
1547
- 'detections': 60,
1548
- },
1549
- {
1550
- 'date': '02 Aug, 2024',
1551
- 'dateString': '2024-10-10',
1552
- 'storeName': 'LKST402',
1553
- 'storeId': '11-12',
1554
- 'storeSpocEmail': 'balaji@yopmail.com',
1555
- 'detections': 70,
1556
- },
1557
- {
1558
- 'date': '02 Aug, 2024',
1559
- 'dateString': '2024-10-10',
1560
- 'storeName': 'LKST402',
1561
- 'storeId': '11-12',
1562
- 'storeSpocEmail': 'balaji@yopmail.com',
1563
- 'detections': 90,
1564
- },
1565
- ];
1566
- break;
1567
- case 'staffleftinthemiddle':
1568
- resData.staffleftinthemiddleData = {};
1569
- resData.staffleftinthemiddleData = [
1570
- {
1571
- 'date': '02 Aug, 2024',
1572
- 'dateString': '2024-10-10',
1573
- 'storeName': 'LKST400',
1574
- 'storeId': '11-10',
1575
- 'storeSpocEmail': 'olivia@yopmail.com',
1576
- 'detections': 50,
1577
- },
1578
- {
1579
- 'date': '02 Aug, 2024',
1580
- 'dateString': '2024-10-10',
1581
- 'storeName': 'LKST401',
1582
- 'storeId': '11-11',
1583
- 'storeSpocEmail': 'yamini@yopmail.com',
1584
- 'detections': 60,
1585
- },
1586
- {
1587
- 'date': '02 Aug, 2024',
1588
- 'dateString': '2024-10-10',
1589
- 'storeName': 'LKST402',
1590
- 'storeId': '11-12',
1591
- 'storeSpocEmail': 'balaji@yopmail.com',
1592
- 'detections': 70,
1593
- },
1594
- {
1595
- 'date': '02 Aug, 2024',
1596
- 'dateString': '2024-10-10',
1597
- 'storeName': 'LKST402',
1598
- 'storeId': '11-12',
1599
- 'storeSpocEmail': 'balaji@yopmail.com',
1600
- 'detections': 90,
1601
- },
1602
- ];
1603
- break;
1604
- case 'custom':
1605
- resData.customData = {};
1606
- resData.customData = [
1607
- {
1608
- 'date': '02 Aug, 2024',
1609
- 'dateString': '2024-10-10',
1610
- 'storeName': 'LKST400',
1611
- 'storeId': '11-10',
1612
- 'storeSpocEmail': 'olivia@yopmail.com',
1613
- 'detections': 50,
1614
- },
1615
- {
1616
- 'date': '02 Aug, 2024',
1617
- 'dateString': '2024-10-10',
1618
- 'storeName': 'LKST401',
1619
- 'storeId': '11-11',
1620
- 'storeSpocEmail': 'yamini@yopmail.com',
1621
- 'detections': 60,
1622
- },
1623
- {
1624
- 'date': '02 Aug, 2024',
1625
- 'dateString': '2024-10-10',
1626
- 'storeName': 'LKST402',
1627
- 'storeId': '11-12',
1628
- 'storeSpocEmail': 'balaji@yopmail.com',
1629
- 'detections': 70,
1630
- },
1631
- {
1632
- 'date': '02 Aug, 2024',
1633
- 'dateString': '2024-10-10',
1634
- 'storeName': 'LKST402',
1635
- 'storeId': '11-12',
1636
- 'storeSpocEmail': 'balaji@yopmail.com',
1637
- 'detections': 90,
1638
- },
1639
- ];
1640
- break;
1641
- default:
1642
- break;
1643
- }
1644
- return resData;
1645
- } catch ( error ) {
1646
- console.log( 'error =>', error );
1647
- logger.error( { error: error, message: data, function: 'returnServerError' } );
1648
- }
1649
- }
1650
-
1651
- async function flagCardData( checklistType ) {
1652
- try {
1653
- let resData = {};
1654
- resData.flagCards = {
1655
- 'totalFlag': 700,
1656
- 'questionFlag': {
1657
- 'count': 40,
1658
- },
1659
- 'delayInSubmission': {
1660
- 'count': 50,
1661
- },
1662
- 'detectionFlag': {
1663
- 'count': 20,
1664
- },
1665
- };
1666
- return resData;
1667
- } catch ( error ) {
1668
- console.log( 'error =>', error );
1669
- logger.error( { error: error, message: data, function: 'returnServerError' } );
1670
- }
1671
- }
1672
-
1673
- async function falgComparisonData( checklistType ) {
1674
- try {
1675
- let resData = {};
1676
- resData.flagComparisonCards = {
1677
- 'questionComparisonFlag': {
1678
- 'comparisonData': 40,
1679
- 'ComparisonFlag': true,
1680
- },
1681
- 'delayInSubmissionComparisonFlag': {
1682
- 'comparisonData': 50,
1683
- 'ComparisonFlag': false,
1684
- },
1685
- 'detectionComparisonFlag': {
1686
- 'comparisonData': 20,
1687
- 'ComparisonFlag': true,
1688
- },
1689
- };
1690
- return resData;
1691
- } catch ( error ) {
1692
- console.log( 'error =>', error );
1693
- logger.error( { error: error, message: data, function: 'returnServerError' } );
1694
- }
1695
- }
1696
-
1697
- async function flagTableData( checklistType ) {
1698
- try {
1699
- let resData = {};
1700
- resData.totalCount = 300;
1701
- resData.flagTableData = [
1702
- {
1703
- 'checklistName': 'Field VM- Store Visit Checklist',
1704
- 'sourceCheckList_id': '668e3e1807d5312fa49b0046',
1705
- 'checkListType': 'custom',
1706
- 'flagType': 'Question',
1707
- 'assignedStores': 400,
1708
- 'flaggedStores': 50,
1709
- 'flagCount': 30,
1710
- 'complianceRate': 25,
1711
- },
1712
- {
1713
- 'checklistName': 'DC Prep Checklist',
1714
- 'sourceCheckList_id': '6690d95b747d2cc1f1167361',
1715
- 'checkListType': 'custom',
1716
- 'flagType': 'Question',
1717
- 'assignedStores': 500,
1718
- 'flaggedStores': 66,
1719
- 'flagCount': 66,
1720
- 'complianceRate': 89,
1721
- },
1722
- {
1723
- 'checklistName': 'Store Open and Close',
1724
- 'sourceCheckList_id': '6690d95b747d2cc1f1167361',
1725
- 'checkListType': 'storeopenandclose',
1726
- 'flagType': 'Question',
1727
- 'assignedStores': 300,
1728
- 'flaggedStores': 70,
1729
- 'flagCount': 80,
1730
- 'complianceRate': 25,
1731
- },
1732
- {
1733
- 'checklistName': 'Mobileusage Detection',
1734
- 'sourceCheckList_id': '6690d95b747d2cc1f1167361',
1735
- 'checkListType': 'mobileusagedetection',
1736
- 'flagType': 'Detection',
1737
- 'assignedStores': 250,
1738
- 'flaggedStores': 30,
1739
- 'flagCount': 80,
1740
- 'complianceRate': 77,
1741
- },
1742
- {
1743
- 'checklistName': 'Uniform Detection',
1744
- 'sourceCheckList_id': '6690d95b747d2cc1f1167361',
1745
- 'checkListType': 'uniformdetection',
1746
- 'flagType': 'Detection',
1747
- 'assignedStores': 100,
1748
- 'flaggedStores': 0,
1749
- 'flagCount': 60,
1750
- 'complianceRate': 45,
1751
- },
1752
- {
1753
- 'checklistName': 'Customer Unattended',
1754
- 'sourceCheckList_id': '6690d95b747d2cc1f1167361',
1755
- 'checkListType': 'customerunattended',
1756
- 'flagType': 'Detection',
1757
- 'assignedStores': 200,
1758
- 'flaggedStores': 20,
1759
- 'flagCount': 70,
1760
- 'complianceRate': 55,
1761
- },
1762
- {
1763
- 'checklistName': 'Staff Left in The Middle',
1764
- 'sourceCheckList_id': '6690d95b747d2cc1f1167361',
1765
- 'checkListType': 'staffleftinthemiddle',
1766
- 'flagType': 'Detection',
1767
- 'assignedStores': 150,
1768
- 'flaggedStores': 50,
1769
- 'flagCount': 50,
1770
- 'complianceRate': 30,
1771
- },
1772
- ];
1773
- return resData;
1774
- } catch ( error ) {
1775
- console.log( 'error =>', error );
1776
- logger.error( { error: error, message: data, function: 'returnServerError' } );
1777
- }
1778
- }
1779
-
1780
- async function checklistDropdownData( checklistType ) {
1781
- try {
1782
- let resData = {};
1783
- resData.checklistDropdownData = [
1784
- {
1785
- 'checklistName': 'Field VM- Store Visit Checklist',
1786
- 'sourceCheckList_id': '668e3e1807d5312fa49b0046',
1787
- 'checkListType': 'custom',
1788
- 'createdByName': 'Yamini',
1789
- 'storeCount': 1853,
1790
- 'scheduleRepeatedType': 'weekly',
1791
- 'scheduleStartTime': '12:00 PM',
1792
- 'scheduleEndTime': '06:00 PM',
1793
- 'publish': true,
1794
- },
1795
- {
1796
- 'checklistName': 'DC Prep Checklist',
1797
- 'sourceCheckList_id': '6690d95b747d2cc1f1167361',
1798
- 'checkListType': 'custom',
1799
- 'createdByName': 'Yamini',
1800
- 'storeCount': 1853,
1801
- 'scheduleRepeatedType': 'weekly',
1802
- 'scheduleStartTime': '12:00 PM',
1803
- 'scheduleEndTime': '06:00 PM',
1804
- 'publish': true,
1805
- },
1806
- {
1807
- 'checklistName': 'Store Open and Close',
1808
- 'sourceCheckList_id': '6690d95b747d2cc1f1167362',
1809
- 'checkListType': 'storeopenandclose',
1810
- 'createdByName': 'Yamini',
1811
- 'storeCount': 1853,
1812
- 'scheduleRepeatedType': 'weekly',
1813
- 'scheduleStartTime': '12:00 PM',
1814
- 'scheduleEndTime': '06:00 PM',
1815
- 'publish': true,
1816
- },
1817
- {
1818
- 'checklistName': 'Mobileusage Detection',
1819
- 'sourceCheckList_id': '6690d95b747d2cc1f1167363',
1820
- 'checkListType': 'mobileusagedetection',
1821
- 'createdByName': 'Yamini',
1822
- 'storeCount': 1853,
1823
- 'scheduleRepeatedType': 'weekly',
1824
- 'scheduleStartTime': '12:00 PM',
1825
- 'scheduleEndTime': '06:00 PM',
1826
- 'publish': true,
1827
- },
1828
- {
1829
- 'checklistName': 'Uniform Detection',
1830
- 'sourceCheckList_id': '6690d95b747d2cc1f1167364',
1831
- 'checkListType': 'uniformdetection',
1832
- 'createdByName': 'Yamini',
1833
- 'storeCount': 1853,
1834
- 'scheduleRepeatedType': 'weekly',
1835
- 'scheduleStartTime': '12:00 PM',
1836
- 'scheduleEndTime': '06:00 PM',
1837
- 'publish': true,
1838
- },
1839
- {
1840
- 'checklistName': 'Customer Unattended',
1841
- 'sourceCheckList_id': '6690d95b747d2cc1f1167365',
1842
- 'checkListType': 'customerunattended',
1843
- 'createdByName': 'Yamini',
1844
- 'storeCount': 1853,
1845
- 'scheduleRepeatedType': 'weekly',
1846
- 'scheduleStartTime': '12:00 PM',
1847
- 'scheduleEndTime': '06:00 PM',
1848
- 'publish': true,
1849
- },
1850
- {
1851
- 'checklistName': 'Staff Left in The Middle',
1852
- 'sourceCheckList_id': '6690d95b747d2cc1f1167366',
1853
- 'checkListType': 'staffleftinthemiddle',
1854
- 'createdByName': 'Yamini',
1855
- 'storeCount': 1853,
1856
- 'scheduleRepeatedType': 'weekly',
1857
- 'scheduleStartTime': '12:00 PM',
1858
- 'scheduleEndTime': '06:00 PM',
1859
- 'publish': true,
1860
- },
1861
- {
1862
- 'checklistName': 'Field VM- Store Visit Checklist Field VM- Store Visit Checklist',
1863
- 'sourceCheckList_id': '668e3e1807d5312fa49b0046',
1864
- 'checkListType': 'custom',
1865
- 'createdByName': 'Yamini',
1866
- 'storeCount': 1853,
1867
- 'scheduleRepeatedType': 'weekly',
1868
- 'scheduleStartTime': '12:00 PM',
1869
- 'scheduleEndTime': '06:00 PM',
1870
- 'publish': true,
1871
- },
1872
- ];
1873
- return resData;
1874
- } catch ( error ) {
1875
- console.log( 'error =>', error );
1876
- logger.error( { error: error, message: data, function: 'returnServerError' } );
1877
- }
1878
- }
1879
942
 
1880
943
  // Lamda Service Call //
1881
944
  async function LamdaServiceCall( url, data ) {
@@ -1903,10 +966,7 @@ async function LamdaServiceCall( url, data ) {
1903
966
  export const flagChecklistCardsV1 = async ( req, res ) => {
1904
967
  try {
1905
968
  let reqestData = req.body;
1906
- // Get User Based Checklist //
1907
- // let loginUser = { clientId: reqestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
1908
- // let getUserEmails = await getChecklistUsers( loginUser );
1909
- // End: Get User Based Checklist////
969
+ const lamdaUrl = JSON.parse( process.env.LambdaURL );
1910
970
 
1911
971
  if ( reqestData.ChecklistType == 'custom' ) {
1912
972
  const pipeline = [
@@ -2040,7 +1100,7 @@ export const flagChecklistCardsV1 = async ( req, res ) => {
2040
1100
  const checklist = await aggregate( pipeline );
2041
1101
  console.log( '🚀 ~ flagChecklistCardsV1 ~ checklist:', checklist );
2042
1102
  reqestData.storeCount = checklist[0]?.storeCount | 0;
2043
- let LamdaURL = 'https://k462fpztd3zaucty5ruoks6z540qqgqj.lambda-url.ap-south-1.on.aws/';
1103
+ let LamdaURL =lamdaUrl?.flagChecklistCardsV1;
2044
1104
  let resultData = await LamdaServiceCall( LamdaURL, reqestData );
2045
1105
  console.log( '🚀 ~ flagChecklistCardsV1 ~ resultData:', resultData );
2046
1106
  if ( resultData ) {
@@ -2072,6 +1132,7 @@ export const flagChecklistComparisonCardsV1 = async ( req, res ) => {
2072
1132
  let userTimezoneOffset = toDate.getTimezoneOffset() * 60000;
2073
1133
  toDate = new Date( toDate.getTime() - userTimezoneOffset );
2074
1134
  toDate.setUTCHours( 23, 59, 59, 59 );
1135
+ const lamdaUrl = JSON.parse( process.env.LAMBDAURL );
2075
1136
 
2076
1137
  let rangeOneFromDate;
2077
1138
  let rangeOneToDate;
@@ -2392,7 +1453,7 @@ export const flagChecklistComparisonCardsV1 = async ( req, res ) => {
2392
1453
 
2393
1454
  const to = await aggregate( toPipeline );
2394
1455
  requestData.range2StoreCount = to[0]?.storeCount | 0;
2395
- let LamdaURL = 'https://5m55vcuecg2hll7jzfppx6h53y0lvcmq.lambda-url.ap-south-1.on.aws/';
1456
+ let LamdaURL = lamdaUrl?.flagChecklistComparisonCardsV1;
2396
1457
  let resultData = await LamdaServiceCall( LamdaURL, requestData );
2397
1458
  // console.log( 'resultData =>', resultData );
2398
1459
  if ( resultData ) {
@@ -2747,7 +1808,7 @@ export const checklistDropdownV1 = async ( req, res ) => {
2747
1808
  $or: [
2748
1809
  { questionFlag: { $gte: 1 } },
2749
1810
  { timeFlag: { $gte: 1 } },
2750
- { checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert', 'staffgrouping', 'boxalert', 'employeeCount', 'storehygienemonitoring', 'unattendeddetection', 'vehicle_check_in', 'employeemonitoring' ] } },
1811
+ { checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert', 'staffgrouping', 'boxalert', 'employeeCount', 'storehygienemonitoring', 'unattendeddetection', 'vehicle_check_in', 'employeemonitoring', 'activitymonitoring' ] } },
2751
1812
  {
2752
1813
  runAIQuestionCount: { $gte: 1 },
2753
1814
  },
@@ -2949,7 +2010,7 @@ export const flagComparisonCardsV2 = async ( req, res ) => {
2949
2010
  {
2950
2011
  client_id: requestData.clientId,
2951
2012
  publish: true,
2952
- checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert', 'staffgrouping', 'boxalert', 'employeeCount', 'storehygienemonitoring', 'unattendeddetection', 'employeemonitoring' ] },
2013
+ checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert', 'staffgrouping', 'boxalert', 'employeeCount', 'storehygienemonitoring', 'unattendeddetection', 'employeemonitoring', 'activitymonitoring' ] },
2953
2014
  },
2954
2015
  { checkListType: 1 },
2955
2016
  );
@@ -3031,6 +2092,8 @@ export const flagTablesV2 = async ( req, res ) => {
3031
2092
  toDate.setUTCHours( 23, 59, 59, 59 );
3032
2093
  let result = {};
3033
2094
 
2095
+ const lamdaUrl = JSON.parse( process.env.LambdaURL );
2096
+
3034
2097
  let findQuery = [];
3035
2098
  let findAndQuery = [];
3036
2099
  findAndQuery.push(
@@ -3051,7 +2114,7 @@ export const flagTablesV2 = async ( req, res ) => {
3051
2114
  }
3052
2115
 
3053
2116
  if ( requestData?.filter === 'all' ) {
3054
- findAndQuery.push( { $or: [ { checkListType: { $in: [ 'custom', 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert', 'staffgrouping', 'boxalert', 'employeeCount', 'storehygienemonitoring', 'unattendeddetection', 'vehicle_check_in', 'employeemonitoring' ] } } ] } );
2117
+ findAndQuery.push( { $or: [ { checkListType: { $in: [ 'custom', 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert', 'staffgrouping', 'boxalert', 'employeeCount', 'storehygienemonitoring', 'unattendeddetection', 'vehicle_check_in', 'employeemonitoring', 'activitymonitoring' ] } } ] } );
3055
2118
  } else if ( requestData?.filter === 'question' ) {
3056
2119
  findAndQuery.push( { checkListType: 'custom' } );
3057
2120
  findAndQuery.push( { questionFlag: { $gte: 1 } } );
@@ -3059,7 +2122,7 @@ export const flagTablesV2 = async ( req, res ) => {
3059
2122
  findAndQuery.push( { checkListType: 'custom' } );
3060
2123
  findAndQuery.push( { timeFlag: { $gte: 1 } } );
3061
2124
  } else if ( requestData?.filter === 'detection' ) {
3062
- findAndQuery.push( { checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert', 'staffgrouping', 'boxalert', 'employeeCount', 'storehygienemonitoring', 'unattendeddetection', 'vehicle_check_in', 'employeemonitoring' ] } } );
2125
+ findAndQuery.push( { checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert', 'staffgrouping', 'boxalert', 'employeeCount', 'storehygienemonitoring', 'unattendeddetection', 'vehicle_check_in', 'employeemonitoring', 'activitymonitoring' ] } } );
3063
2126
  } else if ( requestData?.filter === 'runAI' ) {
3064
2127
  if ( req.body.runAIChecklistName ) {
3065
2128
  findAndQuery.push( { checkListName: { $in: req.body.runAIChecklistName } } );
@@ -3118,6 +2181,9 @@ export const flagTablesV2 = async ( req, res ) => {
3118
2181
  { '$gt': [ '$staffLeftInTheMiddle', 0 ] },
3119
2182
  { '$gt': [ '$cleaning', 0 ] },
3120
2183
  { '$gt': [ '$scrum', 0 ] },
2184
+ { '$gt': [ '$employeeCount', 0 ] },
2185
+ { '$gt': [ '$employeemonitoring', 0 ] },
2186
+ { '$gt': [ '$activitymonitoring', 0 ] },
3121
2187
  ],
3122
2188
  },
3123
2189
  1,
@@ -3231,7 +2297,7 @@ export const flagTablesV2 = async ( req, res ) => {
3231
2297
  'clientId': requestData.clientId,
3232
2298
  };
3233
2299
 
3234
- let LamdaURL = 'https://f65azvtljclaxp6l7rnx65cdmm0lcgvp.lambda-url.ap-south-1.on.aws/';
2300
+ let LamdaURL = lamdaUrl.flagTablesV2;
3235
2301
  let resultData = await LamdaServiceCall( LamdaURL, detectionPayload );
3236
2302
  if ( resultData ) {
3237
2303
  if ( resultData.status_code == '200' ) {