tango-app-api-trax 3.3.1-beta-19 → 3.3.1-beta-20

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.3.1-beta-19",
3
+ "version": "3.3.1-beta-20",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -28,8 +28,7 @@ export const overallFlagMetrics = async ( req, res ) => {
28
28
  { date_iso: { $gte: new Date( req.body.startDate ) } },
29
29
  { date_iso: { $lte: new Date( req.body.endDate ) } },
30
30
  // { store_id: { $in: req.body.stores } },
31
- { userEmail: { $in: getUserEmails } },
32
- { $or: [ { store_id: { $in: requestData.storeId || '' } }, { store_id: { $eq: '' } } ] },
31
+ { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ] },
33
32
  ],
34
33
  },
35
34
  },
@@ -277,8 +276,7 @@ export const checklistFlagsTable = async ( req, res ) => {
277
276
  { uniformDetectionFlag: { $gt: 0 } },
278
277
  ] },
279
278
  // { store_id: { $in: req.body.stores } },
280
- { userEmail: { $in: getUserEmails } },
281
- { $or: [ { store_id: { $in: requestData.storeId || '' } }, { store_id: { $eq: '' } } ] },
279
+ { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ] },
282
280
  ],
283
281
  },
284
282
  };
@@ -555,8 +553,7 @@ export const flagCardsV1 = async ( req, res ) => {
555
553
  { aiStoreList: { $in: storeId } },
556
554
  ],
557
555
  date_iso: { $gte: adjustedFromDate, $lte: adjustedToDate },
558
- userEmail: { $in: getUserEmails },
559
- $or: [ { store_id: { $in: requestData.storeId || '' } }, { store_id: { $eq: '' } } ],
556
+ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ],
560
557
  },
561
558
  },
562
559
  {
@@ -698,8 +695,7 @@ export const flagComparisonCardsV1 = async ( req, res ) => {
698
695
  { aiStoreList: { $in: requestData.storeId } },
699
696
  ],
700
697
  date_iso: { $gte: fromDate, $lte: toDate },
701
- userEmail: { $in: getUserEmails },
702
- $or: [ { store_id: { $in: requestData.storeId || '' } }, { store_id: { $eq: '' } } ],
698
+ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ],
703
699
  } },
704
700
  {
705
701
  $project: {
@@ -828,8 +824,7 @@ export const flagTablesV1 = async ( req, res ) => {
828
824
  { $or: [ { store_id: { $in: requestData.storeId } }, { aiStoreList: { $in: requestData.storeId } } ] },
829
825
  { date_iso: { $gte: fromDate } },
830
826
  { date_iso: { $lte: toDate } },
831
- { userEmail: { $in: getUserEmails } },
832
- { $or: [ { store_id: { $in: requestData.storeId || '' } }, { store_id: { $eq: '' } } ] },
827
+ { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ] },
833
828
  );
834
829
 
835
830
  if ( requestData?.filter === 'all' ) {
@@ -1886,8 +1881,7 @@ export const flagChecklistCardsV1 = async ( req, res ) => {
1886
1881
  { date_iso: { $lte: dayjs.utc( reqestData.toDate ).endOf( 'day' ).toDate() } },
1887
1882
  { sourceCheckList_id: new mongoose.Types.ObjectId( reqestData.sourceCheckList_id ) },
1888
1883
  // { store_id: { $in: reqestData?.storeId } },
1889
- { userEmail: { $in: getUserEmails } },
1890
- { $or: [ { store_id: { $in: reqestData.storeId || '' } }, { store_id: { $eq: '' } } ] },
1884
+ { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ] },
1891
1885
  ],
1892
1886
  },
1893
1887
  },
@@ -2111,8 +2105,7 @@ export const flagChecklistComparisonCardsV1 = async ( req, res ) => {
2111
2105
  { date_iso: { $lte: rangeOneToDate } },
2112
2106
  { sourceCheckList_id: new mongoose.Types.ObjectId( requestData.sourceCheckList_id ) },
2113
2107
  // { store_id: { $in: requestData?.storeId } },
2114
- { userEmail: { $in: getUserEmails } },
2115
- { $or: [ { store_id: { $in: requestData.storeId || '' } }, { store_id: { $eq: '' } } ] },
2108
+ { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ] },
2116
2109
  ],
