tango-app-api-audit 3.5.51 → 3.5.53

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.51",
3
+ "version": "3.5.53",
4
4
  "description": "audit & audit metrics apis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -399,6 +399,14 @@ export async function viewFile( req, res ) {
399
399
  const openSearch = JSON.parse( process.env.OPENSEARCH );
400
400
  const url = JSON.parse( process.env.URL );
401
401
  let isEnable =true;
402
+ const order = [
403
+ 'Distance-VA-Check',
404
+ 'Torchlight Check',
405
+ 'JCC Check',
406
+ 'Duochrome Check',
407
+ 'Near Addition Check',
408
+ 'Prescription Verification Check',
409
+ ];
402
410
 
403
411
  const getInput = await getOpenSearchById( openSearch.EyeTestInput, inputData.id );
404
412
  if ( !getInput || !getInput?.body ) {
@@ -479,9 +487,45 @@ export async function viewFile( req, res ) {
479
487
 
480
488
  switch ( getData?.auditStatus ) {
481
489
  case 'Yet-to-Audit':
490
+ response['steps'] = response?.steps?.map( ( step ) => {
491
+ if ( step.processName.toLowerCase() === 'near-va-check' ) {
492
+ return { ...step, processName: 'Near Addition Check' };
493
+ }
494
+ if ( step.processName.toLowerCase() === 'jcc' ) {
495
+ return { ...step, processName: 'JCC Check' };
496
+ }
497
+ if ( step.processName.toLowerCase() === 'duochrome-test' ) {
498
+ return { ...step, processName: 'Duochrome Check' };
499
+ }
500
+ if ( step.processName.toLowerCase() === 'torchlight' ) {
501
+ return { ...step, processName: 'Torchlight Check' };
502
+ }
503
+ if ( step.processName.toLowerCase() === 'prescription-verification' ) {
504
+ return { ...step, processName: 'Prescription Verification Check' };
505
+ }
506
+ return step;
507
+ } );
482
508
  isEnable=true;
483
509
  break;
484
510
  case 'In-Progress':
511
+ response['steps'] = response?.steps?.map( ( step ) => {
512
+ if ( step.processName.toLowerCase() === 'near-va-check' ) {
513
+ return { ...step, processName: 'Near Addition Check' };
514
+ }
515
+ if ( step.processName.toLowerCase() === 'jcc' ) {
516
+ return { ...step, processName: 'JCC Check' };
517
+ }
518
+ if ( step.processName.toLowerCase() === 'duochrome-test' ) {
519
+ return { ...step, processName: 'Duochrome Check' };
520
+ }
521
+ if ( step.processName.toLowerCase() === 'torchlight' ) {
522
+ return { ...step, processName: 'Torchlight Check' };
523
+ }
524
+ if ( step.processName.toLowerCase() === 'prescription-verification' ) {
525
+ return { ...step, processName: 'Prescription Verification Check' };
526
+ }
527
+ return step;
528
+ } );
485
529
  if ( searchData.lenght ==0 ) {
486
530
  return res.sendError( 'No saved records found', 400 );
487
531
  }
@@ -490,13 +534,49 @@ export async function viewFile( req, res ) {
490
534
  }
491
535
  break;
492
536
  case 'Audited':
493
- response['steps']= temp._source?.steps;
537
+ response['steps']= temp._source?.steps?.map( ( step ) => {
538
+ if ( step.processName.toLowerCase() === 'near-va-check' ) {
539
+ return { ...step, processName: 'Near Addition Check' };
540
+ }
541
+ if ( step.processName.toLowerCase() === 'jcc' ) {
542
+ return { ...step, processName: 'JCC Check' };
543
+ }
544
+ if ( step.processName.toLowerCase() === 'duochrome-test' ) {
545
+ return { ...step, processName: 'Duochrome Check' };
546
+ }
547
+ if ( step.processName.toLowerCase() === 'torchlight' ) {
548
+ return { ...step, processName: 'Torchlight Check' };
549
+ }
550
+ if ( step.processName.toLowerCase() === 'prescription-verification' ) {
551
+ return { ...step, processName: 'Prescription Verification Check' };
552
+ }
553
+ return step;
554
+ } );
494
555
  isEnable=true;
495
556
  case 'Re-Audited':
496
- response['steps']= temp._source?.steps;
557
+ response['steps']= temp._source?.steps.map( ( step ) => {
558
+ if ( step.processName.toLowerCase() === 'near-va-check' ) {
559
+ return { ...step, processName: 'Near Addition Check' };
560
+ }
561
+ if ( step.processName.toLowerCase() === 'jcc' ) {
562
+ return { ...step, processName: 'JCC Check' };
563
+ }
564
+ if ( step.processName.toLowerCase() === 'duochrome-test' ) {
565
+ return { ...step, processName: 'Duochrome Check' };
566
+ }
567
+ if ( step.processName.toLowerCase() === 'torchlight' ) {
568
+ return { ...step, processName: 'Torchlight Check' };
569
+ }
570
+ if ( step.processName.toLowerCase() === 'prescription-verification' ) {
571
+ return { ...step, processName: 'Prescription Verification Check' };
572
+ }
573
+ return step;
574
+ } );
497
575
  isEnable=true;
498
576
  }
499
-
577
+ response.steps.sort(
578
+ ( a, b ) => order.indexOf( a.processName ) - order.indexOf( b.processName ),
579
+ );
500
580
  return res.sendSuccess( { result: response, isEnable: isEnable } );
501
581
  } catch ( error ) {
502
582
  const err = error.message || 'Internal Server Error';
@@ -1127,7 +1207,7 @@ export async function summaryList( req, res ) {
1127
1207
  const limit = inputData.limit || 10;
1128
1208
  const offset = inputData.offset ? ( inputData.offset - 1 ) * limit : 0;
1129
1209
 
1130
- const sortBy = inputData?.sortBy ? [ 'coveredStepsAI', 'trustScore', 'date' ].includes( inputData.sortBy ) ? inputData.sortBy :`${inputData.sortBy}.keyword` : 'storeName.keyword';
1210
+ const sortBy = inputData?.sortBy ? [ 'coveredStepsAI', 'trustScore', 'date', 'ComplianceScore' ].includes( inputData.sortBy ) ? inputData.sortBy :`${inputData.sortBy}.keyword` : 'storeName.keyword';
1131
1211
  const order = inputData?.sortOrder || -1;
1132
1212
 
1133
1213
  let filter= [