tango-app-api-audit 3.5.11 → 3.5.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-app-api-audit",
3
- "version": "3.5.11",
3
+ "version": "3.5.13",
4
4
  "description": "audit & audit metrics apis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -26,8 +26,8 @@
26
26
  "mongodb": "^6.7.0",
27
27
  "nodemon": "^3.1.3",
28
28
  "swagger-ui-express": "^5.0.1",
29
- "tango-api-schema": "^2.2.137",
30
- "tango-app-api-middleware": "^3.1.80",
29
+ "tango-api-schema": "^2.2.197",
30
+ "tango-app-api-middleware": "^3.1.87",
31
31
  "winston": "^3.13.0",
32
32
  "winston-daily-rotate-file": "^5.0.0"
33
33
  },
@@ -1578,7 +1578,7 @@ export async function save( req, res ) {
1578
1578
  const temp = getData?.body?.hits?.hits?.map( ( item ) => item._id );
1579
1579
  const body = temp.flatMap( ( id ) => [
1580
1580
  { update: { _index: openSearch.trackerInput, _id: id } },
1581
- { doc: { outputCluster: imgName, EmployeeStatusFinal: 1, isJunk: false } },
1581
+ { doc: { outputCluster: imgName, auditOutputCluster: imgName, EmployeeStatusFinal: 1, isJunk: false } },
1582
1582
  ] );
1583
1583
  const re= await bulkUpdate( body );
1584
1584
  logger.info( { re: re, storeId: inputData.storeId, fileDate: inputData.fileDate, function: 'tracking save - customer' } );
@@ -1709,7 +1709,7 @@ export async function save( req, res ) {
1709
1709
  logger.info( { custoemrTemp: temp } );
1710
1710
  const body = temp.flatMap( ( id ) => [
1711
1711
  { update: { _index: openSearch.trackerInput, _id: id } },
1712
- { doc: { outputCluster: 50000 } },
1712
+ { doc: { outputCluster: 50000, auditOutputCluster: 50000 } },
1713
1713
  ] );
1714
1714
  const re= await bulkUpdate( body );
1715
1715
  logger.info( { getCusId: getCusId, re: re, storeId: inputData.storeId, auditType: inputData.auditType, fileDate: inputData.fileDate, function: 'tracking save - junk false mapping' } );
@@ -1127,6 +1127,29 @@ export async function saveBinary( req, res ) {
1127
1127
  if ( updatDataunattended.modifiedCount==0 ) {
1128
1128
  return res.sendError( 'Update failed, it may be invalid request', 400 );
1129
1129
  }
1130
+ const getQuery = {
1131
+ storeId: inputData.storeId,
1132
+ fileDate: inputData.fileDate,
1133
+ tempId: inputData.tempId,
1134
+ moduleType: inputData.moduleType,
1135
+ };
1136
+ const getupdatedData = await findOneBinaryAudit( getQuery );
1137
+ const getTraxInsertData = await findOneTraxAuditData( getQuery, { sqs: 1 } );
1138
+ const OpenSearchOutput = {
1139
+ clientId: getupdatedData?.clientId,
1140
+ storeId: getupdatedData?.storeId,
1141
+ moduleType: getupdatedData?.moduleType,
1142
+ fileDate: getupdatedData?.fileDate,
1143
+ auditStatus: getupdatedData?.auditStatus,
1144
+ questionType: getupdatedData?.questionType,
1145
+ Answer: getupdatedData?.answer,
1146
+ inputBucketName: getTraxInsertData?.sqs?.Body?.inputBucketName,
1147
+ tempId: [ getTraxInsertData?.sqs?.Body?.tempId ],
1148
+ question: getTraxInsertData?.sqs?.Body?.question,
1149
+ fileDetails: getTraxInsertData?.sqs?.Body?.fileDetails,
1150
+ createdAt: new Date(),
1151
+ };
1152
+ await insertOpenSearchData( openSearch.traxDetectionOutput, OpenSearchOutput );
1130
1153
  const logData2 = {
1131
1154
  userId: req.user._id,
1132
1155
  userName: req.user.userName,
@@ -1151,6 +1174,7 @@ export async function saveBinary( req, res ) {
1151
1174
  createdAt: Date.now(),
1152
1175
  };
1153
1176
  await insertOpenSearchData( openSearch.auditLog, logData2 );
1177
+
1154
1178
  return res.sendSuccess( `Successfully updated in ${value}` );
1155
1179
 
1156
1180
  break;