tango-app-api-audit 3.4.11-alpha.6 → 3.4.11-alpha.8

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.4.11-alpha.6",
3
+ "version": "3.4.11-alpha.8",
4
4
  "description": "audit & audit metrics apis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -998,7 +998,7 @@ export async function getAuditFile( req, res ) {
998
998
  logger.info( { query: query } );
999
999
  const traxInfo = await findOneTraxAuditData( query );
1000
1000
  if ( !traxInfo ) {
1001
- return res.sendError( 'The sorce record not found', 400 );
1001
+ return res.sendError( 'The source record not found', 400 );
1002
1002
  }
1003
1003
  msg =traxInfo?.sqs?.Body;
1004
1004
  break;
@@ -1251,46 +1251,35 @@ export async function getUpdatedFile( req, res ) {
1251
1251
  },
1252
1252
  ];
1253
1253
  break;
1254
- case 'unattended-customer':
1255
- for ( let i =0; i< msg.fileDetails.length; i++ ) {
1256
- const files = [];
1257
- const params ={
1254
+
1255
+ case 'uniform-detection':
1256
+ const files = [];
1257
+
1258
+ const params ={
1259
+ Bucket: msg.inputBucketName,
1260
+ Key: msg?.filePath,
1261
+ };
1262
+
1263
+ const isExists = await checkFileExist( params );
1264
+
1265
+ if ( isExists ) {
1266
+ const signedParams ={
1258
1267
  Bucket: msg.inputBucketName,
1259
- file_path: msg?.fileDetails[i]?.folderPath,
1260
- MaxKeys: 1000,
1268
+ file_path: msg?.filePath,
1261
1269
  };
1262
- const list = await listFileByPath( params );
1263
- const folderPath = list.data;
1264
- logger.info( { folderPath: list, params: params, list: list } );
1265
- if ( folderPath?.length ) {
1266
- for ( let i = 0; i < folderPath.length; i++ ) {
1267
- // const img = folderPath[i].Key.split( '/' );
1268
- // const image = img[3].split( '.' );
1269
- // const indexes = image[0].split( '_' );
1270
- const signedParams ={
1271
- Bucket: msg.inputBucketName,
1272
- file_path: folderPath[i].Key,
1273
- };
1274
- const data = await signedUrl( signedParams );
1270
+ const data = await signedUrl( signedParams );
1275
1271
 
1276
- files.push(
1277
- data,
1278
- );
1279
- }
1280
- } else {
1281
- logger.error( {
1282
- error: { folderPath: folderPath },
1283
- function: `getAuditFile - ${inputData.moduleType}`,
1284
- message: 'Bucket image data not availale',
1285
- } );
1286
- return res.sendError( 'Bucket is Empty', 204 );
1287
- }
1288
- result.push( {
1289
- type: msg.fileDetails[i].type,
1290
- file: files,
1291
- } );
1272
+ files.push(
1273
+ data,
1274
+ );
1292
1275
  }
1276
+ result.push( {
1277
+ type: 'image',
1278
+ file: files,
1279
+ } );
1280
+
1293
1281
  break;
1282
+ case 'unattended-customer':
1294
1283
  case 'left-in-middle':
1295
1284
  for ( let i =0; i< msg.fileDetails.length; i++ ) {
1296
1285
  const files = [];
@@ -1490,6 +1479,7 @@ export async function saveBinary( req, res ) {
1490
1479
  tempId: inputData.tempId,
1491
1480
  moduleType: inputData.moduleType,
1492
1481
  answer: inputData.answer,
1482
+ inputBucketName: getFilePath?.sqs?.Body?.inputBucketName,
1493
1483
  filePath: getFilePath?.sqs?.Body?.filePath,
1494
1484
  } ),
1495
1485
  };
@@ -4534,8 +4524,8 @@ export async function save( req, res ) {
4534
4524
  }
4535
4525
  const tempId=[];
4536
4526
  if ( inputData.employeeCount > 0 ) {
4537
- for ( let i =0; i<employee.length; i++ ) {
4538
- tempId.push( employee[i].img_id );
4527
+ for ( let i =0; i<inputData?.employee.length; i++ ) {
4528
+ tempId.push( inputData?.employee[i].img_id );
4539
4529
  }
4540
4530
  }
4541
4531
  const sqsProduceQueue = {
@@ -4544,6 +4534,7 @@ export async function save( req, res ) {
4544
4534
  storeId: inputData.storeId,
4545
4535
  fileDate: inputData.fileDate,
4546
4536
  moduleType: inputData.moduleType,
4537
+ inputBucketName: getFilePath?.sqs?.Body?.inputBucketName,
4547
4538
  tempId: tempId,
4548
4539
  count: inputData.employeeCount,
4549
4540
  folderPath: getFilePath?.sqs?.Body?.folderPath,