tango-app-api-trax 3.3.1-beta-63 → 3.3.1-beta-64
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
|
@@ -2399,6 +2399,7 @@ export const flagChecklistTableV1 = async ( req, res ) => {
|
|
|
2399
2399
|
checklistStatus: 1,
|
|
2400
2400
|
questionFlagCount: '$questionFlag',
|
|
2401
2401
|
timeFlagCount: '$timeFlag',
|
|
2402
|
+
userName: '$userName',
|
|
2402
2403
|
reinitiateStatus: true,
|
|
2403
2404
|
// detections: {
|
|
2404
2405
|
// $sum: {
|
|
@@ -2424,7 +2425,7 @@ export const flagChecklistTableV1 = async ( req, res ) => {
|
|
|
2424
2425
|
];
|
|
2425
2426
|
|
|
2426
2427
|
if ( reqestData.search && reqestData.search != '' ) {
|
|
2427
|
-
pipeline[0].$match.$and.push( { storeName: { $regex: reqestData.search, $options: 'i' } } );
|
|
2428
|
+
pipeline[0].$match.$and.push( { $or: [ { storeName: { $regex: reqestData.search, $options: 'i' } }, { userName: { $regex: reqestData.search, $options: 'i' } }, { userEmail: { $regex: reqestData.search, $options: 'i' } } ] } );
|
|
2428
2429
|
}
|
|
2429
2430
|
|
|
2430
2431
|
const total = await processedchecklistService.aggregate( pipeline );
|
|
@@ -2653,12 +2654,14 @@ export const checklistDropdownV1 = async ( req, res ) => {
|
|
|
2653
2654
|
$project: {
|
|
2654
2655
|
sourceCheckList_id: 1,
|
|
2655
2656
|
checkListName: 1,
|
|
2657
|
+
coverage: 1,
|
|
2656
2658
|
},
|
|
2657
2659
|
},
|
|
2658
2660
|
{
|
|
2659
2661
|
$group: {
|
|
2660
2662
|
_id: '$sourceCheckList_id',
|
|
2661
2663
|
checkListName: { $last: '$checkListName' },
|
|
2664
|
+
coverage: { $last: '$coverage' },
|
|
2662
2665
|
},
|
|
2663
2666
|
},
|
|
2664
2667
|
{
|
|
@@ -2666,6 +2669,7 @@ export const checklistDropdownV1 = async ( req, res ) => {
|
|
|
2666
2669
|
_id: 0,
|
|
2667
2670
|
sourceCheckList_id: '$_id',
|
|
2668
2671
|
checkListName: 1,
|
|
2672
|
+
coverage: 1,
|
|
2669
2673
|
},
|
|
2670
2674
|
},
|
|
2671
2675
|
{
|
|
@@ -2694,7 +2698,6 @@ export const checklistDropdownV1 = async ( req, res ) => {
|
|
|
2694
2698
|
scheduleRepeatedType: 1,
|
|
2695
2699
|
scheduleStartTime: 1,
|
|
2696
2700
|
sourceCheckList_id: '$_id',
|
|
2697
|
-
storeCount: 1,
|
|
2698
2701
|
},
|
|
2699
2702
|
},
|
|
2700
2703
|
], as: 'checklistData',
|
|
@@ -2713,7 +2716,7 @@ export const checklistDropdownV1 = async ( req, res ) => {
|
|
|
2713
2716
|
scheduleRepeatedType: '$checklistData.scheduleRepeatedType',
|
|
2714
2717
|
scheduleStartTime: '$checklistData.scheduleStartTime',
|
|
2715
2718
|
sourceCheckList_id: '$checklistData._id',
|
|
2716
|
-
|
|
2719
|
+
coverage: 1,
|
|
2717
2720
|
},
|
|
2718
2721
|
},
|
|
2719
2722
|
];
|
|
@@ -2083,12 +2083,12 @@ export const validateUserv1 = async ( req, res ) => {
|
|
|
2083
2083
|
assignDetails.forEach( ( item ) => {
|
|
2084
2084
|
let getStoreDetails = storeDetails.find( ( store ) => store.storeName.toLowerCase() == item.storeName.toLowerCase() );
|
|
2085
2085
|
if ( getStoreDetails ) {
|
|
2086
|
-
let storeUserDetails = userDetails.find( ( ele ) => ele.newEmail.toLowerCase() == item.userEmail.toLowerCase() );
|
|
2086
|
+
// let storeUserDetails = userDetails.find( ( ele ) => ele.newEmail.toLowerCase() == item.userEmail.toLowerCase() );
|
|
2087
2087
|
item._id = getStoreDetails._id;
|
|
2088
2088
|
item.storeId = getStoreDetails.storeId;
|
|
2089
|
-
item.userName =
|
|
2089
|
+
item.userName = getStoreDetails?.spocDetails?.[0]?.name || item.userName;
|
|
2090
2090
|
item.storeName = getStoreDetails.storeName;
|
|
2091
|
-
item.userEmail =
|
|
2091
|
+
item.userEmail = getStoreDetails?.spocDetails?.[0]?.email || item.userEmail;
|
|
2092
2092
|
}
|
|
2093
2093
|
} );
|
|
2094
2094
|
} else {
|
|
@@ -1222,7 +1222,11 @@ export const checklistInfo = async ( req, res ) => {
|
|
|
1222
1222
|
findQuery.push( { $addFields: { store: { $toLower: '$storeName' } } } );
|
|
1223
1223
|
query = { store: { $in: storeList } };
|
|
1224
1224
|
} else {
|
|
1225
|
-
query = {
|
|
1225
|
+
query = { $or: [
|
|
1226
|
+
{ storeName: { $regex: requestData.searchValue.trim(), $options: 'i' } },
|
|
1227
|
+
{ userEmail: { $regex: requestData.searchValue.trim(), $options: 'i' } },
|
|
1228
|
+
{ userName: { $regex: requestData.searchValue.trim(), $options: 'i' } },
|
|
1229
|
+
] };
|
|
1226
1230
|
}
|
|
1227
1231
|
findQuery.push( { $match: { $or: [ query ] } } );
|
|
1228
1232
|
} else {
|
|
@@ -1238,6 +1242,38 @@ export const checklistInfo = async ( req, res ) => {
|
|
|
1238
1242
|
findQuery.push( { $match: { $or: [ query ] } } );
|
|
1239
1243
|
}
|
|
1240
1244
|
}
|
|
1245
|
+
findQuery.push( { $sort: { _id: -1 } } );
|
|
1246
|
+
|
|
1247
|
+
findQuery.push( {
|
|
1248
|
+
$group: {
|
|
1249
|
+
_id: { store: '$store_id', email: '$userEmail' },
|
|
1250
|
+
checkListName: { $first: '$checkListName' },
|
|
1251
|
+
coverage: { $first: '$coverage' },
|
|
1252
|
+
createdByName: { $first: '$createdByName' },
|
|
1253
|
+
userName: { $first: '$userName' },
|
|
1254
|
+
userEmail: { $first: '$userEmail' },
|
|
1255
|
+
checklistStatus: { $last: '$checklistStatus' },
|
|
1256
|
+
submitTime_string: { $push: '$submitTime_string' },
|
|
1257
|
+
storeName: { $first: '$storeName' },
|
|
1258
|
+
checkListType: { $first: '$checkListType' },
|
|
1259
|
+
scheduleRepeatedType: { $first: '$scheduleRepeatedType' },
|
|
1260
|
+
timeFlag: { $sum: '$timeFlag' },
|
|
1261
|
+
questionFlag: { $sum: '$questionFlag' },
|
|
1262
|
+
date_iso: { $first: '$date_iso' },
|
|
1263
|
+
store_id: { $first: '$store_id' },
|
|
1264
|
+
date_string: { $first: '$date_string' },
|
|
1265
|
+
sourceCheckList_id: { $first: '$sourceCheckList_id' },
|
|
1266
|
+
reinitiateStatus: { $first: '$reinitiateStatus' },
|
|
1267
|
+
redoStatus: { $first: '$redoStatus' },
|
|
1268
|
+
submitCount: { $sum: {
|
|
1269
|
+
$cond: {
|
|
1270
|
+
if: { $eq: [ '$checklistStatus', 'submit' ] },
|
|
1271
|
+
then: 1,
|
|
1272
|
+
else: 0,
|
|
1273
|
+
},
|
|
1274
|
+
} },
|
|
1275
|
+
},
|
|
1276
|
+
} );
|
|
1241
1277
|
|
|
1242
1278
|
findQuery.push( {
|
|
1243
1279
|
$project: {
|
|
@@ -1245,21 +1281,22 @@ export const checklistInfo = async ( req, res ) => {
|
|
|
1245
1281
|
coverage: 1,
|
|
1246
1282
|
createdByName: 1,
|
|
1247
1283
|
userName: 1,
|
|
1248
|
-
userEmail:
|
|
1284
|
+
userEmail: '$_id.email',
|
|
1249
1285
|
checklistStatus: 1,
|
|
1250
|
-
submitTime_string: 1,
|
|
1286
|
+
submitTime_string: { $arrayElemAt: [ '$submitTime_string', -1 ] },
|
|
1251
1287
|
storeName: 1,
|
|
1252
1288
|
checkListType: 1,
|
|
1253
1289
|
scheduleRepeatedType: 1,
|
|
1254
1290
|
timeFlag: 1,
|
|
1255
1291
|
questionFlag: 1,
|
|
1256
1292
|
date_iso: 1,
|
|
1257
|
-
store_id:
|
|
1293
|
+
store_id: '$_id.store',
|
|
1258
1294
|
timeFlag: 1,
|
|
1259
1295
|
date_string: 1,
|
|
1260
1296
|
sourceCheckList_id: 1,
|
|
1261
1297
|
reinitiateStatus: 1,
|
|
1262
1298
|
redoStatus: 1,
|
|
1299
|
+
submitCount: 1,
|
|
1263
1300
|
},
|
|
1264
1301
|
} );
|
|
1265
1302
|
|
|
@@ -1306,28 +1343,38 @@ export const checklistInfo = async ( req, res ) => {
|
|
|
1306
1343
|
sourceCheckList_id: 1,
|
|
1307
1344
|
reinitiateStatus: 1,
|
|
1308
1345
|
redoStatus: 1,
|
|
1346
|
+
submitCount: 1,
|
|
1309
1347
|
},
|
|
1310
1348
|
} );
|
|
1311
1349
|
|
|
1312
|
-
let getTotalCount = await processedchecklistService.aggregate( findQuery );
|
|
1313
|
-
if ( !getTotalCount.length ) {
|
|
1314
|
-
|
|
1315
|
-
}
|
|
1350
|
+
// let getTotalCount = await processedchecklistService.aggregate( findQuery );
|
|
1351
|
+
// if ( !getTotalCount.length ) {
|
|
1352
|
+
// return res.sendError( { error: 'No Data Found' }, 204 );
|
|
1353
|
+
// }
|
|
1316
1354
|
|
|
1317
1355
|
if ( requestData.sortColumnName && requestData.sortColumnName != '' && requestData.sortBy && requestData.sortBy !='' ) {
|
|
1318
1356
|
findQuery.push( { $sort: { [requestData.sortColumnName]: requestData.sortBy } } );
|
|
1319
|
-
} else {
|
|
1320
|
-
findQuery.push( { $sort: { ['date_iso']: -1 } } );
|
|
1321
1357
|
}
|
|
1322
|
-
|
|
1323
1358
|
let limit = parseInt( requestData?.limit ) || 10;
|
|
1324
1359
|
let skip = limit * ( requestData?.offset ) || 0;
|
|
1325
|
-
findQuery.push( { $skip: skip }, { $limit: limit } );
|
|
1326
|
-
let getChecklistPerformanceData = await processedchecklistService.aggregate( findQuery );
|
|
1327
1360
|
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1361
|
+
findQuery.push(
|
|
1362
|
+
{
|
|
1363
|
+
$facet: {
|
|
1364
|
+
data: [
|
|
1365
|
+
{ $skip: skip }, { $limit: limit },
|
|
1366
|
+
],
|
|
1367
|
+
count: [
|
|
1368
|
+
{ $count: 'total' },
|
|
1369
|
+
],
|
|
1370
|
+
},
|
|
1371
|
+
},
|
|
1372
|
+
);
|
|
1373
|
+
|
|
1374
|
+
|
|
1375
|
+
let getChecklistPerformanceData = await processedchecklistService.aggregate( findQuery );
|
|
1376
|
+
if ( !getChecklistPerformanceData[0].data.length ) {
|
|
1377
|
+
return res.sendError( 'No data found', 204 );
|
|
1331
1378
|
}
|
|
1332
1379
|
result.checklistInfo = getChecklistPerformanceData;
|
|
1333
1380
|
if ( requestData.export ) {
|
|
@@ -3574,12 +3621,15 @@ export const checklistDropdown = async ( req, res ) => {
|
|
|
3574
3621
|
$project: {
|
|
3575
3622
|
sourceCheckList_id: 1,
|
|
3576
3623
|
checkListName: 1,
|
|
3624
|
+
coverage: 1,
|
|
3577
3625
|
},
|
|
3578
3626
|
},
|
|
3579
3627
|
{
|
|
3580
3628
|
$group: {
|
|
3581
3629
|
_id: '$sourceCheckList_id',
|
|
3582
3630
|
checkListName: { $last: '$checkListName' },
|
|
3631
|
+
storeCount: { $sum: 1 },
|
|
3632
|
+
coverage: { $last: '$coverage' },
|
|
3583
3633
|
},
|
|
3584
3634
|
},
|
|
3585
3635
|
{
|
|
@@ -3587,6 +3637,8 @@ export const checklistDropdown = async ( req, res ) => {
|
|
|
3587
3637
|
_id: 0,
|
|
3588
3638
|
sourceCheckList_id: '$_id',
|
|
3589
3639
|
checkListName: 1,
|
|
3640
|
+
storeCount: 1,
|
|
3641
|
+
coverage: 1,
|
|
3590
3642
|
},
|
|
3591
3643
|
},
|
|
3592
3644
|
{
|
|
@@ -3615,7 +3667,7 @@ export const checklistDropdown = async ( req, res ) => {
|
|
|
3615
3667
|
scheduleRepeatedType: 1,
|
|
3616
3668
|
scheduleStartTime: 1,
|
|
3617
3669
|
sourceCheckList_id: '$_id',
|
|
3618
|
-
|
|
3670
|
+
allowedMultiSubmit: 1,
|
|
3619
3671
|
},
|
|
3620
3672
|
},
|
|
3621
3673
|
], as: 'checklistData',
|
|
@@ -3634,7 +3686,10 @@ export const checklistDropdown = async ( req, res ) => {
|
|
|
3634
3686
|
scheduleRepeatedType: '$checklistData.scheduleRepeatedType',
|
|
3635
3687
|
scheduleStartTime: '$checklistData.scheduleStartTime',
|
|
3636
3688
|
sourceCheckList_id: '$checklistData._id',
|
|
3637
|
-
storeCount:
|
|
3689
|
+
storeCount: 1,
|
|
3690
|
+
coverage: 1,
|
|
3691
|
+
allowedMultiSubmit: '$checklistData.allowedMultiSubmit',
|
|
3692
|
+
|
|
3638
3693
|
},
|
|
3639
3694
|
},
|
|
3640
3695
|
];
|