tango-app-api-audit 3.4.11-alpha.12 → 3.4.11-alpha.14
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
|
@@ -799,11 +799,11 @@ export async function workSpace( req, res ) {
|
|
|
799
799
|
},
|
|
800
800
|
];
|
|
801
801
|
|
|
802
|
-
const auditUserCount = [ 'mobile-detection','uniform-detection' ].includes( inputData.moduleType )?await aggregateUserEmpDetection( auditFiles ) : await aggregateBinaryAudit( auditFiles );
|
|
803
|
-
const userIncompleteFilesCount = [ 'mobile-detection','uniform-detection' ].includes( inputData.moduleType )?await aggregateUserEmpDetection( userIncompleteFiles ) : await aggregateBinaryAudit( userIncompleteFiles );
|
|
802
|
+
const auditUserCount = [ 'mobile-detection', 'uniform-detection' ].includes( inputData.moduleType )?await aggregateUserEmpDetection( auditFiles ) : await aggregateBinaryAudit( auditFiles );
|
|
803
|
+
const userIncompleteFilesCount = [ 'mobile-detection', 'uniform-detection' ].includes( inputData.moduleType )?await aggregateUserEmpDetection( userIncompleteFiles ) : await aggregateBinaryAudit( userIncompleteFiles );
|
|
804
804
|
logger.info( { moduleType: inputData.moduleType, userIncompleteFiles: userIncompleteFilesCount } );
|
|
805
805
|
const userAsignAuditCount = await aggregateAssignAudit( userAsignAudit );
|
|
806
|
-
const completedStoresCount = [ 'mobile-detection','uniform-detection' ].includes( inputData.moduleType )? await aggregateStoreEmpDetection( completedStores ) : await aggregateBinaryAudit( binarCompletedStores );
|
|
806
|
+
const completedStoresCount = [ 'mobile-detection', 'uniform-detection' ].includes( inputData.moduleType )? await aggregateStoreEmpDetection( completedStores ) : await aggregateBinaryAudit( binarCompletedStores );
|
|
807
807
|
const clientAssignedCount = await aggregateAssignAudit( clientAssign );
|
|
808
808
|
const auditStoreData = await aggregateTraxAuditData(
|
|
809
809
|
auditStoreDataQuery,
|
|
@@ -1384,10 +1384,10 @@ export async function saveBinary( req, res ) {
|
|
|
1384
1384
|
const openSearch = JSON.parse( process.env.OPENSEARCH );
|
|
1385
1385
|
const sqs = JSON.parse( process.env.SQS );
|
|
1386
1386
|
const inputData = req.body;
|
|
1387
|
-
const isoDate = req.userAudit?.startTime;
|
|
1388
|
-
const currentTime = dayjs();
|
|
1389
|
-
const isoDateTime = dayjs( isoDate );
|
|
1390
|
-
const timeDifferenceInMinutes = currentTime.diff( isoDateTime, 'seconds' );
|
|
1387
|
+
// const isoDate = req.userAudit?.startTime;
|
|
1388
|
+
// const currentTime = dayjs();
|
|
1389
|
+
// const isoDateTime = dayjs( isoDate );
|
|
1390
|
+
// const timeDifferenceInMinutes = currentTime.diff( isoDateTime, 'seconds' );
|
|
1391
1391
|
const value = inputData.moduleType? inputData.moduleType.replace( /-/g, ' ' ) : '';
|
|
1392
1392
|
switch ( inputData.moduleType ) {
|
|
1393
1393
|
case 'unattended-customer':
|
|
@@ -1404,7 +1404,7 @@ export async function saveBinary( req, res ) {
|
|
|
1404
1404
|
answer: inputData.answer,
|
|
1405
1405
|
userComments: inputData.userComments || '',
|
|
1406
1406
|
endTime: new Date(),
|
|
1407
|
-
timeSpent:
|
|
1407
|
+
timeSpent: inputData.timeSpent,
|
|
1408
1408
|
};
|
|
1409
1409
|
let updatDataunattended= await updateOneBinaryAuditModel( unattendedquery, update );
|
|
1410
1410
|
if ( updatDataunattended.modifiedCount==0 ) {
|
|
@@ -1430,7 +1430,7 @@ export async function saveBinary( req, res ) {
|
|
|
1430
1430
|
question: req.userAudit?.question,
|
|
1431
1431
|
result: req.userAudit?.answer,
|
|
1432
1432
|
endTime: Date.now(),
|
|
1433
|
-
timeSpent:
|
|
1433
|
+
timeSpent: inputData.timeSpent,
|
|
1434
1434
|
auditId: new mongoose.Types.ObjectId( inputData.auditId ),
|
|
1435
1435
|
},
|
|
1436
1436
|
createdAt: Date.now(),
|
|
@@ -1454,7 +1454,7 @@ export async function saveBinary( req, res ) {
|
|
|
1454
1454
|
answer: inputData.answer,
|
|
1455
1455
|
userComments: inputData.userComments || '',
|
|
1456
1456
|
endTime: new Date(),
|
|
1457
|
-
timeSpent:
|
|
1457
|
+
timeSpent: inputData.timeSpent,
|
|
1458
1458
|
};
|
|
1459
1459
|
let updatDataUniform= await updateOneBinaryAuditModel( uniformDetectionQuery, updateUniform );
|
|
1460
1460
|
if ( updatDataUniform.modifiedCount==0 ) {
|
|
@@ -1515,7 +1515,7 @@ export async function saveBinary( req, res ) {
|
|
|
1515
1515
|
question: req.userAudit?.question,
|
|
1516
1516
|
result: req.userAudit?.answer,
|
|
1517
1517
|
endTime: Date.now(),
|
|
1518
|
-
timeSpent:
|
|
1518
|
+
timeSpent: inputData.timeSpent,
|
|
1519
1519
|
auditId: new mongoose.Types.ObjectId( inputData.auditId ),
|
|
1520
1520
|
},
|
|
1521
1521
|
createdAt: Date.now(),
|
|
@@ -1537,7 +1537,7 @@ export async function saveBinary( req, res ) {
|
|
|
1537
1537
|
answer: inputData.answer,
|
|
1538
1538
|
userComments: inputData.userComments || '',
|
|
1539
1539
|
endTime: new Date(),
|
|
1540
|
-
timeSpent:
|
|
1540
|
+
timeSpent: inputData.timeSpent,
|
|
1541
1541
|
};
|
|
1542
1542
|
let updatDataleft= await updateOneBinaryAuditModel( leftquery, leftupdate );
|
|
1543
1543
|
if ( updatDataleft.modifiedCount==0 ) {
|
|
@@ -1563,7 +1563,7 @@ export async function saveBinary( req, res ) {
|
|
|
1563
1563
|
question: req.userAudit?.question,
|
|
1564
1564
|
result: req.userAudit?.answer,
|
|
1565
1565
|
endTime: Date.now(),
|
|
1566
|
-
timeSpent:
|
|
1566
|
+
timeSpent: inputData.timeSpent,
|
|
1567
1567
|
auditId: new mongoose.Types.ObjectId( inputData.auditId ),
|
|
1568
1568
|
},
|
|
1569
1569
|
createdAt: Date.now(),
|
|
@@ -1586,7 +1586,7 @@ export async function saveBinary( req, res ) {
|
|
|
1586
1586
|
answer: inputData.answer,
|
|
1587
1587
|
userComments: inputData.userComments || '',
|
|
1588
1588
|
endTime: new Date(),
|
|
1589
|
-
timeSpent:
|
|
1589
|
+
timeSpent: inputData.timeSpent,
|
|
1590
1590
|
};
|
|
1591
1591
|
let updatDatacamera= await updateOneBinaryAuditModel( cameraquery, cameraupdate );
|
|
1592
1592
|
if ( updatDatacamera.modifiedCount==0 ) {
|
|
@@ -1613,7 +1613,7 @@ export async function saveBinary( req, res ) {
|
|
|
1613
1613
|
question: req.userAudit?.question,
|
|
1614
1614
|
result: req.userAudit?.answer,
|
|
1615
1615
|
endTime: Date.now(),
|
|
1616
|
-
timeSpent:
|
|
1616
|
+
timeSpent: inputData.timeSpent,
|
|
1617
1617
|
auditId: new mongoose.Types.ObjectId( inputData.auditId ),
|
|
1618
1618
|
},
|
|
1619
1619
|
createdAt: Date.now(),
|
|
@@ -1841,7 +1841,7 @@ export async function userAuditHistory( req, res ) {
|
|
|
1841
1841
|
},
|
|
1842
1842
|
);
|
|
1843
1843
|
}
|
|
1844
|
-
const count = [ 'mobile-detection','uniform-detection' ].includes( inputData.moduleType )? await aggregateUserEmpDetection( query ) : await aggregateBinaryAudit( query );
|
|
1844
|
+
const count = [ 'mobile-detection', 'uniform-detection' ].includes( inputData.moduleType )? await aggregateUserEmpDetection( query ) : await aggregateBinaryAudit( query );
|
|
1845
1845
|
if ( count.length == 0 ) {
|
|
1846
1846
|
return res.sendError( 'No Data Found', 204 );
|
|
1847
1847
|
}
|
|
@@ -1917,7 +1917,7 @@ export async function userAuditHistory( req, res ) {
|
|
|
1917
1917
|
{
|
|
1918
1918
|
$limit: limit,
|
|
1919
1919
|
} );
|
|
1920
|
-
const result = [ 'mobile-detection','uniform-detection' ].includes( inputData.moduleType )? await aggregateUserEmpDetection( query ) : await aggregateBinaryAudit( query );
|
|
1920
|
+
const result = [ 'mobile-detection', 'uniform-detection' ].includes( inputData.moduleType )? await aggregateUserEmpDetection( query ) : await aggregateBinaryAudit( query );
|
|
1921
1921
|
|
|
1922
1922
|
return res.sendSuccess( { result: result, count: count.length } );
|
|
1923
1923
|
} catch ( error ) {
|
|
@@ -2242,7 +2242,7 @@ export async function clientMetrics( req, res ) {
|
|
|
2242
2242
|
);
|
|
2243
2243
|
}
|
|
2244
2244
|
|
|
2245
|
-
const count = [ 'mobile-detection','uniform-detection' ].includes( inputData.moduleType )? await aggregateTraxAuditData( MappingQuery ) : await aggregateTraxAuditData( query );
|
|
2245
|
+
const count = [ 'mobile-detection', 'uniform-detection' ].includes( inputData.moduleType )? await aggregateTraxAuditData( MappingQuery ) : await aggregateTraxAuditData( query );
|
|
2246
2246
|
logger.info( { count: count } );
|
|
2247
2247
|
if ( count.length == 0 ) {
|
|
2248
2248
|
return res.sendError( 'No Data Found', 204 );
|
|
@@ -2309,7 +2309,7 @@ export async function clientMetrics( req, res ) {
|
|
|
2309
2309
|
);
|
|
2310
2310
|
}
|
|
2311
2311
|
|
|
2312
|
-
const result = [ 'mobile-detection','uniform-detection' ].includes( inputData.moduleType )? await aggregateTraxAuditData( MappingQuery ) : await aggregateTraxAuditData( query );
|
|
2312
|
+
const result = [ 'mobile-detection', 'uniform-detection' ].includes( inputData.moduleType )? await aggregateTraxAuditData( MappingQuery ) : await aggregateTraxAuditData( query );
|
|
2313
2313
|
if ( result.length == 0 ) {
|
|
2314
2314
|
return res.sendError( 'No Data Found', 204 );
|
|
2315
2315
|
}
|
|
@@ -2344,7 +2344,7 @@ export async function storeMetrics( req, res ) {
|
|
|
2344
2344
|
}
|
|
2345
2345
|
|
|
2346
2346
|
if ( inputData.filterByStatus && inputData.filterByStatus?.length > 0 ) {
|
|
2347
|
-
[ 'mobile-detection','uniform-detection' ].includes( inputData.moduleType )? filter.push( { status: { $in: inputData.filterByStatus } } ) : filter.push( { auditStatus: { $in: inputData.filterByStatus } } );
|
|
2347
|
+
[ 'mobile-detection', 'uniform-detection' ].includes( inputData.moduleType )? filter.push( { status: { $in: inputData.filterByStatus } } ) : filter.push( { auditStatus: { $in: inputData.filterByStatus } } );
|
|
2348
2348
|
}
|
|
2349
2349
|
|
|
2350
2350
|
if ( inputData.filterByAuditType && inputData.filterByAuditType?.length > 0 ) {
|
|
@@ -2777,7 +2777,7 @@ export async function storeMetrics( req, res ) {
|
|
|
2777
2777
|
},
|
|
2778
2778
|
);
|
|
2779
2779
|
}
|
|
2780
|
-
const count = [ 'mobile-detection','uniform-detection' ].includes( inputData.moduleType )?await aggregateStoreEmpDetection( query ) : await aggregateBinaryAudit( binaryQuery );
|
|
2780
|
+
const count = [ 'mobile-detection', 'uniform-detection' ].includes( inputData.moduleType )?await aggregateStoreEmpDetection( query ) : await aggregateBinaryAudit( binaryQuery );
|
|
2781
2781
|
|
|
2782
2782
|
|
|
2783
2783
|
if ( count.length == 0 ) {
|
|
@@ -2801,7 +2801,7 @@ export async function storeMetrics( req, res ) {
|
|
|
2801
2801
|
$limit: limit,
|
|
2802
2802
|
} );
|
|
2803
2803
|
}
|
|
2804
|
-
const result = [ 'mobile-detection','uniform-detection' ].includes( inputData.moduleType )?await aggregateStoreEmpDetection( query ) : await aggregateBinaryAudit( binaryQuery );
|
|
2804
|
+
const result = [ 'mobile-detection', 'uniform-detection' ].includes( inputData.moduleType )?await aggregateStoreEmpDetection( query ) : await aggregateBinaryAudit( binaryQuery );
|
|
2805
2805
|
if ( inputData.isExport ) {
|
|
2806
2806
|
const exportdata = [];
|
|
2807
2807
|
result.forEach( ( element ) => {
|
|
@@ -3124,7 +3124,7 @@ export async function userMetrics( req, res ) {
|
|
|
3124
3124
|
);
|
|
3125
3125
|
}
|
|
3126
3126
|
|
|
3127
|
-
const count = [ 'mobile-detection','uniform-detection' ].includes( inputData.moduleType )?await aggregateUserEmpDetection( query ) : await aggregateBinaryAudit( query );
|
|
3127
|
+
const count = [ 'mobile-detection', 'uniform-detection' ].includes( inputData.moduleType )?await aggregateUserEmpDetection( query ) : await aggregateBinaryAudit( query );
|
|
3128
3128
|
if ( count.length == 0 ) {
|
|
3129
3129
|
return res.sendError( 'No Data Found', 204 );
|
|
3130
3130
|
}
|
|
@@ -3160,7 +3160,7 @@ export async function userMetrics( req, res ) {
|
|
|
3160
3160
|
'Audited Date': { $dateToString: { format: '%Y-%m-%d', date: '$createdAt' } },
|
|
3161
3161
|
// 'Mapping Percentage': '$mappingPerc',
|
|
3162
3162
|
};
|
|
3163
|
-
[ 'mobile-detection'
|
|
3163
|
+
[ 'mobile-detection', 'uniform-detection' ].includes( inputData.moduleType )?
|
|
3164
3164
|
query.push(
|
|
3165
3165
|
{
|
|
3166
3166
|
$project: detection,
|
|
@@ -3174,7 +3174,7 @@ export async function userMetrics( req, res ) {
|
|
|
3174
3174
|
}
|
|
3175
3175
|
|
|
3176
3176
|
|
|
3177
|
-
const result = [ 'mobile-detection'
|
|
3177
|
+
const result = [ 'mobile-detection', 'uniform-detection' ].includes( inputData.moduleType )?await aggregateUserEmpDetection( query ) : await aggregateBinaryAudit( query );
|
|
3178
3178
|
if ( inputData.isExport ) {
|
|
3179
3179
|
await download( result, res );
|
|
3180
3180
|
return;
|
|
@@ -3318,7 +3318,7 @@ export async function pendingSummaryTable( req, res ) {
|
|
|
3318
3318
|
},
|
|
3319
3319
|
);
|
|
3320
3320
|
}
|
|
3321
|
-
const count = [ 'mobile-detection'
|
|
3321
|
+
const count = [ 'mobile-detection', 'uniform-detection' ].includes( inputData.moduleType )?await aggregateUserEmpDetection( query ) : await aggregateBinaryAudit( query );
|
|
3322
3322
|
if ( count.length == 0 ) {
|
|
3323
3323
|
return res.sendError( 'No Data Found', 204 );
|
|
3324
3324
|
}
|
|
@@ -3334,7 +3334,7 @@ export async function pendingSummaryTable( req, res ) {
|
|
|
3334
3334
|
} );
|
|
3335
3335
|
}
|
|
3336
3336
|
|
|
3337
|
-
const result = [ 'mobile-detection'
|
|
3337
|
+
const result = [ 'mobile-detection', 'uniform-detection' ].includes( inputData.moduleType )?await aggregateUserEmpDetection( query ) : await aggregateBinaryAudit( query );
|
|
3338
3338
|
if ( inputData.isExport ) {
|
|
3339
3339
|
const exportdata = [];
|
|
3340
3340
|
result.forEach( ( element ) => {
|
|
@@ -3530,7 +3530,7 @@ export async function overAllAuditSummary( req, res ) {
|
|
|
3530
3530
|
},
|
|
3531
3531
|
];
|
|
3532
3532
|
|
|
3533
|
-
const storeAudit = [ 'mobile-detection','uniform-detection' ].includes( inputData.moduleType )?await aggregateStoreEmpDetection( storeAuditQuery ) : await aggregateBinaryAudit( binaryAuditQuery );
|
|
3533
|
+
const storeAudit = [ 'mobile-detection', 'uniform-detection' ].includes( inputData.moduleType )?await aggregateStoreEmpDetection( storeAuditQuery ) : await aggregateBinaryAudit( binaryAuditQuery );
|
|
3534
3534
|
if ( storeAudit.length > 0 ) {
|
|
3535
3535
|
temp.inprogressStores= storeAudit[0].inprogressStores;
|
|
3536
3536
|
temp.completedStores = storeAudit[0].completedStores;
|
|
@@ -3718,7 +3718,7 @@ export async function summarySplit( req, res ) {
|
|
|
3718
3718
|
},
|
|
3719
3719
|
},
|
|
3720
3720
|
];
|
|
3721
|
-
const result = [ 'mobile-detection'
|
|
3721
|
+
const result = [ 'mobile-detection', 'uniform-detection' ].includes( inputData.moduleType )? await aggregateStoreEmpDetection( query ) : await aggregateBinaryAudit( binaryAuditQuery );
|
|
3722
3722
|
const totalCount = await aggregateTraxAuditData( totalQuery );
|
|
3723
3723
|
result[0].totalCount = totalCount[0]?.total;
|
|
3724
3724
|
return res.sendSuccess( { result: result.length> 0? result[0]: temp } );
|
|
@@ -3748,7 +3748,7 @@ export async function overviewTable( req, res ) {
|
|
|
3748
3748
|
}
|
|
3749
3749
|
|
|
3750
3750
|
if ( inputData.filterByStatus.length > 0 ) {
|
|
3751
|
-
[ 'mobile-detection','uniform-detection' ].includes( inputData.moduleType )? filters.push( { status: { $in: inputData.filterByStatus } } ):filters.push( { auditStatus: { $in: inputData.filterByStatus } } );
|
|
3751
|
+
[ 'mobile-detection', 'uniform-detection' ].includes( inputData.moduleType )? filters.push( { status: { $in: inputData.filterByStatus } } ):filters.push( { auditStatus: { $in: inputData.filterByStatus } } );
|
|
3752
3752
|
}
|
|
3753
3753
|
|
|
3754
3754
|
const query =[
|
|
@@ -3865,7 +3865,7 @@ export async function overviewTable( req, res ) {
|
|
|
3865
3865
|
},
|
|
3866
3866
|
);
|
|
3867
3867
|
}
|
|
3868
|
-
const count = [ 'mobile-detection','uniform-detection' ].includes( inputData.moduleType )? await aggregateStoreEmpDetection( query ) : await aggregateBinaryAudit( query );
|
|
3868
|
+
const count = [ 'mobile-detection', 'uniform-detection' ].includes( inputData.moduleType )? await aggregateStoreEmpDetection( query ) : await aggregateBinaryAudit( query );
|
|
3869
3869
|
if ( count.length == 0 ) {
|
|
3870
3870
|
return res.sendError( 'No Data Found', 204 );
|
|
3871
3871
|
}
|
|
@@ -3880,7 +3880,7 @@ export async function overviewTable( req, res ) {
|
|
|
3880
3880
|
$limit: limit,
|
|
3881
3881
|
} );
|
|
3882
3882
|
}
|
|
3883
|
-
const result = [ 'mobile-detection','uniform-detection' ].includes( inputData.moduleType )? await aggregateStoreEmpDetection( query ) : await aggregateBinaryAudit( query );
|
|
3883
|
+
const result = [ 'mobile-detection', 'uniform-detection' ].includes( inputData.moduleType )? await aggregateStoreEmpDetection( query ) : await aggregateBinaryAudit( query );
|
|
3884
3884
|
if ( inputData.isExport ) {
|
|
3885
3885
|
const exportdata = [];
|
|
3886
3886
|
result.forEach( ( element ) => {
|
|
@@ -4420,14 +4420,14 @@ export async function saveDraft( req, res ) {
|
|
|
4420
4420
|
};
|
|
4421
4421
|
|
|
4422
4422
|
if ( getUserAuditData?.startTime ) {
|
|
4423
|
-
const isoDate = getUserAuditData.startTime;
|
|
4424
|
-
const currentTime = dayjs();
|
|
4425
|
-
const isoDateTime = dayjs( isoDate );
|
|
4426
|
-
const timeDifferenceInMinutes = currentTime.diff( isoDateTime, 'seconds' );
|
|
4423
|
+
// const isoDate = getUserAuditData.startTime;
|
|
4424
|
+
// const currentTime = dayjs();
|
|
4425
|
+
// const isoDateTime = dayjs( isoDate );
|
|
4426
|
+
// const timeDifferenceInMinutes = currentTime.diff( isoDateTime, 'seconds' );
|
|
4427
4427
|
|
|
4428
|
-
userRecord.timeSpent =
|
|
4428
|
+
userRecord.timeSpent = inputData.timeSpent;
|
|
4429
4429
|
|
|
4430
|
-
storeRecord.timeSpent =
|
|
4430
|
+
storeRecord.timeSpent = inputData.timeSpent;
|
|
4431
4431
|
}
|
|
4432
4432
|
|
|
4433
4433
|
if ( inputData.userCommands ) {
|
|
@@ -4500,10 +4500,10 @@ export async function save( req, res ) {
|
|
|
4500
4500
|
const openSearch = JSON.parse( process.env.OPENSEARCH );
|
|
4501
4501
|
const sqs = JSON.parse( process.env.SQS );
|
|
4502
4502
|
const inputData = req.body;
|
|
4503
|
-
const isoDate = req.userAudit?.startTime;
|
|
4504
|
-
const currentTime = dayjs();
|
|
4505
|
-
const isoDateTime = dayjs( isoDate );
|
|
4506
|
-
const timeDifferenceInMinutes = currentTime.diff( isoDateTime, 'seconds' );
|
|
4503
|
+
// const isoDate = req.userAudit?.startTime;
|
|
4504
|
+
// const currentTime = dayjs();
|
|
4505
|
+
// const isoDateTime = dayjs( isoDate );
|
|
4506
|
+
// const timeDifferenceInMinutes = currentTime.diff( isoDateTime, 'seconds' );
|
|
4507
4507
|
const getUserAuditData = await findOneUserEmpDetection( { _id: inputData.auditId } );
|
|
4508
4508
|
inputData.clientId = getUserAuditData.clientId;
|
|
4509
4509
|
const query ={ storeId: inputData.storeId, moduleType: inputData.moduleType, fileDate: inputData.fileDate };
|
|
@@ -4514,16 +4514,17 @@ export async function save( req, res ) {
|
|
|
4514
4514
|
afterCount: inputData.employeeCount,
|
|
4515
4515
|
endTime: Date.now(),
|
|
4516
4516
|
isDraft: false,
|
|
4517
|
-
timeSpent:
|
|
4517
|
+
timeSpent: inputData.timeSpent,
|
|
4518
4518
|
};
|
|
4519
4519
|
const storeUpdated ={
|
|
4520
4520
|
status: 'completed',
|
|
4521
4521
|
afterCount: inputData.employeeCount,
|
|
4522
|
-
timeSpent:
|
|
4522
|
+
timeSpent: inputData.timeSpent,
|
|
4523
4523
|
};
|
|
4524
|
-
|
|
4525
|
-
await updateOneStoreEmpDetection( query, storeUpdated );
|
|
4524
|
+
logger.info( { query: query, function: 'saveQuery' } );
|
|
4525
|
+
const [ userUpdate, storeUpdate ] = await Promise.all( [ updateOneUserEmpDetection( { _id: inputData.auditId }, userUpdated ), updateOneStoreEmpDetection( query, storeUpdated ) ] );
|
|
4526
4526
|
|
|
4527
|
+
logger.info( { userUpdate: userUpdate, storeUpdate: storeUpdate, function: 'saveUpdate' } );
|
|
4527
4528
|
const getFilePath = await findOneTraxAuditData(
|
|
4528
4529
|
{
|
|
4529
4530
|
fileDate: inputData.fileDate,
|
|
@@ -4540,10 +4541,12 @@ export async function save( req, res ) {
|
|
|
4540
4541
|
tempId.push( inputData?.employee[i].img_id );
|
|
4541
4542
|
}
|
|
4542
4543
|
}
|
|
4544
|
+
const getStore = await findOneStore( { storeId: inputData.storeId }, { storeName: 1 } );
|
|
4543
4545
|
const sqsProduceQueue = {
|
|
4544
4546
|
QueueUrl: `${sqs.url}${sqs.uniformOutput}`,
|
|
4545
4547
|
MessageBody: JSON.stringify( {
|
|
4546
4548
|
storeId: inputData.storeId,
|
|
4549
|
+
storeName: getStore?.storeName,
|
|
4547
4550
|
fileDate: inputData.fileDate,
|
|
4548
4551
|
moduleType: inputData.moduleType,
|
|
4549
4552
|
inputBucketName: getFilePath?.sqs?.Body?.inputBucketName,
|
|
@@ -4581,7 +4584,7 @@ export async function save( req, res ) {
|
|
|
4581
4584
|
afterCount: inputData.employeeCount,
|
|
4582
4585
|
startTime: req.userAudit?.startTime,
|
|
4583
4586
|
endTime: Date.now(),
|
|
4584
|
-
timeSpent:
|
|
4587
|
+
timeSpent: inputData.timeSpent,
|
|
4585
4588
|
auditId: new mongoose.Types.ObjectId( inputData.auditId ),
|
|
4586
4589
|
},
|
|
4587
4590
|
createdAt: Date.now(),
|
|
@@ -47,6 +47,7 @@ export const saveDraftSchema = joi.object(
|
|
|
47
47
|
moduleType: joi.string().required(),
|
|
48
48
|
auditType: joi.string().required(),
|
|
49
49
|
fileDate: joi.string().required(),
|
|
50
|
+
timeSpent: joi.number().required(),
|
|
50
51
|
queueName: joi.string().required(),
|
|
51
52
|
totalCount: joi.number().required(),
|
|
52
53
|
junkCount: joi.number().optional(),
|
|
@@ -272,6 +273,7 @@ export const saveSchema = joi.object( {
|
|
|
272
273
|
fileDate: joi.string().required(),
|
|
273
274
|
auditType: joi.string().required(),
|
|
274
275
|
moduleType: joi.string().required(),
|
|
276
|
+
timeSpent: joi.number().required(),
|
|
275
277
|
beforeCount: joi.number().required(),
|
|
276
278
|
employeeCount: joi.number().required(),
|
|
277
279
|
employee: joi.array().required(),
|