tango-app-api-infra 3.0.109-dev → 3.0.110-dev

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-infra",
3
- "version": "3.0.109-dev",
3
+ "version": "3.0.110-dev",
4
4
  "description": "infra",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -509,12 +509,13 @@ export async function infraIssuesTable( req, res ) {
509
509
  );
510
510
  }
511
511
  if ( req.body.sortColumName && req.body.sortColumName !== '' && req.body.sortBy ) {
512
- query.push( {
513
- $sort: { [req.body.sortColumName]: req.body.sortBy },
514
- } );
515
- storesQuery.push( {
516
- $sort: { [req.body.sortColumName]: req.body.sortBy },
517
- } );
512
+ const sortOption = { $sort: { [req.body.sortColumName]: req.body.sortBy } };
513
+ query.push( sortOption );
514
+ storesQuery.push( sortOption );
515
+ } else {
516
+ const sortOption = { $sort: { 'storeId': -1 } };
517
+ query.push( sortOption );
518
+ storesQuery.push( sortOption );
518
519
  }
519
520
  let count;
520
521
  if ( req.body.infrafilterIssue == 'Live Stores' || req.body.infrafilterIssue == 'Total Stores' ) {
@@ -1022,7 +1023,6 @@ export async function hourWiseDownstores( req, res ) {
1022
1023
  $match: {
1023
1024
  '$and': [
1024
1025
  { 'clientId': req.body.clientId },
1025
- { 'edge.firstFile': true },
1026
1026
  { 'status': 'active' },
1027
1027
  { 'createdAt': { $lte: new Date( req.body.toDate ) } },
1028
1028
  ],
@@ -457,7 +457,7 @@ export async function viewedgeAppLog( req, res ) {
457
457
  if ( !store ) {
458
458
  return res.sendError( 'Stores Not fond', 204 );
459
459
  }
460
- const inputDate = dayjs( req.body.Date ).format( 'YYYY-MM-DD' ); // Specify the date you want to add the times to
460
+ const inputDate = dayjs( req.body.Date ).format( 'DD-MM-YYYY' );
461
461
  const fromTime = req.body.from;
462
462
  const toTime = req.body.to;
463
463
  let response = {};
@@ -475,12 +475,12 @@ export async function viewedgeAppLog( req, res ) {
475
475
  },
476
476
  {
477
477
  'term': {
478
- 'store_date.keyword': dayjs( inputDate ).format( 'DD-MM-YYYY' ),
478
+ 'store_date.keyword': inputDate,
479
479
  },
480
480
  },
481
481
  {
482
482
  'term': {
483
- 'store_id.keyword': req.body.storeId,
483
+ 'storeId.keyword': req.body.storeId,
484
484
  },
485
485
  },
486
486
  {
@@ -488,8 +488,12 @@ export async function viewedgeAppLog( req, res ) {
488
488
  'log_subtype.keyword': 'AppStart_Time',
489
489
  },
490
490
  },
491
+ {
492
+ 'term': {
493
+ 'data.message.keyword': 'Login Success Event',
494
+ },
495
+ },
491
496
  ],
492
-
493
497
  },
494
498
  },
495
499
  };
@@ -509,17 +513,22 @@ export async function viewedgeAppLog( req, res ) {
509
513
  },
510
514
  {
511
515
  'term': {
512
- 'store_date.keyword': dayjs( inputDate ).format( 'DD-MM-YYYY' ),
516
+ 'store_date.keyword': inputDate,
517
+ },
518
+ },
519
+ {
520
+ 'term': {
521
+ 'storeId.keyword': req.body.storeId,
513
522
  },
514
523
  },
515
524
  {
516
525
  'term': {
517
- 'store_id.keyword': req.body.storeId,
526
+ 'log_subtype.keyword': 'App_Quit_Time',
518
527
  },
519
528
  },
520
529
  {
521
530
  'term': {
522
- 'log_subtype.keyword': 'App_Quit',
531
+ 'data.message.keyword': 'App Quit With password',
523
532
  },
524
533
  },
525
534
  ],
@@ -550,17 +559,17 @@ export async function viewedgeAppLog( req, res ) {
550
559
  },
551
560
  {
552
561
  'term': {
553
- 'store_date.keyword': dayjs( inputDate ).format( 'DD-MM-YYYY' ),
562
+ 'store_date.keyword': inputDate,
554
563
  },
555
564
  },
556
565
  {
557
566
  'term': {
558
- 'store_id.keyword': req.body.storeId,
567
+ 'storeId.keyword': req.body.storeId,
559
568
  },
560
569
  },
561
570
  {
562
571
  'term': {
563
- 'log_subtype.keyword': 'App_Crash',
572
+ 'log_subtype.keyword': 'App_Close_Event',
564
573
  },
565
574
  },
566
575
  ],
@@ -592,12 +601,12 @@ export async function viewedgeAppLog( req, res ) {
592
601
  },
