tango-app-api-audit 3.4.68-beta.16 → 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 +1 -1
- package/README.md +28 -28
- package/package.json +3 -3
- package/src/controllers/eyeTestAudit.controllers.js +42 -26
- package/app.js +0 -47
package/.eslintrc.cjs
CHANGED
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,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tango-app-api-audit",
|
|
3
|
-
"version": "3.4.68-beta.
|
|
3
|
+
"version": "3.4.68-beta.18",
|
|
4
4
|
"description": "audit & audit metrics apis",
|
|
5
|
-
"main": "
|
|
5
|
+
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"start": "nodemon --exec \"eslint --fix . && node
|
|
8
|
+
"start": "nodemon --exec \"eslint --fix . && node index.js\""
|
|
9
9
|
},
|
|
10
10
|
"engines": {
|
|
11
11
|
"node": ">=18.10.0"
|
|
@@ -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
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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.
|
|
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
|
|
package/app.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import express from 'express';
|
|
2
|
-
import dotenv from 'dotenv';
|
|
3
|
-
import { logger } from 'tango-app-api-middleware';
|
|
4
|
-
import { connectdb } from './config/database/database.js';
|
|
5
|
-
import responseMiddleware from './config/response/response.js';
|
|
6
|
-
import errorMiddleware from './config/response/error.js';
|
|
7
|
-
import pkg from 'body-parser';
|
|
8
|
-
import { swaggerConfig } from './config/swagger/swagger.js';
|
|
9
|
-
import swagger from 'swagger-ui-express';
|
|
10
|
-
import traxAuditRouter from './src/routes/traxAudit.routes.js';
|
|
11
|
-
import auditWalletRouter from './src/routes/auditWallet.routes.js';
|
|
12
|
-
import auditRouter from './src/routes/audit.routes.js';
|
|
13
|
-
import cors from 'cors';
|
|
14
|
-
import eyeTestAuditRouter from './src/routes/eyeTestAudit.routes.js';
|
|
15
|
-
|
|
16
|
-
const { json, urlencoded } = pkg;
|
|
17
|
-
const env=dotenv.config();
|
|
18
|
-
|
|
19
|
-
const app = express();
|
|
20
|
-
const PORT = process.env.PORT || 3000;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
app.use( json( { limit: '500mb' } ) );
|
|
24
|
-
app.use(
|
|
25
|
-
urlencoded( {
|
|
26
|
-
extended: true,
|
|
27
|
-
} ),
|
|
28
|
-
);
|
|
29
|
-
app.use( cors() );
|
|
30
|
-
app.use( responseMiddleware );
|
|
31
|
-
app.use( errorMiddleware );
|
|
32
|
-
|
|
33
|
-
if ( env.error ) {
|
|
34
|
-
logger.error( '.env not found' );
|
|
35
|
-
process.exit( 1 );
|
|
36
|
-
}
|
|
37
|
-
app.use( '/api-docs', swagger.serve, swagger.setup( swaggerConfig ) );
|
|
38
|
-
|
|
39
|
-
app.use( '/v3/audit', auditRouter );
|
|
40
|
-
app.use( '/v3/trax-audit', traxAuditRouter );
|
|
41
|
-
app.use( '/v3/audit-wallet', auditWalletRouter );
|
|
42
|
-
app.use( '/v3/eye-test-audit', eyeTestAuditRouter );
|
|
43
|
-
|
|
44
|
-
app.listen( PORT, () => {
|
|
45
|
-
logger.info( `server is running on port= ${PORT} ` );
|
|
46
|
-
connectdb();
|
|
47
|
-
} );
|