tango-app-api-audit 3.4.11-alpha.12 → 3.4.11-alpha.13
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,
|
|
@@ -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 ) => {
|
|
@@ -4521,9 +4521,10 @@ export async function save( req, res ) {
|
|
|
4521
4521
|
afterCount: inputData.employeeCount,
|
|
4522
4522
|
timeSpent: timeDifferenceInMinutes,
|
|
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,
|