tango-app-api-audit 3.4.3-alpha.17 → 3.4.3-alpha.18

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.3-alpha.17",
3
+ "version": "3.4.3-alpha.18",
4
4
  "description": "audit & audit metrics apis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -356,6 +356,7 @@ export async function getAuditFile( req, res ) {
356
356
  auditId: userDetails[0]._id,
357
357
  moduleType: userDetails[0].moduleType,
358
358
  zoneName: userDetails[0].zoneName,
359
+ beforeCount: userDetails[0].beforeCount,
359
360
  },
360
361
  createdAt: new Date(),
361
362
  };
@@ -458,6 +459,7 @@ export async function getAuditFile( req, res ) {
458
459
  auditId: reauditInsert._id,
459
460
  zoneName: msg.zone_id,
460
461
  moduleType: inputData.moduleType,
462
+ beforeCount: msg.total_count,
461
463
  },
462
464
  createdAt: new Date(),
463
465
  };
@@ -610,6 +612,7 @@ export async function getAuditFile( req, res ) {
610
612
  auditId: insertData._id,
611
613
  zoneName: msg.zone_id,
612
614
  moduleType: inputData.moduleType,
615
+ beforeCount: msg.total_count,
613
616
  },
614
617
  createdAt: new Date(),
615
618
  };
@@ -4452,8 +4455,12 @@ export async function auditViewLogs( req, res ) {
4452
4455
  'logData.moduleType.keyword': inputData.moduleType,
4453
4456
  },
4454
4457
  },
4458
+ {
4459
+ 'term': {
4460
+ 'logSubType.keyword': { $in: [ 'auditDone', 'reAuditPush', 'reTrigger' ] },
4461
+ },
4462
+ },
4455
4463
  ],
4456
-
4457
4464
  },
4458
4465
  },
4459
4466
  };
@@ -4462,7 +4469,7 @@ export async function auditViewLogs( req, res ) {
4462
4469
  logData.push( logs.body.hits.hits[0]._source );
4463
4470
  return res.sendSuccess( logData );
4464
4471
  } else {
4465
- return res.sendError( 'No Record Inserted', 500 );
4472
+ return res.sendError( 'No Record Inserted', 204 );
4466
4473
  }
4467
4474
  } catch ( error ) {
4468
4475
  const err = error.message || 'Internal Server Error';
@@ -2201,10 +2201,10 @@ export async function storeMetrics( req, res ) {
2201
2201
  question: 1,
2202
2202
  questionType: 1,
2203
2203
  answer: 1,
2204
- // userId: {
2205
- // $arrayElemAt: [ '$userId', { $subtract: [ { $size: '$userId' }, 1 ] } ], //need to check if no data
2206
- // },
2207
- userId: 1,
2204
+ userId: {
2205
+ $arrayElemAt: [ '$userId', { $subtract: [ { $size: '$userId' }, 1 ] } ], // need to check if no data
2206
+ },
2207
+ // userId: 1,
2208
2208
  auditType: 1,
2209
2209
  beforeCount: 1,
2210
2210
  afterCount: { $ifNull: [ '$afterCount', null ] },