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

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.0",
3
+ "version": "3.5.7-stage.2",
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}` :await signedUrl( fetchData );
614
+ const data =msg.zone_id === 'track' ? `${url.trackInput}${folderPath[i]?._source?.personPath}` : `${url.auditInput}${folderPath[i].Key}`; // await signedUrl( fetchData );
615
615
  const mapimg = {
616
616
  img_path: data,
617
617
  img_name: msg.zone_id === 'track' ?indexes: indexes[1],
@@ -1397,12 +1397,13 @@ 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}`;
1400
1401
  }
1401
1402
  const fileData = await getJsonFileData( params );
1402
1403
 
1403
1404
  if ( fileData?.statusCode ) {
1404
1405
  logger.error( {
1405
- error: `ERROR IN UPLOAD PATH: ${inputData.storeId}/${inputData.fileDate}/${bucket.masterJsonFile}`,
1406
+ error: `ERROR IN GET MAPPING FILE: ${params.Key}`,
1406
1407
  type: 'UPLOAD_ERROR',
1407
1408
  } );
1408
1409
  return res.sendError( fileData, 500 );
@@ -1878,36 +1879,37 @@ export async function save( req, res ) {
1878
1879
  const getBody = await aggregateAuditStoreData( getQuery );
1879
1880
  const streams = getBody? getBody?.sqs?.streams : null;
1880
1881
  const sqsProduceQueue = inputData.moduleType === 'track'?
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
- };
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
+ };
1905
1906
  logger.info( { sqsProduceQueue: sqsProduceQueue } );
1906
- const sqsQueue = inputData.moduleType === 'track'? await sendMessageToFIFOQueue( sqsProduceQueue ) : await sendMessageToQueue(
1907
- sqsProduceQueue.QueueUrl,
1908
- sqsProduceQueue.MessageBody,
1907
+ const sqsQueue = inputData.moduleType === 'track'? await sendMessageToFIFOQueue( sqsProduceQueue ) : null;
1908
+ // await sendMessageToQueue(
1909
+ // sqsProduceQueue.QueueUrl,
1910
+ // sqsProduceQueue.MessageBody,
1909
1911
 
1910
- );
1912
+ // );
1911
1913
 
1912
1914
  logger.info( { sqsQueue: sqsQueue } );
1913
1915
  if ( inputData.moduleType === 'track' ) {