tango-app-api-analysis-traffic 3.8.0-alpha.1 → 3.8.0-alpha.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-app-api-analysis-traffic",
3
- "version": "3.8.0-alpha.1",
3
+ "version": "3.8.0-alpha.2",
4
4
  "description": "Traffic Analysis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -3069,6 +3069,50 @@ export const getStoreMapDataV3 = async ( req, res ) => {
3069
3069
  }
3070
3070
  };
3071
3071
 
3072
+ export const managerTrafficDensityExport = async ( req, res ) => {
3073
+ try {
3074
+ let reqestData = req.body;
3075
+ let getClientData = await getClientConfig( reqestData.clientId );
3076
+ if ( !getClientData ) {
3077
+ return res.sendError( 'Invalid Client Id', 400 );
3078
+ }
3079
+ reqestData.featureConfigs = getClientData.featureConfigs;
3080
+ let LamdaURL = 'https://bkmqop3brhzloib2bik3hn7xey0uadas.lambda-url.ap-south-1.on.aws/';
3081
+ let resultData = await LamdaServiceCall( LamdaURL, reqestData );
3082
+ let resultDataValue = resultData.data;
3083
+ if ( resultData ) {
3084
+ if ( resultData.status_code == '200' ) {
3085
+ if ( reqestData.export ) {
3086
+ if ( resultDataValue && resultDataValue.length > 0 ) {
3087
+ let exportdata = [];
3088
+ resultDataValue.forEach( ( element ) => {
3089
+ let row = {};
3090
+ row['Date'] = element.date || '--';
3091
+ row['Time'] = element.time ?? '--';
3092
+ row['Day'] = element.day ?? '--';
3093
+ row['Count'] = element.count || '--';
3094
+ exportdata.push( row );
3095
+ } );
3096
+
3097
+ return await download( exportdata, res );
3098
+ } else {
3099
+ return res.sendError( 'No Content', 204 );
3100
+ }
3101
+ } else {
3102
+ return res.sendSuccess( resultData );
3103
+ }
3104
+ } else {
3105
+ return res.sendError( 'No Content', 204 );
3106
+ }
3107
+ } else {
3108
+ return res.sendError( 'No Content', 204 );
3109
+ }
3110
+ } catch ( error ) {
3111
+ logger.error( { error: error, message: req.query, function: 'managerTrafficDensityExport' } );
3112
+ return res.sendError( { error: error }, 500 );
3113
+ }
3114
+ };
3115
+
3072
3116
  // async function getGeocodedAddress( lat, lng ) {
3073
3117
  // try {
3074
3118
  // const apiKey = 'AIzaSyDlOezgwQO0JviD0aizrCuN1FY9tcWfR3o'; // Use this if you're using dotenv
@@ -91,7 +91,7 @@ import {
91
91
  zoneDwellTimeSplitV3,
92
92
  funnelV3,
93
93
  getStoreMapDataV3,
94
-
94
+ managerTrafficDensityExport,
95
95
  } from '../controllers/tangoTrafficV3.controllers.js';
96
96
  analysisTrafficRouter
97
97
  .get( '/welcome', welcome )
@@ -174,5 +174,6 @@ analysisTrafficRouter
174
174
  .post( '/headerUserEmails_v2', isAllowedSessionHandler, getUserEmails )
175
175
  .post( '/headerCountry_v2', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateCountryHeaderParamsv2 ), getAssinedStore, headerCountryV2 )
176
176
  .post( '/checkTodayReportStatus', isAllowedSessionHandler, checkTodayReportStatus )
177
- .post( '/headerZoneV2', isAllowedSessionHandler, headerZoneV2 );
177
+ .post( '/headerZoneV2', isAllowedSessionHandler, headerZoneV2 )
178
+ .post( '/trafficDensityExport_v2', managerTrafficDensityExport );
178
179
  export default analysisTrafficRouter;