tango-app-api-audit 3.6.58 → 3.6.60

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.6.58",
3
+ "version": "3.6.60",
4
4
  "description": "audit & audit metrics apis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -28,7 +28,7 @@
28
28
  "nodemailer": "^7.0.10",
29
29
  "nodemon": "^3.1.3",
30
30
  "swagger-ui-express": "^5.0.1",
31
- "tango-api-schema": "^2.6.41",
31
+ "tango-api-schema": "^2.6.42",
32
32
  "tango-app-api-middleware": "^3.6.18",
33
33
  "winston": "^3.13.0",
34
34
  "winston-daily-rotate-file": "^5.0.0"
@@ -948,6 +948,7 @@ export async function getFilterData( msg, user ) {
948
948
  }
949
949
  } catch ( error ) {
950
950
  /* openSearch logs start*/
951
+ const bucket = JSON.parse( process.env.BUCKET );
951
952
  const id = `${msg.store_id}_${msg.zone_id}_${msg.curr_date}_${bucket.masterJsonFile}_getFilterData_Error_${user?.email}_${Date.now()}`;
952
953
  let temp = msg;
953
954
  temp.logType='audit';
@@ -1034,7 +1035,11 @@ export async function getAuditImage( msg, user ) {
1034
1035
  }
1035
1036
  } catch ( error ) {
1036
1037
  /* openSearch logs start*/
1037
- const id = `${fileDate}_${storeId}_${msg.zone_id}_${bucket.auditInput}_getAuditImage_Error_${user?.email}_${Date.now()}`;
1038
+ const bucket = JSON.parse( process.env.BUCKET );
1039
+ const fetchData = {};
1040
+ fetchData.Bucket = `${bucket.auditInput}`;
1041
+ fetchData.filePath = `${msg?.curr_date}/${msg?.store_id}/${msg.zone_id}/`;
1042
+ const id = `${msg?.curr_date}_${msg?.store_id}_${msg.zone_id}_${bucket.auditInput}_getAuditImage_Error_${user?.email}_${Date.now()}`;
1038
1043
  let temp = msg;
1039
1044
  temp.logType='audit';
1040
1045
  temp.logSubType='get-audit-file';
@@ -1602,6 +1607,17 @@ export async function save( req, res ) {
1602
1607
  moduleType: inputData.moduleType,
1603
1608
  zoneName: inputData.zoneName,
1604
1609
  } );
1610
+ if ( storeAuditData?.status === 'completed' ) {
1611
+ logger.info( {
1612
+ message: 'This file is already submitted',
1613
+ storeId: inputData.storeId,
1614
+ fileDate: inputData.fileDate,
1615
+ moduleType: inputData.moduleType,
1616
+ zoneName: inputData.zoneName,
1617
+ function: 'save',
1618
+ } );
1619
+ return res.sendError( 'This file is already submitted', 409 );
1620
+ }
1605
1621
  if ( inputData.moduleType !=='track' ) {
1606
1622
  const params = {
1607
1623
  Key: `${inputData.storeId}/${inputData.zoneName}/${inputData.fileDate}/${bucket.masterJsonFile}`,