tango-app-api-audit 3.4.68-beta.12 → 3.4.68-beta.13

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/.eslintrc.cjs CHANGED
@@ -36,7 +36,7 @@ module.exports = {
36
36
  'no-unused-vars': 'error',
37
37
  'new-cap': [ 'error', { 'newIsCap': true, 'capIsNew': false } ],
38
38
  'prefer-const': 'off',
39
- 'no-console': 'error',
39
+ // 'no-console': 'error',
40
40
  },
41
41
  };
42
42
 
package/README.md CHANGED
@@ -1,29 +1,29 @@
1
- # README #
2
-
3
- This README would normally document whatever steps are necessary to get your application up and running.
4
-
5
- ### What is this repository for? ###
6
-
7
- * Quick summary
8
- * Version
9
- * [Learn Markdown](https://bitbucket.org/tutorials/markdowndemo)
10
-
11
- ### How do I get set up? ###
12
-
13
- * Summary of set up
14
- * Configuration
15
- * Dependencies
16
- * Database configuration
17
- * How to run tests
18
- * Deployment instructions
19
-
20
- ### Contribution guidelines ###
21
-
22
- * Writing tests
23
- * Code review
24
- * Other guidelines
25
-
26
- ### Who do I talk to? ###
27
-
28
- * Repo owner or admin
1
+ # README #
2
+
3
+ This README would normally document whatever steps are necessary to get your application up and running.
4
+
5
+ ### What is this repository for? ###
6
+
7
+ * Quick summary
8
+ * Version
9
+ * [Learn Markdown](https://bitbucket.org/tutorials/markdowndemo)
10
+
11
+ ### How do I get set up? ###
12
+
13
+ * Summary of set up
14
+ * Configuration
15
+ * Dependencies
16
+ * Database configuration
17
+ * How to run tests
18
+ * Deployment instructions
19
+
20
+ ### Contribution guidelines ###
21
+
22
+ * Writing tests
23
+ * Code review
24
+ * Other guidelines
25
+
26
+ ### Who do I talk to? ###
27
+
28
+ * Repo owner or admin
29
29
  * Other community or team contact
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-app-api-audit",
3
- "version": "3.4.68-beta.12",
3
+ "version": "3.4.68-beta.13",
4
4
  "description": "audit & audit metrics apis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -597,7 +597,20 @@ export async function cancel( req, res ) {
597
597
  try {
598
598
  const inputData = req.body;
599
599
  const openSearch = JSON.parse( process.env.OPENSEARCH );
600
+ let searchFilterhistory=[
601
+ {
602
+ 'term': {
603
+ 'queueId.keyword': inputData?.fileId,
604
+ },
605
+
606
+ },
607
+ {
608
+ 'term': {
609
+ 'type.keyword': inputData?.type,
610
+ },
600
611
 
612
+ },
613
+ ];
601
614
  let searchFilter =[
602
615
  {
603
616
  'term': {
@@ -643,6 +656,20 @@ export async function cancel( req, res ) {
643
656
  },
644
657
  },
645
658
  ];
659
+ searchFilterhistory=[
660
+ {
661
+ 'term': {
662
+ 'engagementId.keyword': inputData?.fileId,
663
+ },
664
+
665
+ },
666
+ {
667
+ 'term': {
668
+ 'type.keyword': inputData?.type,
669
+ },
670
+
671
+ },
672
+ ];
646
673
  }
647
674
 
648
675
  let searchQuery={
@@ -653,21 +680,34 @@ export async function cancel( req, res ) {
653
680
  },
654
681
  },
655
682
  };
683
+ let searchQueryHistory={
684
+ 'size': 100,
685
+ 'query': {
686
+ 'bool': {
687
+ 'must': searchFilterhistory,
688
+ },
689
+ },
690
+ };
656
691
  const getOutput = await getOpenSearchData( openSearch.EyeTestOutput, searchQuery );
692
+ const getOutputHistory = await getOpenSearchData( openSearch.EyeTestOutput, searchQueryHistory );
657
693
  logger.info( { getOutput: getOutput } );
658
694
  const output = getOutput?.body?.hits?.hits?.length > 0 ? getOutput?.body?.hits?.hits[0] : null;
695
+ let checkReaudited = getOutput?.body?.hits?.hits?.length > 0 ? getOutputHistory?.body?.hits?.hits.filter( ( data ) => data._source.auditType==='Re-Audit'&&data._source.auditStatus==='Re-Audited' ).length:0;
696
+ let checkaudited = getOutput?.body?.hits?.hits?.length > 0 ? getOutputHistory?.body?.hits?.hits.filter( ( data ) => data._source.auditType==='Audit'&&data._source.auditStatus==='Audited' ).length:0;
697
+
659
698
  if ( !output ) {
660
699
  return res.sendError( 'No saved records found', 400 );
661
700
  }
662
701
  const record1 ={
663
702
 
664
- auditStatus: 'Skipped',
703
+ auditStatus: checkReaudited>0?'Re-Audited':checkaudited>0?'Audited':'Yet-to-Audit',
704
+ auditType: checkReaudited>0?'Re-Audit':'Audit',
665
705
  endTime: dayjs().tz( 'Asia/Kolkata' ),
666
706
 
667
707
  };
668
708
  const record2 ={
669
-
670
- auditStatus: 'Yet-to-Audit',
709
+ auditStatus: checkReaudited>0?'Re-Audited':checkaudited>0?'Audited':'Yet-to-Audit',
710
+ auditType: checkReaudited>0?'Re-Audit':'Audit',
671
711
  endTime: dayjs().tz( 'Asia/Kolkata' ),
672
712
 
673
713
  };