tango-app-api-audit 3.4.66 → 3.4.67
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/README.md +28 -28
- package/app.js +40 -0
- package/package.json +3 -3
- package/src/controllers/traxAudit.controllers.js +20 -0
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/app.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import { auditRouter } from './index.js';
|
|
3
|
+
import dotenv from 'dotenv';
|
|
4
|
+
import { logger } from 'tango-app-api-middleware';
|
|
5
|
+
import { connectdb } from './config/database/database.js';
|
|
6
|
+
import responseMiddleware from './config/response/response.js';
|
|
7
|
+
import errorMiddleware from './config/response/error.js';
|
|
8
|
+
import pkg from 'body-parser';
|
|
9
|
+
import { swaggerConfig } from './config/swagger/swagger.js';
|
|
10
|
+
import swagger from 'swagger-ui-express';
|
|
11
|
+
import { traxAuditRouter } from './src/routes/traxAudit.routes.js';
|
|
12
|
+
import cors from 'cors';
|
|
13
|
+
const { json, urlencoded } = pkg;
|
|
14
|
+
const env=dotenv.config();
|
|
15
|
+
|
|
16
|
+
const app = express();
|
|
17
|
+
const PORT = process.env.PORT || 3000;
|
|
18
|
+
app.use( cors() );
|
|
19
|
+
|
|
20
|
+
app.use( json( { limit: '500mb' } ) );
|
|
21
|
+
app.use(
|
|
22
|
+
urlencoded( {
|
|
23
|
+
extended: true,
|
|
24
|
+
} ),
|
|
25
|
+
);
|
|
26
|
+
app.use( responseMiddleware );
|
|
27
|
+
app.use( errorMiddleware );
|
|
28
|
+
if ( env.error ) {
|
|
29
|
+
logger.error( '.env not found' );
|
|
30
|
+
process.exit( 1 );
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
app.use( '/api-docs', swagger.serve, swagger.setup( swaggerConfig ) );
|
|
34
|
+
app.use( '/v3/audit', auditRouter );
|
|
35
|
+
app.use( '/trax-audit', traxAuditRouter );
|
|
36
|
+
|
|
37
|
+
app.listen( PORT, async () => {
|
|
38
|
+
connectdb();
|
|
39
|
+
logger.info( `server is running on port= ${PORT} ` );
|
|
40
|
+
} );
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tango-app-api-audit",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.67",
|
|
4
4
|
"description": "audit & audit metrics apis",
|
|
5
|
-
"main": "
|
|
5
|
+
"main": "app.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"start": "nodemon --exec \"eslint --fix . && node
|
|
8
|
+
"start": "nodemon --exec \"eslint --fix . && node app.js\""
|
|
9
9
|
},
|
|
10
10
|
"engines": {
|
|
11
11
|
"node": ">=18.10.0"
|
|
@@ -1739,6 +1739,26 @@ export async function saveBinary( req, res ) {
|
|
|
1739
1739
|
} else {
|
|
1740
1740
|
await insertOpenSearchData( openSearch.traxDetectionOutput, anomalyOutput );
|
|
1741
1741
|
}
|
|
1742
|
+
if ( inputData.answer==='approved' ) {
|
|
1743
|
+
let usersList=JSON.parse( process.env.SES );
|
|
1744
|
+
let emails =usersList.suspeciousEmails.split( ',' );
|
|
1745
|
+
|
|
1746
|
+
for ( let user of emails ) {
|
|
1747
|
+
let notificationData= {
|
|
1748
|
+
'title': 'Suspecious Activity Detected',
|
|
1749
|
+
'description': `${getData?.sqs?.Body?.zone_name} at ${getStore2?.storeName}- Immediate action required`,
|
|
1750
|
+
'storeId': inputData.storeId,
|
|
1751
|
+
'type': 'suspiciousactivity',
|
|
1752
|
+
'date': inputData.fileDate,
|
|
1753
|
+
'clientId': req.userAudit?.clientId,
|
|
1754
|
+
'email': user,
|
|
1755
|
+
};
|
|
1756
|
+
await axios.post( `${url.apiDomain}/v3/trax/internalAPI/sendAiPushNotification`, notificationData, { headers: {
|
|
1757
|
+
'Content-Type': 'application/json',
|
|
1758
|
+
'Authorization': 'Bearer d47433f8-9a33-47c7-ba43-1a0fbac28f55' },
|
|
1759
|
+
} );
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1742
1762
|
|
|
1743
1763
|
const logData4 = {
|
|
1744
1764
|
userId: req.user._id,
|