tango-app-api-analysis-zone 3.0.0-alpha.34 → 3.0.0-alpha.36

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.0.0-alpha.34",
3
+ "version": "3.0.0-alpha.36",
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.0.131",
23
+ "tango-api-schema": "^2.2.16",
24
24
  "tango-app-api-middleware": "^3.1.45",
25
25
  "winston": "^3.13.1",
26
26
  "winston-daily-rotate-file": "^5.0.0"
@@ -286,6 +286,82 @@ export const zoneSegmentationV1 = async ( req, res ) => {
286
286
  return res.sendError( { error: error }, 500 );
287
287
  }
288
288
  };
289
+ export const zoneInteractionTable430 = async ( req, res ) => {
290
+ try {
291
+ let reqestData = req.body;
292
+ let LamdaURL = 'https://xtozvnmad2773l6fmyifivlcbu0owdbo.lambda-url.ap-south-1.on.aws/';
293
+ let resultData = await LamdaServiceCall( LamdaURL, reqestData );
294
+ if ( resultData ) {
295
+ if ( resultData.status_code == '200' ) {
296
+ if ( reqestData.export ) {
297
+ if ( resultData.data.length>0 ) {
298
+ const exportdata = [];
299
+ resultData.data.forEach( ( element ) => {
300
+ exportdata.push( {
301
+ 'Passer By': element.passer_by || '--',
302
+ 'Footfall': element.footfall || '--',
303
+ 'Drop In Rate': element.drop_in_rate +'%',
304
+ 'Customer Attended ': element.customer_attended || '--',
305
+ 'Interation Rate ': element.interaction_rate +'%',
306
+ 'Billing Conversion': element.footfall_overamin_inzone || '--',
307
+ 'Billing Conversion Rate': element.billing_conversion_rate +'%',
308
+ } );
309
+ } );
310
+ return await download( exportdata, res );
311
+ } else {
312
+ return res.sendError( 'No Content', 204 );
313
+ }
314
+ }
315
+ return res.sendSuccess( resultData );
316
+ } else {
317
+ return res.sendError( 'No Content', 204 );
318
+ }
319
+ } else {
320
+ return res.sendError( 'No Content', 204 );
321
+ }
322
+ } catch ( error ) {
323
+ logger.error( { error: error, message: req.query, function: 'zoneInteractionTable430' } );
324
+ return res.sendError( { error: error }, 500 );
325
+ }
326
+ };
327
+ export const zoneInteractionTable459 = async ( req, res ) => {
328
+ try {
329
+ let reqestData = req.body;
330
+ let LamdaURL = 'https://572m77il4lzpbbatvp3jejt56i0ylnaz.lambda-url.ap-south-1.on.aws/';
331
+ let resultData = await LamdaServiceCall( LamdaURL, reqestData );
332
+ if ( resultData ) {
333
+ if ( resultData.status_code == '200' ) {
334
+ if ( reqestData.export ) {
335
+ if ( resultData.average.length>0 ) {
336
+ const exportdata = [];
337
+ resultData.average.forEach( ( element ) => {
338
+ exportdata.push( {
339
+ 'Zone Name': element.zone_name || '--',
340
+ 'Store Id': element.store_id || '--',
341
+ 'Avg Time Spent': element.avg_time_spent || '--',
342
+ 'Hour': element.hour || '--',
343
+ 'Min Time Spent': element.min_time_spent || '--',
344
+ 'Footfall': element.Footfall || '--',
345
+ 'Max Time Spent': element.max_time_spent || '--',
346
+ } );
347
+ } );
348
+ return await download( exportdata, res );
349
+ } else {
350
+ return res.sendError( 'No Content', 204 );
351
+ }
352
+ }
353
+ return res.sendSuccess( resultData );
354
+ } else {
355
+ return res.sendError( 'No Content', 204 );
356
+ }
357
+ } else {
358
+ return res.sendError( 'No Content', 204 );
359
+ }
360
+ } catch ( error ) {
361
+ logger.error( { error: error, message: req.query, function: 'zoneInteractionTable459' } );
362
+ return res.sendError( { error: error }, 500 );
363
+ }
364
+ };
289
365
 
290
366
  export async function isAllowedClient( req, res, next ) {
291
367
  try {
@@ -221,5 +221,19 @@ export const validateZoneSegmentationSchema = joi.object( {
221
221
  export const validateZoneSegmentationParams = {
222
222
  body: validateZoneSegmentationSchema,
223
223
  };
224
+ export const validateZoneInteractionTable430Schema = joi.object( {
225
+ ...baseSchema,
226
+ export: joi.boolean().optional().allow( '' ),
227
+ } );
228
+ export const validatezoneInteractionTable430Params = {
229
+ body: validateZoneInteractionTable430Schema,
230
+ };
231
+ export const validateZoneInteractionTable459Schema = joi.object( {
232
+ ...baseSchema,
233
+ export: joi.boolean().optional().allow( '' ),
234
+ } );
235
+ export const validatezoneInteractionTable459Params = {
236
+ body: validateZoneInteractionTable459Schema,
237
+ };
224
238
 
225
239
 
@@ -24,6 +24,8 @@ import {
24
24
  zoneHeatmapAvailableDatesV1,
25
25
  zoneHeatmapDatasV1,
26
26
  zoneSegmentationV1,
27
+ zoneInteractionTable430,
28
+ zoneInteractionTable459,
27
29
  isAllowedClient,
28
30
  } from '../controllers/analysisZoneV1.controllers.js';
29
31
 
@@ -75,6 +77,16 @@ analysisZoneRouter
75
77
  userType: [ 'tango', 'client' ], access: [
76
78
  { featureName: 'TangoEye', name: 'ZoneTag', permissions: [] },
77
79
  ],
78
- } ), validate( validationDtos.validateZoneSegmentationParams ), zoneSegmentationV1 );
80
+ } ), validate( validationDtos.validateZoneSegmentationParams ), zoneSegmentationV1 )
81
+ .post( '/zoneInteractionTable_430', isAllowedSessionHandler, isAllowedClient, accessVerification( {
82
+ userType: [ 'tango', 'client' ], access: [
83
+ { featureName: 'TangoEye', name: 'ZoneTag', permissions: [] },
84
+ ],
85
+ } ), validate( validationDtos.validatezoneInteractionTable430Params ), zoneInteractionTable430 )
86
+ .post( '/zoneInteractionTable_459', isAllowedSessionHandler, isAllowedClient, accessVerification( {
87
+ userType: [ 'tango', 'client' ], access: [
88
+ { featureName: 'TangoEye', name: 'ZoneTag', permissions: [] },
89
+ ],
90
+ } ), validate( validationDtos.validatezoneInteractionTable459Params ), zoneInteractionTable459 );
79
91
 
80
92
  export default analysisZoneRouter;