tango-app-api-audit 3.4.68-beta.17 → 3.4.68-beta.19

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.19",
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;
@@ -517,7 +526,11 @@ export async function save( req, res ) {
517
526
  },
518
527
 
519
528
  },
520
-
529
+ {
530
+ 'term': {
531
+ 'userId.keyword': req?.user?._id,
532
+ },
533
+ },
521
534
  {
522
535
  'term': {
523
536
  'auditStatus.keyword': 'In-Progress',
@@ -566,23 +579,24 @@ export async function save( req, res ) {
566
579
  return res.sendError( 'This file is currently being audited by another user. Any actions you perform will not be saved.', 400 );
567
580
  }
568
581
  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
-
582
+ 'steps': inputData?.steps,
583
+ 'auditStatus': inputData?.auditStatus,
584
+ 'auditedSteps': inputData?.auditedSteps,
585
+ 'overRides': inputData?.overRides,
586
+ 'trustScore': Math.round( 100-( ( inputData?.overRides / inputData?.steps?.length ) * 100 ) ),
587
+ 'spokenLanguage': inputData?.spokenLanguage,
588
+ 'endTime': dayjs().tz( 'Asia/Kolkata' ),
589
+ 'updatedAt': dayjs().tz( 'Asia/Kolkata' ),
577
590
  };
578
591
  const inputrecord ={
579
592
 
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' ),
593
+ 'auditStatus': inputData?.auditStatus,
594
+ 'auditedSteps': inputData?.auditedSteps,
595
+ 'overRides': inputData?.overRides,
596
+ 'trustScore': Math.round( 100-( ( inputData?.overRides / inputData?.steps?.length ) * 100 ) ),
597
+ 'spokenLanguage': inputData?.spokenLanguage,
598
+ 'endTime': dayjs().tz( 'Asia/Kolkata' ),
599
+ 'updatedAt': dayjs().tz( 'Asia/Kolkata' ),
586
600
 
587
601
  };
588
602
  await updateOpenSearchData( openSearch.EyeTestOutput, output?._id, { doc: record } );
@@ -626,7 +640,11 @@ export async function cancel( req, res ) {
626
640
  },
627
641
 
628
642
  },
629
-
643
+ {
644
+ 'term': {
645
+ 'userId.keyword': req?.user?._id,
646
+ },
647
+ },
630
648
  {
631
649
  'term': {
632
650
  'auditStatus.keyword': 'In-Progress',
@@ -747,6 +765,9 @@ export async function getFileHistory( req, res ) {
747
765
  ],
748
766
  },
749
767
  },
768
+ 'sort': [
769
+ { updatedAt: { order: 'desc' } },
770
+ ],
750
771
  };
751
772
  } else {
752
773
  Query = {
@@ -767,6 +788,9 @@ export async function getFileHistory( req, res ) {
767
788
  ],
768
789
  },
769
790
  },
791
+ 'sort': [
792
+ { updatedAt: { order: 'desc' } },
793
+ ],
770
794
  };
771
795
  };
772
796