tango-app-api-audit 3.3.0-alpha.22 → 3.3.0-alpha.24

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.3.0-alpha.22",
3
+ "version": "3.3.0-alpha.24",
4
4
  "description": "audit & audit metrics apis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -240,7 +240,7 @@ export async function getAuditFile( req, res ) {
240
240
  const userAssign = await aggregateAssignAudit( query );
241
241
  if ( userAssign.length > 0 ) {
242
242
  logger.info( 'Hit in user assign', { inputData } );
243
- userAssign[0].fileType == 'Audit' ?
243
+ userAssign[0].auditType == 'Audit' ?
244
244
  ( msg = {
245
245
  store_id: userAssign[0].storeId,
246
246
  curr_date: userAssign[0].fileDate,
@@ -250,7 +250,7 @@ export async function getAuditFile( req, res ) {
250
250
  ( msg = {
251
251
  store_id: userAssign[0].storeId,
252
252
  curr_date: userAssign[0].fileDate,
253
- audit_type: userAssign[0].fileType,
253
+ audit_type: userAssign[0].auditType,
254
254
  total_count: userAssign[0].fileCount,
255
255
  zone_id: userAssign[0].zoneName,
256
256
  } );
@@ -1143,6 +1143,7 @@ export async function saveDraft( req, res ) {
1143
1143
  const storeQuery = {
1144
1144
  storeId: inputData.storeId,
1145
1145
  fileDate: inputData.fileDate,
1146
+ zoneName: inputData.zoneName,
1146
1147
  };
1147
1148
 
1148
1149
  let storeRecord = {
@@ -1646,46 +1647,25 @@ export async function userAuditHistory( req, res ) {
1646
1647
  const promises = chunkedMappingData.map( async ( chunk ) => {
1647
1648
  const exportData = [];
1648
1649
  chunk.forEach( ( element ) => {
1649
- if ( element.moduleType == 'zone' ) {
1650
- exportData.push( {
1651
- 'File Date': element.fileDate,
1652
- 'Brand ID': element.clientId,
1653
- 'Brand Name': element.clientName,
1654
- 'Store ID': element.storeId,
1655
- 'Store Name': element.storeName,
1656
- 'Zone Name': element.zoneName,
1657
- 'Audit Type': element.auditType,
1658
- 'Product Type': element.moduleType,
1659
- 'Before Count': element.beforeCount,
1660
- 'After Count': element.afterCount || '',
1661
- 'Accuracy': element.accuracy || '',
1662
- 'Start Time': element.startTime,
1663
- 'End Time': element.endTime || '',
1664
- 'Time Spent': element.timeSpent,
1665
- 'Audit Status': element.auditStatus,
1666
- 'Audited Date': dayjs( element.createdAt ).format( 'YYYY,MMM D' ),
1667
-
1668
- } );
1669
- } else {
1670
- exportData.push( {
1671
- 'File Date': element.fileDate,
1672
- 'Brand ID': element.clientId,
1673
- 'Brand Name': element.clientName,
1674
- 'Store ID': element.storeId,
1675
- 'Store Name': element.storeName,
1676
- 'Audit Type': element.auditType,
1677
- 'Product Type': element.moduleType,
1678
- 'Before Count': element.beforeCount,
1679
- 'After Count': element.afterCount || '',
1680
- 'Accuracy': element.accuracy || '',
1681
- 'Start Time': element.startTime,
1682
- 'End Time': element.endTime || '',
1683
- 'Time Spent': element.timeSpent,
1684
- 'Audit Status': element.auditStatus,
1685
- 'Audited Date': dayjs( element.createdAt ).format( 'YYYY,MMM D' ),
1650
+ exportData.push( {
1651
+ 'File Date': element.fileDate,
1652
+ 'Brand ID': element.clientId,
1653
+ 'Brand Name': element.clientName,
1654
+ 'Store ID': element.storeId,
1655
+ 'Store Name': element.storeName,
1656
+ 'Zone Name': element.moduleType == 'zone'? element.zoneName : '',
1657
+ 'Audit Type': element.auditType,
1658
+ 'Product Type': element.moduleType,
1659
+ 'Before Count': element.beforeCount,
1660
+ 'After Count': element.afterCount || '',
1661
+ 'Accuracy': element.accuracy || '',
1662
+ 'Start Time': element.startTime,
1663
+ 'End Time': element.endTime || '',
1664
+ 'Time Spent': element.timeSpent,
1665
+ 'Audit Status': element.auditStatus,
1666
+ 'Audited Date': dayjs( element.createdAt ).format( 'YYYY,MMM D' ),
1686
1667
 
1687
- } );
1688
- }
1668
+ } );
1689
1669
  } );
1690
1670
  return exportData;
1691
1671
  } );
@@ -2936,7 +2916,7 @@ export async function reTrigger( req, res ) {
2936
2916
  await insertOpenSearchData( openSearch.auditLog, logData );
2937
2917
  }
2938
2918
 
2939
- return res.sendSuccess( { result: 'The File has been Re-Trigger Succesfully' } );
2919
+ return res.sendSuccess( { result: 'The File has been Re-Triggered Succesfully' } );
2940
2920
  } catch ( error ) {
2941
2921
  const err = error.message;
2942
2922
  logger.error( { error: error, message: req.body, function: 'reTrigger' } );
@@ -12,7 +12,7 @@ auditRouter.get( '/clients', isAllowedSessionHandler, validate( clientValid ), c
12
12
  auditRouter.post( '/audit-stores', isAllowedSessionHandler, validate( auditStoreValid ), auditStoreList );
13
13
  auditRouter.get( '/tango-users', isAllowedSessionHandler, auditUserList );
14
14
 
15
- // Audit Mapping
15
+ // Audit Mapping
16
16
  auditRouter.get( '/get-file', isAllowedSessionHandler, validate( getFileValid ), isExistsQueue, getAuditFile );
17
17
  auditRouter.post( '/save-draft', isAllowedSessionHandler, validate( saveDraftValid ), saveDraft );
18
18
  auditRouter.get( '/get-drafted-data', isAllowedSessionHandler, validate( getDraftedDataValid ), getDraftedData );