tango-app-api-audit 3.5.1 → 3.5.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.1",
3
+ "version": "3.5.2",
4
4
  "description": "audit & audit metrics apis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -543,13 +543,11 @@ export async function getAuditFile( req, res ) {
543
543
 
544
544
  query: {
545
545
  bool: {
546
- must: [
546
+ 'must': [
547
547
  {
548
548
  term: { 'store_id.keyword': msg.store_id },
549
549
  },
550
- // {
551
- // term: { isJunk: false },
552
- // },
550
+
553
551
  {
554
552
  term: { isEmployee: false },
555
553
  },
@@ -560,6 +558,11 @@ export async function getAuditFile( req, res ) {
560
558
  term: { 'module.keyword': 'CUSTOMER' },
561
559
  },
562
560
  ],
561
+ 'should': [
562
+ { 'term': { 'isJunk': false } },
563
+ { 'bool': { 'must_not': { 'exists': { 'field': 'isJunk' } } } },
564
+ ],
565
+ 'minimum_should_match': 1,
563
566
  },
564
567
  },
565
568
 
@@ -618,7 +621,7 @@ export async function getAuditFile( req, res ) {
618
621
  userId: req.user._id,
619
622
  storeId: msg.store_id,
620
623
  clientId: msg.store_id.split( '-' )[0],
621
- auditType: 'Audit',
624
+ auditType: msg.audit_type || 'Audit',
622
625
  fileDate: msg.curr_date,
623
626
  queueName: inputData.queueName,
624
627
  beforeCount: msg.total_count || files.length,
@@ -639,7 +642,7 @@ export async function getAuditFile( req, res ) {
639
642
  userId: req.user._id,
640
643
  storeId: msg.store_id,
641
644
  clientId: msg.store_id.split( '-' )[0],
642
- auditType: 'Audit',
645
+ auditType: msg.audit_type ||'Audit',
643
646
  fileDate: msg.curr_date,
644
647
  queueName: inputData.queueName,
645
648
  beforeCount: msg.total_count || files.length,
@@ -705,7 +708,7 @@ export async function getAuditFile( req, res ) {
705
708
  queueName: inputData.queueName,
706
709
  store_id: storeId,
707
710
  file_date: fileDate,
708
- type: 'Audit',
711
+ type: msg.audit_type || 'Audit',
709
712
  auditId: insertData._id,
710
713
  userId: insertData.userId,
711
714
  zoneName: msg.zone_id,
@@ -1694,7 +1697,7 @@ export async function save( req, res ) {
1694
1697
  { 'module': 'REID-TRACKER-V1',
1695
1698
  'store_date_time': `${inputData.storeId}_${inputData.fileDate}_23:00`,
1696
1699
  'status': 'POSTPROCESS_AUDIT_SUCCESS',
1697
- 'status_time': Date.now(),
1700
+ 'status_time': Math.floor( Date.now() / 1000 ),
1698
1701
  'timestamp': new Date() };
1699
1702
 
1700
1703
 
@@ -3109,7 +3112,7 @@ export async function reTrigger( req, res ) {
3109
3112
  zoneName: inputData.zoneName,
3110
3113
  };
3111
3114
  const getQueueName = await findOneClient( { clientId: req.audit.clientId }, { 'auditConfigs': 1 } );
3112
- const queueName = inputData.moduleType == 'zone' ? getQueueName?.auditConfigs?.zoneQueueName : getQueueName?.auditConfigs?.trafficQueueName;
3115
+ const queueName = inputData.moduleType == 'zone' ? getQueueName?.auditConfigs?.zoneQueueName :inputData.moduleType == 'track'?getQueueName?.auditConfigs?.trackQueueName: getQueueName?.auditConfigs?.trafficQueueName;
3113
3116
  if ( !getQueueName || queueName == '' ) {
3114
3117
  return res.sendError( 'queueName does not create', 400 );
3115
3118
  }
@@ -173,7 +173,11 @@ export async function isAuditInputFolderExist( req, res, next ) {
173
173
  Bucket: bucket.auditInput,
174
174
  Key: `${inputData.fileDate}/${inputData.storeId}/${inputData.zoneName}`,
175
175
  };
176
- const isExist = await checkFileExist( params );
176
+ const trackParams={
177
+ Bucket: 'v4rnd-audit-input-images',
178
+ Key: `${inputData.storeId}/${inputData.fileDate}`,
179
+ };
180
+ const isExist = await checkFileExist( inputData.moduleType == 'track'? trackParams:params );
177
181
  if ( isExist ) {
178
182
  next();
179
183
  } else {