tango-app-api-analysis-zone 3.1.0 → 3.1.1

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.1",
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"
@@ -440,3 +440,39 @@ export const zoneInteractionTableExport430 = async ( req, res ) => {
440
440
  return res.sendError( { error: error }, 500 );
441
441
  }
442
442
  };
443
+ export const zoneConcentrationTableExport = async ( req, res ) => {
444
+ try {
445
+ let reqestData = req.body;
446
+ let LamdaURL = 'https://d6t5hy4qdautrffztmpeipslku0vforb.lambda-url.ap-south-1.on.aws/';
447
+ let resultData = await LamdaServiceCall( LamdaURL, reqestData );
448
+ if ( resultData ) {
449
+ if ( resultData.status_code == '200' ) {
450
+ if ( reqestData.export ) {
451
+ if ( resultData.zoneConcentrationData.length>0 ) {
452
+ const exportdata = [];
453
+ resultData.zoneConcentrationData.forEach( ( element ) => {
454
+ exportdata.push( {
455
+ 'Date': element.Date,
456
+ 'Zone Name': element.zoneName,
457
+ 'Footfall(Actuals)': element.footfallCount || '--',
458
+ 'DwellTime(Average)': element.avgDwellTime || '--',
459
+ 'Concentration': element.concentrationRate +'%',
460
+ } );
461
+ } );
462
+ return await download( exportdata, res );
463
+ } else {
464
+ return res.sendError( 'No Content', 204 );
465
+ }
466
+ }
467
+ return res.sendSuccess( resultData );
468
+ } else {
469
+ return res.sendError( 'No Content', 204 );
470
+ }
471
+ } else {
472
+ return res.sendError( 'No Content', 204 );
473
+ }
474
+ } catch ( error ) {
475
+ logger.error( { error: error, message: req.query, function: 'zoneConcentrationTableExport' } );
476
+ return res.sendError( { error: error }, 500 );
477
+ }
478
+ };
@@ -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;