tango-app-api-audit 3.4.11-alpha.10 → 3.4.11-alpha.12

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-audit",
3
- "version": "3.4.11-alpha.10",
3
+ "version": "3.4.11-alpha.12",
4
4
  "description": "audit & audit metrics apis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -24,7 +24,7 @@
24
24
  "mongodb": "^6.7.0",
25
25
  "nodemon": "^3.1.3",
26
26
  "swagger-ui-express": "^5.0.1",
27
- "tango-api-schema": "^2.1.36",
27
+ "tango-api-schema": "^2.1.37",
28
28
  "tango-app-api-middleware": "^3.1.33",
29
29
  "winston": "^3.13.0",
30
30
  "winston-daily-rotate-file": "^5.0.0"
@@ -799,11 +799,11 @@ export async function workSpace( req, res ) {
799
799
  },
800
800
  ];
801
801
 
802
- const auditUserCount = [ 'mobile-detection' ].includes( inputData.moduleType )?await aggregateUserEmpDetection( auditFiles ) : await aggregateBinaryAudit( auditFiles );
803
- const userIncompleteFilesCount = [ 'mobile-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' ].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,
@@ -980,7 +980,7 @@ export async function getAuditFile( req, res ) {
980
980
  query ={
981
981
  storeId: userDetails[0].storeId,
982
982
  fileDate: userDetails[0].fileDate,
983
- tempId: userDetails[0].tempId,
983
+ // tempId: userDetails[0].tempId,
984
984
  moduleType: userDetails[0].moduleType,
985
985
  };
986
986
  break;
@@ -1445,7 +1445,7 @@ export async function saveBinary( req, res ) {
1445
1445
  _id: inputData.auditId,
1446
1446
  storeId: inputData.storeId,
1447
1447
  fileDate: inputData.fileDate,
1448
- tempId: inputData.tempId,
1448
+ // tempId: inputData.tempId,
1449
1449
  moduleType: inputData.moduleType,
1450
1450
  };
1451
1451
 
@@ -1841,7 +1841,7 @@ export async function userAuditHistory( req, res ) {
1841
1841
  },
1842
1842
  );
1843
1843
  }
1844
- const count = [ 'mobile-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
  }
