tango-app-api-audit 3.5.7-stage.2 → 3.5.7

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.7-stage.2",
3
+ "version": "3.5.7",
4
4
  "description": "audit & audit metrics apis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -611,7 +611,7 @@ export async function getAuditFile( req, res ) {
611
611
  const image = img[3]?.split( '.' );
612
612
  const indexes = msg.zone_id === 'track' ? msg.audit_type === 'ReAudit'? folderPath[i]?._source?.outputCluster ===50000? folderPath[i]?._source?.REIDCluster:folderPath[i]?._source?.outputCluster:folderPath[i]?._source?.REIDCluster: image[0]?.split( '_' );
613
613
  fetchData.file_path = msg.zone_id === 'track' ?folderPath[i]?._source?.personPath:folderPath[i].Key;
614
- const data =msg.zone_id === 'track' ? `${url.trackInput}${folderPath[i]?._source?.personPath}` : `${url.auditInput}${folderPath[i].Key}`; // await signedUrl( fetchData );
614
+ const data =msg.zone_id === 'track' ? `${url.trackInput}${folderPath[i]?._source?.personPath}` :await signedUrl( fetchData );
615
615
  const mapimg = {
616
616
  img_path: data,
617
617
  img_name: msg.zone_id === 'track' ?indexes: indexes[1],
@@ -1397,13 +1397,12 @@ export async function save( req, res ) {
1397
1397
  params.Bucket = bucket.auditUploadBucket;
1398
1398
  } else {
1399
1399
  params.Bucket = bucket.masterJson;
1400
- params.Key = `${inputData.storeId}/${inputData.zoneName}/${inputData.fileDate}/${bucket.srcMasterJsonFile}`;
1401
1400
  }
1402
1401
  const fileData = await getJsonFileData( params );
1403
1402
 
1404
1403
  if ( fileData?.statusCode ) {
1405
1404
  logger.error( {
1406
- error: `ERROR IN GET MAPPING FILE: ${params.Key}`,
1405
+ error: `ERROR IN UPLOAD PATH: ${inputData.storeId}/${inputData.fileDate}/${bucket.masterJsonFile}`,
1407
1406
  type: 'UPLOAD_ERROR',
1408
1407
  } );
1409
1408
  return res.sendError( fileData, 500 );
@@ -1755,7 +1754,7 @@ export async function save( req, res ) {
1755
1754
  const ratio = ( ( storeAuditData.beforeCount - inputData.customerCount ) / storeAuditData.beforeCount );
1756
1755
  if ( ratio < clientData[0].auditConfigs.ratio &&
1757
1756
  inputData.auditType == 'Audit' &&
1758
- inputData.moduleType == 'traffic1'
1757
+ inputData.moduleType == 'traffic'
1759
1758
  ) {
1760
1759
  logger.info(
1761
1760
  `Hit in Reaudit pushing queue Store Id=${inputData.storeId},File Date=${inputData.fileDate}, /n \nQueue Name = ${clientData[0].auditConfigs.queueName}`,
@@ -1879,37 +1878,36 @@ export async function save( req, res ) {
1879
1878
  const getBody = await aggregateAuditStoreData( getQuery );
1880
1879
  const streams = getBody? getBody?.sqs?.streams : null;
1881
1880
  const sqsProduceQueue = inputData.moduleType === 'track'?
1882
- {
1883
- QueueUrl: `${sqs.url}${sqs.trackOutput}`,
1884
- MessageBody: JSON.stringify( {
1885
- store_id: inputData.storeId,
1886
- zone_id: [ 'traffic_zone' ],
1887
- streams: streams || [],
1888
- store_date: inputData.fileDate,
1889
- bucket_name: 'tango-yolo-v2-output',
1890
- time: '23:00',
1891
- retry: 1,
1892
- } ),
1893
- MessageGroupId: 'my-group-1', // Required for FIFO queues
1894
- MessageDeduplicationId: Date.now().toString(), // Or a UUID, if content-based deduplication is off
1895
- }:
1896
- {
1897
- QueueUrl: ( auditConfig?.isCheckMinAfterCount ==1 && inputData.customerCount > auditConfig?.minAfterCount ) ? `${sqs.url}${sqs.feature_new}`: `${sqs.url}${sqs.feature}`,
1898
- MessageBody: JSON.stringify( {
1899
- store_id: inputData.storeId,
1900
- store_date: inputData.fileDate,
1901
- bucket_name: `${bucket.auditUploadBucket}`,
1902
- zone_id: inputData.zoneName,
1903
- process_type: 'audit',
1904
- } ),
1905
- };
1881
+ {
1882
+ QueueUrl: `${sqs.url}${sqs.trackOutput}`,
1883
+ MessageBody: JSON.stringify( {
1884
+ store_id: inputData.storeId,
1885
+ zone_id: [ 'traffic_zone' ],
1886
+ streams: streams || [],
1887
+ store_date: inputData.fileDate,
1888
+ bucket_name: 'tango-yolo-v2-output',
1889
+ time: '23:00',
1890
+ retry: 1,
1891
+ } ),
1892
+ MessageGroupId: 'my-group-1', // Required for FIFO queues
1893
+ MessageDeduplicationId: Date.now().toString(), // Or a UUID, if content-based deduplication is off
1894
+ }:
1895
+ {
1896
+ QueueUrl: ( auditConfig?.isCheckMinAfterCount ==1 && inputData.customerCount > auditConfig?.minAfterCount ) ? `${sqs.url}${sqs.feature_new}`: `${sqs.url}${sqs.feature}`,
1897
+ MessageBody: JSON.stringify( {
1898
+ store_id: inputData.storeId,
1899
+ store_date: inputData.fileDate,
1900
+ bucket_name: `${bucket.auditUploadBucket}`,
1901
+ zone_id: inputData.zoneName,
1902
+ process_type: 'audit',
1903
+ } ),
1904
+ };
1906
1905
  logger.info( { sqsProduceQueue: sqsProduceQueue } );
1907
- const sqsQueue = inputData.moduleType === 'track'? await sendMessageToFIFOQueue( sqsProduceQueue ) : null;
1908
- // await sendMessageToQueue(
1909
- // sqsProduceQueue.QueueUrl,
1910
- // sqsProduceQueue.MessageBody,
1906
+ const sqsQueue = inputData.moduleType === 'track'? await sendMessageToFIFOQueue( sqsProduceQueue ) : await sendMessageToQueue(
1907
+ sqsProduceQueue.QueueUrl,
1908
+ sqsProduceQueue.MessageBody,
1911
1909
 
1912
- // );
1910
+ );
1913
1911
 
1914
1912
  logger.info( { sqsQueue: sqsQueue } );
1915
1913
  if ( inputData.moduleType === 'track' ) {