tango-app-api-analysis-zone 3.1.0 → 3.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-app-api-analysis-zone",
3
- "version": "3.1.0",
3
+ "version": "3.1.2",
4
4
  "description": "zone Analysis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -20,7 +20,7 @@
20
20
  "lodash": "^4.17.21",
21
21
  "mongodb": "^6.8.0",
22
22
  "nodemon": "^3.1.4",
23
- "tango-api-schema": "^2.2.16",
23
+ "tango-api-schema": "^2.2.21",
24
24
  "tango-app-api-middleware": "^3.1.45",
25
25
  "winston": "^3.13.1",
26
26
  "winston-daily-rotate-file": "^5.0.0"
@@ -310,6 +310,7 @@ export const zoneInteractionTable430 = async ( req, res ) => {
310
310
  'Interation Rate ': element.interaction_rate +'%',
311
311
  'Billing Conversion': element.footfall_overamin_inzone || '--',
312
312
  'Billing Conversion Rate': element.billing_conversion_rate +'%',
313
+ 'Greetings Count':element.greeting_count || '--'
313
314
  } );
314
315
  } );
315
316
  return await download( exportdata, res );
@@ -440,3 +441,39 @@ export const zoneInteractionTableExport430 = async ( req, res ) => {
440
441
  return res.sendError( { error: error }, 500 );
441
442
  }
442
443
  };
444
+ export const zoneConcentrationTableExport = async ( req, res ) => {
445
+ try {
446
+ let reqestData = req.body;
447
+ let LamdaURL = 'https://d6t5hy4qdautrffztmpeipslku0vforb.lambda-url.ap-south-1.on.aws/';
448
+ let resultData = await LamdaServiceCall( LamdaURL, reqestData );
449
+ if ( resultData ) {
450
+ if ( resultData.status_code == '200' ) {
451
+ if ( reqestData.export ) {
452
+ if ( resultData.zoneConcentrationData.length>0 ) {
453
+ const exportdata = [];
454
+ resultData.zoneConcentrationData.forEach( ( element ) => {
455
+ exportdata.push( {
456
+ 'Date': element.Date,
457
+ 'Zone Name': element.zoneName,
458
+ 'Footfall(Actuals)': element.footfallCount || '--',
459
+ 'DwellTime(Average)': element.avgDwellTime || '--',
460
+ 'Concentration': element.concentrationRate +'%',
461
+ } );
462
+ } );
463
+ return await download( exportdata, res );
464
+ } else {
465
+ return res.sendError( 'No Content', 204 );
466
+ }
467
+ }
468
+ return res.sendSuccess( resultData );
469
+ } else {
470
+ return res.sendError( 'No Content', 204 );
471
+ }
472
+ } else {
473
+ return res.sendError( 'No Content', 204 );
474
+ }
475
+ } catch ( error ) {
476
+ logger.error( { error: error, message: req.query, function: 'zoneConcentrationTableExport' } );
477
+ return res.sendError( { error: error }, 500 );
478
+ }
479
+ };
@@ -235,5 +235,15 @@ export const validateZoneInteractionTable459Schema = joi.object( {
235
235
  export const validatezoneInteractionTable459Params = {
236
236
  body: validateZoneInteractionTable459Schema,
237
237
  };
238
+ export const validatezoneConcentrationTableExportSchema = joi.object( {
239
+ ...baseSchema,
240
+ search: joi.string().optional().allow( '' ),
241
+ sortBy: joi.number().optional().allow( '' ),
242
+ sort: joi.string().optional().allow( '' ),
243
+ export: joi.boolean().required(),
244
+ } );
245
+ export const validatezoneConcentrationTableExportParams = {
246
+ body: validatezoneConcentrationTableExportSchema,
247
+ };
238
248
 
239
249
 
@@ -27,6 +27,7 @@ import {
27
27
  zoneInteractionTable430,
28
28
  zoneInteractionTable459,
29
29
  zoneInteractionTableExport430,
30
+ zoneConcentrationTableExport,
30
31
  isAllowedClient,
31
32
  } from '../controllers/analysisZoneV1.controllers.js';
32
33
 
@@ -93,6 +94,11 @@ analysisZoneRouter
93
94
  userType: [ 'tango', 'client' ], access: [
94
95
  { featureName: 'TangoEye', name: 'ZoneTag', permissions: [] },
95
96
  ],
96
- } ), validate( validationDtos.validatezoneInteractionTable430Params ), zoneInteractionTableExport430 );
97
+ } ), validate( validationDtos.validatezoneInteractionTable430Params ), zoneInteractionTableExport430 )
98
+ .post( '/zoneConcentrationTableExport', isAllowedSessionHandler, isAllowedClient, accessVerification( {
99
+ userType: [ 'tango', 'client' ], access: [
100
+ { featureName: 'TangoEye', name: 'ZoneTag', permissions: [] },
101
+ ],
102
+ } ), validate( validationDtos.validatezoneConcentrationTableExportParams ), zoneConcentrationTableExport );
97
103
 
98
104
  export default analysisZoneRouter;