2117
2110
  },
2118
2111
  },
@@ -2405,8 +2398,7 @@ export const flagChecklistTableV1 = async ( req, res ) => {
2405
2398
  // ],
2406
2399
  // },
2407
2400
  // { store_id: { $in: reqestData?.storeId } },
2408
- { userEmail: { $in: getUserEmails } },
2409
- { $or: [ { store_id: { $in: requestData.storeId || '' } }, { store_id: { $eq: '' } } ] },
2401
+ { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ] },
2410
2402
  ],
2411
2403
  },
2412
2404
  };
@@ -2682,8 +2674,7 @@ export const checklistDropdownV1 = async ( req, res ) => {
2682
2674
  { checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection' ] } },
2683
2675
  ],
2684
2676
  },
2685
- { userEmail: { $in: getUserEmails } },
2686
- { $or: [ { store_id: { $in: requestData.storeId || '' } }, { store_id: { $eq: '' } } ] },
2677
+ { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ] },
2687
2678
  ] } },
2688
2679
  {
2689
2680
  $project: {
@@ -289,8 +289,7 @@ export const checklistPerformance = async ( req, res ) => {
289
289
  { date_iso: { $gte: fromDate, $lte: toDate } },
290
290
  { client_id: requestData.clientId },
291
291
  // { store_id: { $in: requestData.storeId } },
292
- { userEmail: { $in: getUserEmails } },
293
- { $or: [ { store_id: { $in: requestData.storeId || '' } }, { store_id: { $eq: '' } } ] },
292
+ { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ] },
294
293
  );
295
294
 
296
295
  findQuery.push( { $match: { $and: findAndQuery } } );
@@ -476,8 +475,7 @@ export const storePerformance = async ( req, res ) => {
476
475
  { date_iso: { $lte: toDate } },
477
476
  { checkListType: { $eq: 'custom' } },
478
477
  // { store_id: { $in: requestData.storeId } },
479
- { userEmail: { $in: getUserEmails } },
480
- { $or: [ { store_id: { $in: requestData.storeId || '' } }, { store_id: { $eq: '' } } ] },
478
+ { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ] },
481
479
  );
482
480
 
483
481
  findQuery.push( { $match: { $and: findAndQuery } } );
@@ -687,8 +685,7 @@ export const userPerformance = async ( req, res ) => {
687
685
  { checkListType: { $eq: 'custom' } },
688
686
  { client_id: requestData.clientId },
689
687
  // { store_id: { $in: requestData.storeId } },
690
- { userEmail: { $in: getUserEmails } },
691
- { $or: [ { store_id: { $in: requestData.storeId || '' } }, { store_id: { $eq: '' } } ] },
688
+ { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ] },
692
689
  );
693
690
 
694
691
  findQuery.push( { $match: { $and: findAndQuery } } );
@@ -991,8 +988,7 @@ export const storeDropdown = async ( req, res ) => {
991
988
  { date_iso: { $gte: fromDate } },
992
989
  { date_iso: { $lte: toDate } },
993
990
  // { store_id: { $in: requestData.storeId } },
994
- { userEmail: { $in: getUserEmails } },
995
- { $or: [ { store_id: { $in: requestData.storeId || '' } }, { store_id: { $eq: '' } } ] },
991
+ { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ] },
996
992
  );
997
993
 
998
994
  findQuery.push( { $match: { $and: findAndQuery } } );
@@ -1115,8 +1111,7 @@ export const userDropdown = async ( req, res ) => {
1115
1111
  { date_iso: { $gte: fromDate } },
1116
1112
  { date_iso: { $lte: toDate } },
1117
1113
  // { store_id: { $in: requestData.storeId } },
1118
- { userEmail: { $in: getUserEmails } },
1119
- { $or: [ { store_id: { $in: requestData.storeId || '' } }, { store_id: { $eq: '' } } ] },
1114
+ { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ] },
1120
1115
  );
1121
1116
 
1122
1117
  findQuery.push( { $match: { $and: findAndQuery } } );