593
602
  {
594
603
  'term': {
595
- 'store_date.keyword': dayjs( inputDate ).format( 'DD-MM-YYYY' ),
604
+ 'store_date.keyword': inputDate,
596
605
  },
597
606
  },
598
607
  {
599
608
  'term': {
600
- 'store_id.keyword': req.body.storeId,
609
+ 'storeId.keyword': req.body.storeId,
601
610
  },
602
611
  },
603
612
  {
@@ -618,7 +627,6 @@ export async function viewedgeAppLog( req, res ) {
618
627
  let suspendedTime;
619
628
  let resumedTime;
620
629
  const differences = [];
621
-
622
630
  for ( const sourceData of screenStatus.body.hits.hits ) {
623
631
  if ( Number( sourceData._source.data.occuringTime.split( ':' )[0] )== Number( fromTime.split( ':' )[0] ) ) {
624
632
  if ( sourceData._source.data.message.trim() === 'SYSTEM SUSPENDED' ) {
@@ -653,7 +661,7 @@ export async function viewedgeAppLog( req, res ) {
653
661
  },
654
662
  {
655
663
  'term': {
656
- 'store_date.keyword': dayjs( inputDate ).format( 'DD-MM-YYYY' ),
664
+ 'store_date.keyword': inputDate,
657
665
  },
658
666
  },
659
667
  {
@@ -705,12 +713,12 @@ export async function viewedgeAppLog( req, res ) {
705
713
  },
706
714
  {
707
715
  'term': {
708
- 'store_id.keyword': req.body.storeId,
716
+ 'storeId.keyword': req.body.storeId,
709
717
  },
710
718
  },
711
719
  {
712
720
  'term': {
713
- 'store_date.keyword': dayjs( inputDate ).format( 'DD-MM-YYYY' ),
721
+ 'store_date.keyword': inputDate,
714
722
  },
715
723
  },
716
724
  {
@@ -727,8 +735,16 @@ export async function viewedgeAppLog( req, res ) {
727
735
  ],
728
736
  },
729
737
  );
730
- response.antiVirus = antiVirus.body.hits.hits.length > 0 && antiVirus.body.hits.hits[0]._source.data.message == 'st-launch-1.0.exe is deleted' ? antiVirus.body.hits.hits[0]._source.data.occuringTime : '';
731
-
738
+ // response.antiVirus = antiVirus.body.hits.hits.length > 0 && antiVirus.body.hits.hits[0]._source.data.message == 'st-launch-1.0.exe is deleted' ? antiVirus.body.hits.hits[0]._source.data.occuringTime : '';
739
+ if ( antiVirus.body.hits.hits&&antiVirus.body.hits.hits.length > 0 ) {
740
+ for ( const sourceData of antiVirus.body.hits.hits ) {
741
+ if ( Number( sourceData._source.data.occuringTime.split( ':' )[0] )== Number( fromTime.split( ':' )[0] ) ) {
742
+ if ( sourceData._source.data.message == 'st-launch-1.0.exe is deleted' ) {
743
+ response.antiVirus = antiVirus.body.hits.hits.length > 0 ? sourceData._source.data.occuringTime : '';
744
+ }
745
+ }
746
+ }
747
+ }
732
748
 
733
749
  res.sendSuccess( response );
734
750
  } catch ( error ) {
@@ -55,24 +55,24 @@ export async function validateTicket( req, res, next ) {
55
55
  {
56
56
  'basicDetails.storeId': req.body.basicDetails.storeId,
57
57
  'issueType': 'infra',
58
- 'issueDate': new Date( req.body.Date ),
58
+ 'status': { $ne: 'closed' },
59
59
  },
60
60
  );
61
61
  if ( Ticket ) {
62
- return res.sendSuccess( 'Infra Ticket Already Exists for the day' );
62
+ return res.sendSuccess( 'Infra Ticket Already Exists' );
63
63
  }
64
64
 
65
- let refreshTicket = await findOneTangoTicket(
66
- {
67
- 'basicDetails.storeId': req.body.basicDetails.storeId,
68
- 'issueType': 'infra',
69
- 'status': { $ne: 'closed' },
70
- 'ticketDetails.ticketRefreshTime': { $lte: new Date() },
71
- },
72
- );
73
- if ( refreshTicket ) {
74
- return res.sendSuccess( 'refreshTicket Ticket Already Exists for the Store' );
75
- }
65
+ // let refreshTicket = await findOneTangoTicket(
66
+ // {
67
+ // 'basicDetails.storeId': req.body.basicDetails.storeId,
68
+ // 'issueType': 'infra',
69
+ // 'status': { $ne: 'closed' },
70
+ // 'ticketDetails.ticketRefreshTime': { $lte: new Date() },
71
+ // },
72
+ // );
73
+ // if ( refreshTicket ) {
74
+ // return res.sendSuccess( 'refreshTicket Ticket Already Exists for the Store' );
75
+ // }
76
76
  } else if ( req.body.issueType == 'installation' ) {
77
77
  let Ticket = await findOneTangoTicket(
78
78
  {