tango-app-api-analysis-zone 3.1.2 → 3.1.4
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
|
@@ -310,7 +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
|
+
'Greetings Count': element.greeting_count || '--',
|
|
314
314
|
} );
|
|
315
315
|
} );
|
|
316
316
|
return await download( exportdata, res );
|
|
@@ -477,3 +477,83 @@ export const zoneConcentrationTableExport = async ( req, res ) => {
|
|
|
477
477
|
return res.sendError( { error: error }, 500 );
|
|
478
478
|
}
|
|
479
479
|
};
|
|
480
|
+
export const zoneSegmentationV1Export = async ( req, res ) => {
|
|
481
|
+
try {
|
|
482
|
+
let reqestData = req.body;
|
|
483
|
+
let clientId = reqestData.clientId;
|
|
484
|
+
let LamdaURL = 'https://liflxqpgfq7fvhptbqbxpnhw6y0rotnl.lambda-url.ap-south-1.on.aws/';
|
|
485
|
+
let resultData = await LamdaServiceCall( LamdaURL, reqestData );
|
|
486
|
+
if ( resultData ) {
|
|
487
|
+
if ( resultData.status_code == '200' ) {
|
|
488
|
+
if ( reqestData.export ) {
|
|
489
|
+
if ( resultData.segmentationAnalysis.length>0 ) {
|
|
490
|
+
const exportdata = [];
|
|
491
|
+
resultData.segmentationAnalysis.forEach( ( element ) => {
|
|
492
|
+
const exportItem = {
|
|
493
|
+
'Date': element.date,
|
|
494
|
+
'Entrance': element.category,
|
|
495
|
+
'Entrance wise footfall': element.value,
|
|
496
|
+
};
|
|
497
|
+
if ( clientId === '463' ) {
|
|
498
|
+
exportItem['Concentration Rate'] = element?.concentrationRate ? element?.concentrationRate + '%' : '--';
|
|
499
|
+
}
|
|
500
|
+
exportdata.push( exportItem );
|
|
501
|
+
} );
|
|
502
|
+
return await download( exportdata, res );
|
|
503
|
+
} else {
|
|
504
|
+
return res.sendError( 'No Content', 204 );
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
return res.sendSuccess( resultData );
|
|
508
|
+
} else {
|
|
509
|
+
return res.sendError( 'No Content', 204 );
|
|
510
|
+
}
|
|
511
|
+
} else {
|
|
512
|
+
return res.sendError( 'No Content', 204 );
|
|
513
|
+
}
|
|
514
|
+
} catch ( error ) {
|
|
515
|
+
logger.error( { error: error, message: req.query, function: 'zoneSegmentationV1Export' } );
|
|
516
|
+
return res.sendError( { error: error }, 500 );
|
|
517
|
+
}
|
|
518
|
+
};
|
|
519
|
+
export const zoneInteractionTable430Export = async ( req, res ) => {
|
|
520
|
+
try {
|
|
521
|
+
let reqestData = req.body;
|
|
522
|
+
let LamdaURL = 'https://rb5smmthklryitf6uo6fsuslle0nlqas.lambda-url.ap-south-1.on.aws/';
|
|
523
|
+
let resultData = await LamdaServiceCall( LamdaURL, reqestData );
|
|
524
|
+
if ( resultData ) {
|
|
525
|
+
if ( resultData.status_code == '200' ) {
|
|
526
|
+
if ( reqestData.export ) {
|
|
527
|
+
if ( resultData.data.length>0 ) {
|
|
528
|
+
const exportdata = [];
|
|
529
|
+
resultData.data.forEach( ( element ) => {
|
|
530
|
+
exportdata.push( {
|
|
531
|
+
'Date': element.date || '--',
|
|
532
|
+
'Passer By': element.passer_by || '--',
|
|
533
|
+
'Footfall': element.footfall || '--',
|
|
534
|
+
'Drop In Rate': element.drop_in_rate +'%',
|
|
535
|
+
'Customer Attended ': element.customer_attended || '--',
|
|
536
|
+
'Interation Rate ': element.interaction_rate +'%',
|
|
537
|
+
'Billing Conversion': element.footfall_overamin_inzone || '--',
|
|
538
|
+
'Billing Conversion Rate': element.billing_conversion_rate +'%',
|
|
539
|
+
'Greetings Count':element.greeting_count || '--'
|
|
540
|
+
|
|
541
|
+
} );
|
|
542
|
+
} );
|
|
543
|
+
return await download( exportdata, res );
|
|
544
|
+
} else {
|
|
545
|
+
return res.sendError( 'No Content', 204 );
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
return res.sendSuccess( resultData );
|
|
549
|
+
} else {
|
|
550
|
+
return res.sendError( 'No Content', 204 );
|
|
551
|
+
}
|
|
552
|
+
} else {
|
|
553
|
+
return res.sendError( 'No Content', 204 );
|
|
554
|
+
}
|
|
555
|
+
} catch ( error ) {
|
|
556
|
+
logger.error( { error: error, message: req.query, function: 'zoneInteractionTable430Export' } );
|
|
557
|
+
return res.sendError( { error: error }, 500 );
|
|
558
|
+
}
|
|
559
|
+
};
|
|
@@ -245,5 +245,19 @@ export const validatezoneConcentrationTableExportSchema = joi.object( {
|
|
|
245
245
|
export const validatezoneConcentrationTableExportParams = {
|
|
246
246
|
body: validatezoneConcentrationTableExportSchema,
|
|
247
247
|
};
|
|
248
|
+
export const validateZoneSegmentationExportParams = {
|
|
249
|
+
body: validateZoneSegmentationExportSchema,
|
|
250
|
+
};
|
|
251
|
+
export const validateZoneSegmentationExportSchema = joi.object( {
|
|
252
|
+
...baseSchema,
|
|
253
|
+
export: joi.boolean().optional().allow( '' ),
|
|
254
|
+
} );
|
|
255
|
+
export const validatezoneInteractionTable430ExportParams = {
|
|
256
|
+
body: validatezoneInteractionTable430ExportSchema,
|
|
257
|
+
};
|
|
258
|
+
export const validatezoneInteractionTable430ExportSchema = joi.object( {
|
|
259
|
+
...baseSchema,
|
|
260
|
+
export: joi.boolean().optional().allow( '' ),
|
|
261
|
+
} );
|
|
248
262
|
|
|
249
263
|
|
|
@@ -28,6 +28,8 @@ import {
|
|
|
28
28
|
zoneInteractionTable459,
|
|
29
29
|
zoneInteractionTableExport430,
|
|
30
30
|
zoneConcentrationTableExport,
|
|
31
|
+
zoneSegmentationV1Export,
|
|
32
|
+
zoneInteractionTable430Export,
|
|
31
33
|
isAllowedClient,
|
|
32
34
|
} from '../controllers/analysisZoneV1.controllers.js';
|
|
33
35
|
|
|
@@ -99,6 +101,16 @@ analysisZoneRouter
|
|
|
99
101
|
userType: [ 'tango', 'client' ], access: [
|
|
100
102
|
{ featureName: 'TangoEye', name: 'ZoneTag', permissions: [] },
|
|
101
103
|
],
|
|
102
|
-
} ), validate( validationDtos.validatezoneConcentrationTableExportParams ), zoneConcentrationTableExport )
|
|
104
|
+
} ), validate( validationDtos.validatezoneConcentrationTableExportParams ), zoneConcentrationTableExport )
|
|
105
|
+
.post( '/zoneSegmentation_v1Export', isAllowedSessionHandler, isAllowedClient, accessVerification( {
|
|
106
|
+
userType: [ 'tango', 'client' ], access: [
|
|
107
|
+
{ featureName: 'TangoEye', name: 'ZoneTag', permissions: [] },
|
|
108
|
+
],
|
|
109
|
+
} ), validate( validationDtos.validateZoneSegmentationExportParams ), zoneSegmentationV1Export )
|
|
110
|
+
.post( '/zoneInteractionTable_430Export', isAllowedSessionHandler, isAllowedClient, accessVerification( {
|
|
111
|
+
userType: [ 'tango', 'client' ], access: [
|
|
112
|
+
{ featureName: 'TangoEye', name: 'ZoneTag', permissions: [] },
|
|
113
|
+
],
|
|
114
|
+
} ), validate( validationDtos.validatezoneInteractionTable430ExportParams ), zoneInteractionTable430Export )
|
|
103
115
|
|
|
104
116
|
export default analysisZoneRouter;
|