@@ -1220,8 +1215,7 @@ export const checklistInfo = async ( req, res ) => {
1220
1215
  { date_iso: { $lte: toDate } },
1221
1216
  { checkListType: { $eq: 'custom' } },
1222
1217
  // { store_id: { $in: requestData.storeId } },
1223
- { userEmail: { $in: getUserEmails } },
1224
- { $or: [ { store_id: { $in: requestData.storeId || '' } }, { store_id: { $eq: '' } } ] },
1218
+ { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ] },
1225
1219
  );
1226
1220
 
1227
1221
  if ( requestData.checklistStatus && requestData.checklistStatus != 'All' ) {
@@ -1275,6 +1269,7 @@ export const checklistInfo = async ( req, res ) => {
1275
1269
  findQuery.push( {
1276
1270
  $project: {
1277
1271
  checkListName: 1,
1272
+ coverage: 1,
1278
1273
  createdByName: 1,
1279
1274
  userName: 1,
1280
1275
  userEmail: 1,
@@ -1298,6 +1293,7 @@ export const checklistInfo = async ( req, res ) => {
1298
1293
  findQuery.push( {
1299
1294
  $project: {
1300
1295
  checkListName: 1,
1296
+ coverage: 1,
1301
1297
  checkListChar: { $substr: [ '$checkListName', 0, 2 ] },
1302
1298
  createdByName: 1,
1303
1299
  userName: 1,
@@ -1423,8 +1419,7 @@ export const infoCardsOld = async ( req, res ) => {
1423
1419
  { date_iso: { $gte: fromDate } },
1424
1420
  { date_iso: { $lte: toDate } },
1425
1421
  // { store_id: { $in: requestData.storeId } },
1426
- { userEmail: { $in: getUserEmails } },
1427
- { $or: [ { store_id: { $in: requestData.storeId || '' } }, { store_id: { $eq: '' } } ] },
1422
+ { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ] },
1428
1423
  );
1429
1424
 
1430
1425
  if ( requestData.groupByType == 'checklist' ) {
@@ -1714,8 +1709,7 @@ export const flagDetectionCards = async ( req, res ) => {
1714
1709
  { date_iso: { $gte: fromDate } },
1715
1710
  { date_iso: { $lte: toDate } },
1716
1711
  // { store_id: { $in: requestData.storeId } },
1717
- { userEmail: { $in: getUserEmails } },
1718
- { $or: [ { store_id: { $in: requestData.storeId || '' } }, { store_id: { $eq: '' } } ] },
1712
+ { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ] },
1719
1713
  );
1720
1714
  findQuery.push( { $match: { $and: findAndQuery } } );
1721
1715
 
@@ -1879,8 +1873,7 @@ export const flagDetectionTables = async ( req, res ) => {
1879
1873
  { date_iso: { $lte: toDate } },
1880
1874
  { checklistStatus: { $eq: 'submit' } },
1881
1875
  // { store_id: { $in: requestData.storeId } },
1882
- { userEmail: { $in: getUserEmails } },
1883
- { $or: [ { store_id: { $in: requestData.storeId || '' } }, { store_id: { $eq: '' } } ] },
1876
+ { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ] },
1884
1877
  );
1885
1878
 
1886
1879
  findQuery.push( { $match: { $and: findAndQuery } } );
@@ -2226,8 +2219,7 @@ export const overallCardsV1 = async ( req, res ) => {
2226
2219
  { date_iso: { $gte: fromDate, $lte: toDate } },
2227
2220
  { client_id: requestData.clientId },
2228
2221
  // { store_id: { $in: requestData.storeId } },
2229
- { userEmail: { $in: getUserEmails } },
2230
- { $or: [ { store_id: { $in: requestData.storeId || '' } }, { store_id: { $eq: '' } } ] },
2222
+ { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ] },
2231
2223
  );
2232
2224
 
2233
2225
  findQuery.push( { $match: { $and: findAndQuery } } );
@@ -2476,8 +2468,7 @@ export const overallComparisonCardsV1 = async ( req, res ) => {
2476
2468
  { date_iso: { $gte: rangeOneFromDate, $lte: rangeOneToDate } },
2477
2469
  { client_id: requestData.clientId },
2478
2470
  // { store_id: { $in: requestData.storeId } },
2479
- { userEmail: { $in: getUserEmails } },
2480
- { $or: [ { store_id: { $in: requestData.storeId || '' } }, { store_id: { $eq: '' } } ] },
2471
+ { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ] },
2481
2472
  );
2482
2473
 
2483
2474
  rangeOneFindQuery.push( { $match: { $and: rangeOneFindAndQuery } } );
@@ -2575,8 +2566,7 @@ export const overallComparisonCardsV1 = async ( req, res ) => {
2575
2566
  { date_iso: { $gte: rangeTwoFromDate, $lte: rangeTwoToDate } },
2576
2567
  { client_id: requestData.clientId },
2577
2568
  // { store_id: { $in: requestData.storeId } },
2578
- { userEmail: { $in: getUserEmails } },
2579
- { $or: [ { store_id: { $in: requestData.storeId || '' } }, { store_id: { $eq: '' } } ] },
2569
+ { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ] },
2580
2570
  );
2581
2571
 
2582
2572
  rangeTwoFindQuery.push( { $match: { $and: rangeTwoFindAndQuery } } );
@@ -2728,8 +2718,7 @@ export const infoCardsV1 = async ( req, res ) => {
2728
2718
  { date_iso: { $lte: toDate } },
2729
2719
  { checkListType: { $eq: 'custom' } },
2730
2720
  // { store_id: { $in: requestData.storeId } },
2731
- { userEmail: { $in: getUserEmails } },
2732
- { $or: [ { store_id: { $in: requestData.storeId || '' } }, { store_id: { $eq: '' } } ] },
2721
+ { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ] },
2733
2722
  );
2734
2723
 
2735
2724
  if ( requestData.groupByType == 'Checklist' ) {
@@ -3012,8 +3001,7 @@ export const infoComparisonCardsV1 = async ( req, res ) => {
3012
3001
  { date_iso: { $lte: rangeOneToDate } },
3013
3002
  { checkListType: { $eq: 'custom' } },
3014
3003
  // { store_id: { $in: requestData.storeId } },
3015
- { userEmail: { $in: getUserEmails } },
3016
- { $or: [ { store_id: { $in: requestData.storeId || '' } }, { store_id: { $eq: '' } } ] },
3004
+ { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ] },
3017
3005
  );
3018
3006
 
3019
3007
  if ( requestData.groupByType == 'Checklist' ) {
@@ -3132,8 +3120,7 @@ export const infoComparisonCardsV1 = async ( req, res ) => {
3132
3120
  { date_iso: { $lte: rangeTwoToDate } },
3133
3121
  { checkListType: { $eq: 'custom' } },
3134
3122
  // { store_id: { $in: requestData.storeId } },
3135
- { userEmail: { $in: getUserEmails } },
3136
- { $or: [ { store_id: { $in: requestData.storeId || '' } }, { store_id: { $eq: '' } } ] },
3123
+ { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ] },
3137
3124
  );
3138
3125
  if ( requestData.groupByType == 'Checklist' ) {
3139
3126
  rangeTwoFindAndQuery.push( { sourceCheckList_id: new mongoose.Types.ObjectId( requestData.groupByValue ) } );
@@ -3332,8 +3319,7 @@ export const monthlyGraphV1 = async ( req, res ) => {
3332
3319
  { date_iso: { $lte: toDate } },
3333
3320
  { checkListType: { $eq: 'custom' } },
3334
3321
  // { store_id: { $in: requestData.storeId } },
3335
- { userEmail: { $in: getUserEmails } },
3336
- { $or: [ { store_id: { $in: requestData.storeId || '' } }, { store_id: { $eq: '' } } ] },
3322
+ { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ] },
3337
3323
  );
3338
3324
 
3339
3325
  if ( requestData.groupByType == 'Checklist' ) {
@@ -3573,8 +3559,7 @@ export const checklistDropdown = async ( req, res ) => {
3573
3559
  { date_iso: { $gte: fromDate, $lte: toDate } },
3574
3560
  { checkListType: 'custom' },
3575
3561
  // { store_id: { $in: requestData.storeId } },
3576
- { userEmail: { $in: getUserEmails } },
3577
- { $or: [ { store_id: { $in: requestData.storeId || '' } }, { store_id: { $eq: '' } } ] },
3562
+ { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ] },
3578
3563
  ] } },
3579
3564
  {
3580
3565
  $project: {