tango-app-api-audit 3.4.56 → 3.4.57

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.56",
3
+ "version": "3.4.57",
4
4
  "description": "audit & audit metrics apis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -4525,19 +4525,19 @@ export async function getDetectionAuditFile( req, res ) {
4525
4525
 
4526
4526
  for ( let i = 0; i < folderPath?.length; i++ ) {
4527
4527
  const item = folderPath[i];
4528
- const img = item?.file_path?.split( '/' );
4528
+ // const img = item?.file_path?.split( '/' );
4529
4529
  const time = item?.time;
4530
4530
  const Key = item?.file_path;
4531
4531
  const data = `${bucketCDN}${Key}`;
4532
4532
  const mapimg = {
4533
4533
  img_path: data,
4534
4534
  img_name: time,
4535
- img_id: img[3],
4535
+ img_id: `${item?.file_path}_${time}`,
4536
4536
  };
4537
4537
  files.push( {
4538
4538
  img_path: data,
4539
4539
  img_name: time,
4540
- img_id: img[3],
4540
+ img_id: `${item?.file_path}_${time}`,
4541
4541
  selected: false,
4542
4542
  dropped: false,
4543
4543
  singleDetection: false,
@@ -4828,7 +4828,7 @@ export async function save( req, res ) {
4828
4828
  for ( let i =0; i<inputData?.employee.length; i++ ) {
4829
4829
  tempId.push( inputData?.employee[i].img_id );
4830
4830
  }
4831
- if ( inputData.moduleType !== 'hygiene' ) {
4831
+ if ( [ 'mobile-detection', 'uniform-detetction' ].includes( inputData.moduleType ) ) {
4832
4832
  const sqsProduceQueue = {
4833
4833
  QueueUrl: `${sqs.url}${sqs.uniformOutput}`,
4834
4834
  MessageBody: JSON.stringify( {
@@ -4858,7 +4858,7 @@ export async function save( req, res ) {
4858
4858
  }
4859
4859
  }
4860
4860
 
4861
-
4861
+ const outputFilePath = temp[0]?.split( '_' );
4862
4862
  // trax output in open serach
4863
4863
  const folderPath = getFilePath?.sqs?.Body?.folderPath;
4864
4864
  const output = {
@@ -4877,7 +4877,9 @@ export async function save( req, res ) {
4877
4877
  inputBucketName: getFilePath?.sqs?.Body?.inputBucketName,
4878
4878
  tempId: tempId,
4879
4879
  count: inputData.employeeCount,
4880
- folderPath: folderPath.split( '/' ).slice( 0, -1 ).join( '/' ) + '/',
4880
+ time: [ 'open-time', 'close-time' ].includes( inputData?.moduleType )?outputFilePath[1]:'',
4881
+ bufferTime: [ 'open-time', 'close-time' ].includes( inputData?.moduleType )? getFilePath?.sqs?.Body?.bufferTime : '',
4882
+ folderPath: [ 'open-time', 'close-time' ].includes( inputData?.moduleType )? outputFilePath[0]: folderPath.split( '/' ).slice( 0, -1 ).join( '/' ) + '/',
4881
4883
  createdAt: new Date(),
4882
4884
  };
4883
4885
  let filter= [
@@ -4963,7 +4965,24 @@ export async function reTrigger( req, res ) {
4963
4965
  const message = req.sqs;
4964
4966
  const sqs = JSON.parse( process.env.SQS );
4965
4967
  const getQueueName = await findOneClient( { clientId: req.audit.clientId }, { 'auditConfigs': 1 } );
4966
- const queueName = inputData.moduleType == 'uniform-detection' ? getQueueName?.auditConfigs?.traxQueueName?.uniformDetection : inputData.moduleType == 'mobile-detection' ?getQueueName?.auditConfigs?.traxQueueName?.mobileDetection : getQueueName?.auditConfigs?.traxQueueName?.hygiene;
4968
+ let queueName='';
4969
+ switch ( inputData.moduleType ) {
4970
+ case 'uniform-detection':
4971
+ queueName=getQueueName?.auditConfigs?.traxQueueName?.uniformDetection;
4972
+ break;
4973
+ case 'mobile-detection':
4974
+ queueName=getQueueName?.auditConfigs?.traxQueueName?.mobileDetection;
4975
+ break;
4976
+ case 'hygiene':
4977
+ queueName=getQueueName?.auditConfigs?.traxQueueName?.hygiene;
4978
+ break;
4979
+ case 'open-time':
4980
+ case 'close-time':
4981
+ queueName=getQueueName?.auditConfigs?.traxQueueName?.openClose;
4982
+ break;
4983
+ default:
4984
+ return res.sendError( 'Please give valid module type' );
4985
+ }
4967
4986
  if ( !getQueueName || queueName == '' ) {
4968
4987
  return res.sendError( 'queueName does not create', 400 );
4969
4988
  }