tango-app-api-audit 3.4.62 → 3.4.63

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 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.62",
3
+ "version": "3.4.63",
4
4
  "description": "audit & audit metrics apis",
5
- "main": "index.js",
5
+ "main": "app.js",
6
6
  "type": "module",
7
7
  "scripts": {
8
- "start": "nodemon --exec \"eslint --fix . && node index.js\""
8
+ "start": "nodemon --exec \"eslint --fix . && node app.js\""
9
9
  },
10
10
  "engines": {
11
11
  "node": ">=18.10.0"
@@ -507,7 +507,6 @@ export async function getAuditFile( req, res ) {
507
507
  const userDetails = await aggregateBinaryAudit( userQuery );
508
508
  logger.info( { userDetails: userDetails, function: 'userDetails' } );
509
509
  const auditStatus = userDetails && userDetails.length > 0 ? userDetails[0].auditStatus : null;
510
-
511
510
  switch ( auditStatus ) {
512
511
  case null:
513
512
 
@@ -523,6 +522,7 @@ export async function getAuditFile( req, res ) {
523
522
  }
524
523
  msg = JSON.parse( consumer );
525
524
 
525
+
526
526
  break;
527
527
 
528
528
  case 'inprogress':
@@ -580,6 +580,7 @@ export async function getAuditFile( req, res ) {
580
580
  default:
581
581
  return res.sendError( 'Please give valid moduleType', 400 );
582
582
  }
583
+
583
584
  const traxInfo = await findOneTraxAuditData( query );
584
585
  if ( !traxInfo ) {
585
586
  return res.sendError( 'The source record not found', 400 );
@@ -714,17 +715,17 @@ export async function getAuditFile( req, res ) {
714
715
  } );
715
716
  break;
716
717
  case 'anomaly-audit':
717
- for ( let i =0; i< msg.fileDetails.length; i++ ) {
718
- const files = [];
719
- const data = msg.fileDetails[i].folderPath;
720
- files.push(
721
- data,
722
- );
723
- result.push( {
724
- type: msg.fileDetails[i].type,
725
- file: files,
726
- } );
727
- }
718
+ const BucketCDN = url.traxAuditInput;
719
+ const data = `${BucketCDN}${ msg.path}`;
720
+ let files = [];
721
+ files.push(
722
+ data,
723
+ );
724
+ result.push( {
725
+ type: 'video',
726
+ file: files,
727
+ } );
728
+
728
729
  break;
729
730
  default:
730
731
  return res.sendError( 'Please given valid moduleType', 400 );
@@ -1716,10 +1717,18 @@ export async function saveBinary( req, res ) {
1716
1717
  Answer: inputData.answer,
1717
1718
  configTime: getData?.sqs?.Body?.configTime,
1718
1719
  inputBucketName: getData?.sqs?.Body?.inputBucketName,
1719
- incidentType: getData?.sqs?.Body?.incidentType,
1720
- incidentId: getData?.sqs?.Body?.incidentId,
1721
- incidentTime: getData?.sqs?.Body?.incidentTime,
1722
- thumnailImage: getData?.sqs?.Body?.thumnailImage,
1720
+ entry_time: getData?.sqs?.Body?.entry_time,
1721
+ exit_time: getData?.sqs?.Body?.exit_time,
1722
+ address: getData?.sqs?.Body?.address,
1723
+ country: getData?.sqs?.Body?.country,
1724
+ state: getData?.sqs?.Body?.state,
1725
+ city: getData?.sqs?.Body?.city,
1726
+ pincode: getData?.sqs?.Body?.pincode,
1727
+ date_timestamp: getData?.sqs?.Body?.date_timestamp,
1728
+ timestamp: getData?.sqs?.Body?.timestamp,
1729
+ time_spend: getData?.sqs?.Body?.time_spend,
1730
+ temp_id: getData?.sqs?.Body?.temp_id,
1731
+ zone_name: getData?.sqs?.Body?.zone_name,
1723
1732
  folderPath: getData?.sqs?.Body?.fileDetails[0]?.outputFilePath,
1724
1733
  createdAt: new Date(),
1725
1734
  };