tango-app-api-audit 3.4.15 → 3.4.17

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.15",
3
+ "version": "3.4.17",
4
4
  "description": "audit & audit metrics apis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1725,14 +1725,16 @@ export async function userAuditHistory( req, res ) {
1725
1725
  logger.info( { mappedArrays: mappedArrays[0] } );
1726
1726
  await download( mappedArrays[0], res );
1727
1727
  return;
1728
+ } else {
1729
+ query.push( {
1730
+ $skip: offset,
1731
+ },
1732
+ {
1733
+ $limit: limit,
1734
+ } );
1728
1735
  }
1729
1736
 
1730
- query.push( {
1731
- $skip: offset,
1732
- },
1733
- {
1734
- $limit: limit,
1735
- } );
1737
+
1736
1738
  const result = await aggregateUserAudit( query );
1737
1739
 
1738
1740
  return res.sendSuccess( { result: result, count: count.length } );
@@ -1909,14 +1909,16 @@ export async function userAuditHistory( req, res ) {
1909
1909
  logger.info( { mappedArrays: mappedArrays[0] } );
1910
1910
  await download( mappedArrays[0], res );
1911
1911
  return;
1912
+ } else {
1913
+ query.push( {
1914
+ $skip: offset,
1915
+ },
1916
+ {
1917
+ $limit: limit,
1918
+ } );
1912
1919
  }
1913
1920
 
1914
- query.push( {
1915
- $skip: offset,
1916
- },
1917
- {
1918
- $limit: limit,
1919
- } );
1921
+
1920
1922
  const result = [ 'mobile-detection', 'uniform-detection' ].includes( inputData.moduleType )? await aggregateUserEmpDetection( query ) : await aggregateBinaryAudit( query );
1921
1923
 
1922
1924
  return res.sendSuccess( { result: result, count: count.length } );
@@ -4582,9 +4584,9 @@ export async function save( req, res ) {
4582
4584
  clientName: getClient?.clientName,
4583
4585
  storeId: inputData.storeId,
4584
4586
  storeName: getStore?.storeName,
4585
- spocName: getStore?.spocDetails[0]?.name,
4586
- spocEmail: getStore?.spocDetails[0]?.email,
4587
- spocContact: getStore?.spocDetails[0].contact,
4587
+ spocName: getStore?.spocDetails? getStore?.spocDetails[0]?.name : '',
4588
+ spocEmail: getStore?.spocDetails? getStore?.spocDetails[0]?.email:'',
4589
+ spocContact: getStore?.spocDetails? getStore?.spocDetails[0].contact:'',
4588
4590
  address: getStore?.storeProfile?.address,
4589
4591
  fileDate: inputData.fileDate,
4590
4592
  moduleType: inputData.moduleType,
@@ -4625,7 +4627,7 @@ export async function save( req, res ) {
4625
4627
  const err = error.message || 'Internal Server Error';
4626
4628
  logger.error( {
4627
4629
  error: error,
4628
- message: req.query,
4630
+ message: req.body,
4629
4631
  function: 'saveTrax',
4630
4632
  } );
4631
4633
  return res.sendError( err, 500 );
@@ -11,7 +11,7 @@ export async function validateUserEmpDetection( req, res, next ) {
11
11
  _id: inputData.auditId,
12
12
  } );
13
13
  if ( !userAuditDetails ) {
14
- return res.sendError( 'No Data Available' );
14
+ return res.sendError( 'No Data Available', 204 );
15
15
  } else if ( userAuditDetails && userAuditDetails.auditStatus == 'skipped' ) {
16
16
  return res.sendError( 'The Audit file Assigned to some one else', 203 );
17
17
  }
@@ -21,7 +21,7 @@ export async function validateUserEmpDetection( req, res, next ) {
21
21
  const err = error.message || 'Internal Server Error';
22
22
  logger.error( {
23
23
  error: error,
24
- message: req.query,
24
+ message: req.body,
25
25
  function: 'validateUserEmpDetection',
26
26
  } );
27
27
  return res.sendError( err, 500 );