tango-app-api-audit 3.5.0 → 3.5.1

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.0",
3
+ "version": "3.5.1",
4
4
  "description": "audit & audit metrics apis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -3567,36 +3567,8 @@ export async function overviewTable( req, res ) {
3567
3567
  afterCount: 1,
3568
3568
  auditType: 1,
3569
3569
  status: 1,
3570
- // userId: 1,
3571
- },
3572
- },
3573
- // {
3574
- // $lookup: {
3575
- // from: 'users',
3576
- // let: { userId: '$userId' },
3577
- // pipeline: [
3578
- // {
3579
- // $match: {
3580
- // $expr: {
3581
- // $eq: [ '$_id', '$$userId' ],
3582
- // },
3583
- // },
3584
- // },
3585
- // {
3586
- // $project: {
3587
- // userName: 1,
3588
- // userEmail: '$email',
3589
- // },
3590
- // },
3591
- // ], as: 'user',
3592
- // },
3593
- // },
3594
- // {
3595
- // $unwind: {
3596
- // path: '$user',
3597
- // preserveNullAndEmptyArrays: true,
3598
- // },
3599
- // },
3570
+ },
3571
+ },
3600
3572
  {
3601
3573
  $project: {
3602
3574
  storeId: 1,
@@ -3608,8 +3580,6 @@ export async function overviewTable( req, res ) {
3608
3580
  afterCount: 1,
3609
3581
  auditType: 1,
3610
3582
  status: 1,
3611
- // userName: '$user.userName',
3612
- // userEmail: '$user.userEmail',
3613
3583
 
3614
3584
  },
3615
3585
  },
@@ -3625,8 +3595,6 @@ export async function overviewTable( req, res ) {
3625
3595
  { status: { $regex: inputData.searchValue, $options: 'i' } },
3626
3596
  { moduleType: { $regex: inputData.searchValue, $options: 'i' } },
3627
3597
  { zoneName: { $regex: inputData.searchValue, $options: 'i' } },
3628
- // { userName: { $regex: inputData.searchValue, $options: 'i' } },
3629
- // { userEmail: { $regex: inputData.searchValue, $options: 'i' } },
3630
3598
  ],
3631
3599
 
3632
3600
  },
@@ -4748,38 +4716,42 @@ export async function auditViewLogs( req, res ) {
4748
4716
  let logsQuery;
4749
4717
  const parsedOpenSearch = JSON.parse( process.env.OPENSEARCH );
4750
4718
  const logData =[];
4751
- if ( inputData.moduleType == 'traffic' ||inputData.moduleType == 'zone' ) {
4719
+ if ( inputData.moduleType == 'traffic' ||inputData.moduleType == 'zone'||inputData.moduleType == 'track' ) {
4720
+ const filter = [
4721
+ {
4722
+ 'term': {
4723
+ 'logData.fileDate.keyword': inputData.fileDate,
4724
+ },
4725
+ },
4726
+ {
4727
+ 'term': {
4728
+ 'logData.storeId.keyword': inputData.storeId,
4729
+ },
4730
+ },
4731
+ {
4732
+ 'term': {
4733
+ 'logData.moduleType.keyword': inputData.moduleType,
4734
+ },
4735
+ },
4736
+ {
4737
+ 'terms': {
4738
+ 'logSubType.keyword': [ 'auditDone', 'reTrigger' ],
4739
+ },
4740
+ },
4741
+ ];
4742
+ if ( inputData.moduleType !== 'track' ) {
4743
+ filter.push( {
4744
+ 'term': {
4745
+ 'logData.zoneName.keyword': inputData.zoneName,
4746
+ },
4747
+ } );
4748
+ }
4749
+
4752
4750
  logsQuery = {
4753
4751
  'size': 100,
4754
4752
  'query': {
4755
4753
  'bool': {
4756
- 'must': [
4757
- {
4758
- 'term': {
4759
- 'logData.fileDate.keyword': inputData.fileDate,
4760
- },
4761
- },
4762
- {
4763
- 'term': {
4764
- 'logData.storeId.keyword': inputData.storeId,
4765
- },
4766
- },
4767
- {
4768
- 'term': {
4769
- 'logData.moduleType.keyword': inputData.moduleType,
4770
- },
4771
- },
4772
- {
4773
- 'term': {
4774
- 'logData.zoneName.keyword': inputData.zoneName,
4775
- },
4776
- },
4777
- {
4778
- 'terms': {
4779
- 'logSubType.keyword': [ 'auditDone', 'reTrigger' ],
4780
- },
4781
- },
4782
- ],
4754
+ 'must': filter,
4783
4755
  },
4784
4756
  },
4785
4757
  };