@@ -1886,10 +1886,13 @@ export async function userAuditHistory( req, res ) {
1886
1886
  temp['User Comments'] = element.userComments;
1887
1887
  break;
1888
1888
  case 'uniform-detection':
1889
- temp['Customer ID'] = element.tempId;
1890
- temp['Question'] = element.question;
1891
- temp['Result'] = element.answer;
1892
- temp['User Comments'] = element.userComments;
1889
+ // temp['Customer ID'] = element.tempId;
1890
+ // temp['Question'] = element.question;
1891
+ // temp['Result'] = element.answer;
1892
+ // temp['User Comments'] = element.userComments;
1893
+ temp['Before Count'] = element.beforeCount;
1894
+ temp['After Count'] = element.afterCount;
1895
+ temp['Accuracy'] = element.accuracy || '';
1893
1896
  break;
1894
1897
  case 'mobile-detection':
1895
1898
  temp['Before Count'] = element.beforeCount;
@@ -1914,7 +1917,7 @@ export async function userAuditHistory( req, res ) {
1914
1917
  {
1915
1918
  $limit: limit,
1916
1919
  } );
1917
- const result = [ 'mobile-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 );
1918
1921
 
1919
1922
  return res.sendSuccess( { result: result, count: count.length } );
1920
1923
  } catch ( error ) {
@@ -2239,7 +2242,7 @@ export async function clientMetrics( req, res ) {
2239
2242
  );
2240
2243
  }
2241
2244
 
2242
- const count = [ 'mobile-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 );
2243
2246
  logger.info( { count: count } );
2244
2247
  if ( count.length == 0 ) {
2245
2248
  return res.sendError( 'No Data Found', 204 );
@@ -2306,7 +2309,7 @@ export async function clientMetrics( req, res ) {
2306
2309
  );
2307
2310
  }
2308
2311
 
2309
- const result = [ 'mobile-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 );
2310
2313
  if ( result.length == 0 ) {
2311
2314
  return res.sendError( 'No Data Found', 204 );
2312
2315
  }
@@ -2341,7 +2344,7 @@ export async function storeMetrics( req, res ) {
2341
2344
  }
2342
2345
 
2343
2346
  if ( inputData.filterByStatus && inputData.filterByStatus?.length > 0 ) {
2344
- [ 'mobile-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 } } );
2345
2348
  }
2346
2349
 
2347
2350
  if ( inputData.filterByAuditType && inputData.filterByAuditType?.length > 0 ) {
@@ -2774,7 +2777,7 @@ export async function storeMetrics( req, res ) {
2774
2777
  },
2775
2778
  );
2776
2779
  }
2777
- const count = [ 'mobile-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 );
2778
2781
 
2779
2782
 
2780
2783
  if ( count.length == 0 ) {
@@ -2798,7 +2801,7 @@ export async function storeMetrics( req, res ) {
2798
2801
  $limit: limit,
2799
2802
  } );
2800
2803
  }
2801
- const result = [ 'mobile-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 );
2802
2805
  if ( inputData.isExport ) {
2803
2806
  const exportdata = [];
2804
2807
  result.forEach( ( element ) => {
@@ -2839,11 +2842,15 @@ export async function storeMetrics( req, res ) {
2839
2842
  temp['Accuracy'] = element.accuracy;
2840
2843
  break;
2841
2844
  case 'uniform-detection':
2842
- temp['Customer ID'] = element.tempId;
2843
- temp['Question'] = element.question;
2844
- temp['User Comments'] = element.userComments;
2845
- temp['Status'] = toCamelCase( element.auditStatus );
2846
- temp['Result'] = element.answer;
2845
+ // temp['Customer ID'] = element.tempId;
2846
+ // temp['Question'] = element.question;
2847
+ // temp['User Comments'] = element.userComments;
2848
+ // temp['Status'] = toCamelCase( element.auditStatus );
2849
+ // temp['Result'] = element.answer;
2850
+ temp['Before Count'] = element.beforeCount;
2851
+ temp['After Count'] = element.afterCount;
2852
+ temp['Status'] = toCamelCase( element.status );
2853
+ temp['Accuracy'] = element.accuracy;
2847
2854
  break;
2848
2855
  }
2849
2856
  exportdata.push( temp );
@@ -3117,7 +3124,7 @@ export async function userMetrics( req, res ) {
3117
3124
  );
3118
3125
  }
3119
3126
 
3120
- const count = [ 'mobile-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 );
3121
3128
  if ( count.length == 0 ) {
3122
3129
  return res.sendError( 'No Data Found', 204 );
3123
3130
  }
@@ -3153,7 +3160,7 @@ export async function userMetrics( req, res ) {
3153
3160
  'Audited Date': { $dateToString: { format: '%Y-%m-%d', date: '$createdAt' } },
3154
3161
  // 'Mapping Percentage': '$mappingPerc',
3155
3162
  };
3156
- [ 'mobile-detection' ].includes( inputData.moduleType )?
3163
+ [ 'mobile-detection' ,'uniform-detection'].includes( inputData.moduleType )?
3157
3164
  query.push(
3158
3165
  {
3159
3166
  $project: detection,
@@ -3167,7 +3174,7 @@ export async function userMetrics( req, res ) {
3167
3174
  }
3168
3175
 
3169
3176
 
3170
- const result = [ 'mobile-detection' ].includes( inputData.moduleType )?await aggregateUserEmpDetection( query ) : await aggregateBinaryAudit( query );
3177
+ const result = [ 'mobile-detection' ,'uniform-detection'].includes( inputData.moduleType )?await aggregateUserEmpDetection( query ) : await aggregateBinaryAudit( query );
3171
3178
  if ( inputData.isExport ) {
3172
3179
  await download( result, res );
3173
3180
  return;
@@ -3311,7 +3318,7 @@ export async function pendingSummaryTable( req, res ) {
3311
3318
  },
3312
3319
  );
3313
3320
  }
3314
- const count = [ 'mobile-detection' ].includes( inputData.moduleType )?await aggregateUserEmpDetection( query ) : await aggregateBinaryAudit( query );
3321
+ const count = [ 'mobile-detection' ,'uniform-detection'].includes( inputData.moduleType )?await aggregateUserEmpDetection( query ) : await aggregateBinaryAudit( query );
3315
3322
  if ( count.length == 0 ) {
3316
3323
  return res.sendError( 'No Data Found', 204 );
3317
3324
  }
@@ -3327,7 +3334,7 @@ export async function pendingSummaryTable( req, res ) {
3327
3334
  } );
3328
3335
  }
3329
3336
 
3330
- const result = [ 'mobile-detection' ].includes( inputData.moduleType )?await aggregateUserEmpDetection( query ) : await aggregateBinaryAudit( query );
3337
+ const result = [ 'mobile-detection' ,'uniform-detection'].includes( inputData.moduleType )?await aggregateUserEmpDetection( query ) : await aggregateBinaryAudit( query );
3331
3338
  if ( inputData.isExport ) {
3332
3339
  const exportdata = [];
3333
3340
  result.forEach( ( element ) => {
@@ -3356,8 +3363,9 @@ export async function pendingSummaryTable( req, res ) {
3356
3363
  temp['Before Count'] = element.beforeCount;
3357
3364
  break;
3358
3365
  case 'uniform-detection':
3359
- temp['Customer ID'] = element.tempId;
3360
- temp['Question'] = element.question;
3366
+ // temp['Customer ID'] = element.tempId;
3367
+ // temp['Question'] = element.question;
3368
+ temp['Before Count'] = element.beforeCount;
3361
3369
  break;
3362
3370
  }
3363
3371
  exportdata.push( temp );
@@ -3522,7 +3530,7 @@ export async function overAllAuditSummary( req, res ) {
3522
3530
  },
3523
3531
  ];
3524
3532
 
3525
- const storeAudit = [ 'mobile-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 );
3526
3534
  if ( storeAudit.length > 0 ) {
3527
3535
  temp.inprogressStores= storeAudit[0].inprogressStores;
3528
3536
  temp.completedStores = storeAudit[0].completedStores;
@@ -3710,7 +3718,7 @@ export async function summarySplit( req, res ) {
3710
3718
  },
3711
3719
  },
3712
3720
  ];
3713
- const result = [ 'mobile-detection' ].includes( inputData.moduleType )? await aggregateStoreEmpDetection( query ) : await aggregateBinaryAudit( binaryAuditQuery );
3721
+ const result = [ 'mobile-detection' ,'uniform-detection'].includes( inputData.moduleType )? await aggregateStoreEmpDetection( query ) : await aggregateBinaryAudit( binaryAuditQuery );
3714
3722
  const totalCount = await aggregateTraxAuditData( totalQuery );
3715
3723
  result[0].totalCount = totalCount[0]?.total;
3716
3724
  return res.sendSuccess( { result: result.length> 0? result[0]: temp } );
@@ -3740,7 +3748,7 @@ export async function overviewTable( req, res ) {
3740
3748
  }
3741
3749
 
3742
3750
  if ( inputData.filterByStatus.length > 0 ) {
3743
- [ 'mobile-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 } } );
3744
3752
  }
3745
3753
 
3746
3754
  const query =[
@@ -3857,7 +3865,7 @@ export async function overviewTable( req, res ) {
3857
3865
  },
3858
3866
  );
3859
3867
  }
3860
- const count = [ 'mobile-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 );
3861
3869
  if ( count.length == 0 ) {
3862
3870
  return res.sendError( 'No Data Found', 204 );
3863
3871
  }
@@ -3872,7 +3880,7 @@ export async function overviewTable( req, res ) {
3872
3880
  $limit: limit,
3873
3881
  } );
3874
3882
  }
3875
- const result = [ 'mobile-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 );
3876
3884
  if ( inputData.isExport ) {
3877
3885
  const exportdata = [];
3878
3886
  result.forEach( ( element ) => {
@@ -3909,11 +3917,15 @@ export async function overviewTable( req, res ) {
3909
3917
  temp['Status'] = toCamelCase( element.status );
3910
3918
  break;
3911
3919
  case 'uniform-detection':
3912
- temp['Customer ID'] = element.tempId;
3913
- temp['Question'] = element.question;
3914
- temp['User Comments'] = element.userComments;
3920
+ // temp['Customer ID'] = element.tempId;
3921
+ // temp['Question'] = element.question;
3922
+ // temp['User Comments'] = element.userComments;
3923
+ // temp['Audit Type'] = element.auditType;
3924
+ // temp['Status'] = toCamelCase( element.auditStatus );
3925
+ temp['Before Count'] = element.beforeCount;
3926
+ temp['After Count'] = element.afterCount;
3915
3927
  temp['Audit Type'] = element.auditType;
3916
- temp['Status'] = toCamelCase( element.auditStatus );
3928
+ temp['Status'] = toCamelCase( element.status );
3917
3929
  break;
3918
3930
  }
3919
3931
  exportdata.push( temp );
@@ -83,7 +83,7 @@ export async function isTraxAuditDocumentExist( req, res, next ) {
83
83
  query ={
84
84
  storeId: inputData.storeId,
85
85
  fileDate: inputData.fileDate,
86
- tempId: inputData.tempId,
86
+ // tempId: inputData.tempId,
87
87
  moduleType: inputData.moduleType,
88
88
  };
89
89
  break;