tango-app-api-audit 3.4.68-beta.17 → 3.4.68-beta.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/.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.17",
3
+ "version": "3.4.68-beta.18",
4
4
  "description": "audit & audit metrics apis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -19,7 +19,7 @@ export async function getList( req, res ) {
19
19
  const limit = inputData.limit || 10;
20
20
  const offset = inputData.offset ? ( inputData.offset - 1 ) * limit : 0;
21
21
 
22
- const sortBy = inputData?.sortBy ? inputData.sortBy === 'coveredStepsAI' ? inputData.sortBy :`${inputData.sortBy}.keyword` : 'storeName.keyword';
22
+ const sortBy = inputData?.sortBy ? inputData.sortBy === 'coveredStepsAI'||inputData.sortBy==='updatedAt' ? inputData.sortBy :`${inputData.sortBy}.keyword` : 'storeName.keyword';
23
23
  const order = inputData?.sortOrder || -1;
24
24
  let filter= [
25
25
  {
@@ -34,13 +34,13 @@ export async function getList( req, res ) {
34
34
  ];
35
35
 
36
36
 
37
- // if ( inputData.demographics && inputData.demographics.length > 0 ) {
38
- // filter.push( {
39
- // 'terms': {
40
- // 'visitorsType.keyword': inputData.demographics,
41
- // },
42
- // } );
43
- // }
37
+ if ( inputData.demographics && inputData.demographics.length > 0 ) {
38
+ filter.push( {
39
+ 'terms': {
40
+ 'visitorsType.keyword': inputData.demographics,
41
+ },
42
+ } );
43
+ }
44
44
  if ( inputData.type && inputData.type!='' ) {
45
45
  filter.push( {
46
46
  'term': {
@@ -97,7 +97,7 @@ export async function getList( req, res ) {
97
97
  {
98
98
  'wildcard': {
99
99
  'optumId.keyword': {
100
- 'value': `*${inputData.engagementId}*`,
100
+ 'value': `*${inputData.searchValue}*`,
101
101
  },
102
102
  },
103
103
  },
@@ -260,7 +260,11 @@ export async function viewFile( req, res ) {
260
260
  'term': {
261
261
  'type.keyword': getData?.type,
262
262
  },
263
-
263
+ },
264
+ {
265
+ 'terms': {
266
+ 'auditStatus.keyword': [ 'Audited', 'Re-Audited' ],
267
+ },
264
268
  },
265
269
  ];
266
270
  if ( getData?.type == 'remote' ) {
@@ -275,7 +279,11 @@ export async function viewFile( req, res ) {
275
279
  'term': {
276
280
  'type.keyword': getData?.type,
277
281
  },
278
-
282
+ },
283
+ {
284
+ 'terms': {
285
+ 'auditStatus.keyword': [ 'Audited', 'Re-Audited' ],
286
+ },
279
287
  },
280
288
  ];
281
289
  }
@@ -293,6 +301,7 @@ export async function viewFile( req, res ) {
293
301
  };
294
302
 
295
303
  const searchRes= await getOpenSearchData( openSearch.EyeTestOutput, searchQuery );
304
+
296
305
  const temp = searchRes?.body?.hits?.hits?.length > 0? searchRes?.body?.hits?.hits[0] : [];
297
306
 
298
307
  const getUserName = await findOneUser( { _id: new mongoose.Types.ObjectId( temp?._source?.userId ) }, { userName: 1 } );
@@ -437,7 +446,7 @@ export async function getFile( req, res ) {
437
446
  if ( !searchData ) {
438
447
  const data1 = await insertOpenSearchData( openSearch.EyeTestOutput, record );
439
448
  logger.info( { data1: data1 } );
440
- await updateOpenSearchData( openSearch.EyeTestInput, inputData.id, { doc: { auditStatus: 'In-Progress', auditType: 'Audit', userId: req?.user?._id } } );
449
+ await updateOpenSearchData( openSearch.EyeTestInput, inputData.id, { doc: { 'auditStatus': 'In-Progress', 'auditType': 'Audit', 'userId': req?.user?._id, 'updatedAt': dayjs().tz( 'Asia/Kolkata' ) } } );
441
450
  }
442
451
 
443
452
  break;
@@ -566,23 +575,24 @@ export async function save( req, res ) {
566
575
  return res.sendError( 'This file is currently being audited by another user. Any actions you perform will not be saved.', 400 );
567
576
  }
568
577
  const record ={
569
- steps: inputData?.steps,
570
- auditStatus: inputData?.auditStatus,
571
- auditedSteps: inputData?.auditedSteps,
572
- overRides: inputData?.overRides,
573
- trustScore: Math.round( 100-( ( inputData?.overRides / inputData?.steps?.length ) * 100 ) ),
574
- spokenLanguage: inputData?.spokenLanguage,
575
- endTime: dayjs().tz( 'Asia/Kolkata' ),
576
-
578
+ 'steps': inputData?.steps,
579
+ 'auditStatus': inputData?.auditStatus,
580
+ 'auditedSteps': inputData?.auditedSteps,
581
+ 'overRides': inputData?.overRides,
582
+ 'trustScore': Math.round( 100-( ( inputData?.overRides / inputData?.steps?.length ) * 100 ) ),
583
+ 'spokenLanguage': inputData?.spokenLanguage,
584
+ 'endTime': dayjs().tz( 'Asia/Kolkata' ),
585
+ 'updatedAt': dayjs().tz( 'Asia/Kolkata' ),
577
586
  };
578
587
  const inputrecord ={
579
588
 
580
- auditStatus: inputData?.auditStatus,
581
- auditedSteps: inputData?.auditedSteps,
582
- overRides: inputData?.overRides,
583
- trustScore: Math.round( 100-( ( inputData?.overRides / inputData?.steps?.length ) * 100 ) ),
584
- spokenLanguage: inputData?.spokenLanguage,
585
- endTime: dayjs().tz( 'Asia/Kolkata' ),
589
+ 'auditStatus': inputData?.auditStatus,
590
+ 'auditedSteps': inputData?.auditedSteps,
591
+ 'overRides': inputData?.overRides,
592
+ 'trustScore': Math.round( 100-( ( inputData?.overRides / inputData?.steps?.length ) * 100 ) ),
593
+ 'spokenLanguage': inputData?.spokenLanguage,
594
+ 'endTime': dayjs().tz( 'Asia/Kolkata' ),
595
+ 'updatedAt': dayjs().tz( 'Asia/Kolkata' ),
586
596
 
587
597
  };
588
598
  await updateOpenSearchData( openSearch.EyeTestOutput, output?._id, { doc: record } );
@@ -747,6 +757,9 @@ export async function getFileHistory( req, res ) {
747
757
  ],
748
758
  },
749
759
  },
760
+ 'sort': [
761
+ { updatedAt: { order: 'desc' } },
762
+ ],
750
763
  };
751
764
  } else {
752
765
  Query = {
@@ -767,6 +780,9 @@ export async function getFileHistory( req, res ) {
767
780
  ],
768
781
  },
769
782
  },
783
+ 'sort': [
784
+ { updatedAt: { order: 'desc' } },
785
+ ],
770
786
  };
771
787
  };
772
788