tango-app-api-audit 3.5.39 → 3.5.41

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.39",
3
+ "version": "3.5.41",
4
4
  "description": "audit & audit metrics apis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1178,6 +1178,26 @@ export async function summaryList( req, res ) {
1178
1178
  return res.sendError( 'No data found', 204 );
1179
1179
  }
1180
1180
 
1181
+ if ( inputData?.category ) {
1182
+ switch ( inputData?.category ) {
1183
+ case 'fake':
1184
+ filter.push( {
1185
+ term: {
1186
+ 'comment.keyword': 'Possible Fake Video',
1187
+ },
1188
+ } );
1189
+ break;
1190
+ case 'genuine':
1191
+ filter.push( {
1192
+ term: {
1193
+ 'comment.keyword': '',
1194
+ },
1195
+ } );
1196
+ break;
1197
+ default: return res.sendError( 'Give valid Category', 400 );
1198
+ }
1199
+ }
1200
+
1181
1201
 
1182
1202
  if ( inputData.keyType === 'rm' || inputData.keyType === 'cluster' ) {
1183
1203
  let sort ={
@@ -1359,22 +1379,16 @@ export async function summaryList( req, res ) {
1359
1379
  const temp =[];
1360
1380
  for ( const [ i, cluster ] of getCluster.entries() ) {
1361
1381
  temp.push( cluster );
1382
+
1362
1383
  const getClusterQuery= {
1363
1384
  'size': 0,
1364
1385
  'query': {
1365
1386
  'bool': {
1366
1387
  'must': [
1367
- { 'terms': { 'storeId.keyword': cluster?.store } },
1368
- { 'term': { 'type.keyword': inputData?.type } },
1388
+ ...filter,
1369
1389
  {
1370
- 'range': {
1371
- 'date': {
1372
- 'gte': inputData?.fromDate,
1373
- 'lte': inputData?.toDate,
1374
- },
1375
- },
1390
+ 'terms': { 'storeId.keyword': cluster?.store },
1376
1391
  },
1377
-
1378
1392
  ],
1379
1393
  },
1380
1394
  },
@@ -1405,7 +1419,7 @@ export async function summaryList( req, res ) {
1405
1419
  temp[i].totalFiles = getResponse?.body?.aggregations?.total_count?.value || 0,
1406
1420
  temp[i].completedFiles=getResponse?.body?.aggregations?.audited_trustScore?.totalCount?.value || 0;
1407
1421
  temp[i].complianceScore = `${ Math.round( getResponse?.body?.aggregations?.avg_complianceScore?.value || 0 )} %`;
1408
- temp[i].trustScore =`${getResponse?.body?.aggregations?.audited_trustScore?.totalCount?.value + ' %' || 'NA'}`;
1422
+ temp[i].trustScore = getResponse?.body?.aggregations?.audited_trustScore?.avg_trustScore?.value ==null || getResponse?.body?.aggregations?.audited_trustScore?.avg_trustScore?.value == undefined ?'NA':`${getResponse?.body?.aggregations?.audited_trustScore?.avg_trustScore?.value + ' %'}`;
1409
1423
  }
1410
1424
  }
1411
1425
 
@@ -1706,6 +1720,7 @@ export async function summaryList( req, res ) {
1706
1720
  temp[i].RMEmail =RMEmail;
1707
1721
  const trustScore = temp[i].trustScore;
1708
1722
  temp[i].trustScore = ( trustScore == null || trustScore == undefined ) ? 'NA' :`${trustScore + ' %'}`;
1723
+ temp[i]._id = item?._id;
1709
1724
  }
1710
1725
  }
1711
1726
 
@@ -2065,7 +2080,7 @@ export async function emailAlertLog( req, res ) {
2065
2080
 
2066
2081
 
2067
2082
  logger.info( { inputData: inputData, getData: response } );
2068
- return res.sendSuccess( { result: response } );
2083
+ return res.sendSuccess( { result: response, count: response.length } );
2069
2084
  } catch ( error ) {
2070
2085
  const err = error.message || 'Internal Server Error';
2071
2086
  logger.error( { message: error, data: req.body, function: 'eyetestAudit-controller-emailAlertLog' } );