tango-app-api-analysis-zone 3.0.0-alpha.1 → 3.0.0-alpha.10

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/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
 
3
- import { analyseZoneRouter } from './src/routes/analyseZone.js';
3
+ import { analysisZoneRouter } from './src/routes/analysisZone.js';
4
4
 
5
- export { analyseZoneRouter };
5
+ export { analysisZoneRouter };
6
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-app-api-analysis-zone",
3
- "version": "3.0.0-alpha.1",
3
+ "version": "3.0.0-alpha.10",
4
4
  "description": "zone Analysis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -55,7 +55,7 @@ export const cardsAgeAnalysis = async ( req, res ) => {
55
55
  'count': 100,
56
56
  'rate': 89.5,
57
57
  },
58
- 'conversion': {
58
+ 'concentration': {
59
59
  'count': 100,
60
60
  'rate': 89.5,
61
61
  },
@@ -147,11 +147,11 @@ export const topPerformingStores = async ( req, res ) => {
147
147
  }
148
148
  let result = {
149
149
  'topPerformingStores': [
150
- { 'storeName': 'LKST11-300', 'zoneName': 'zone-0', 'conversionRate': 40.4, 'avgDwellTime': 39.9, 'overallFootfall': 400, 'zoneFootfall': 90 },
151
- { 'storeName': 'LKST11-301', 'zoneName': 'zone-1', 'conversionRate': 40.4, 'avgDwellTime': 39.9, 'overallFootfall': 400, 'zoneFootfall': 90 },
152
- { 'storeName': 'LKST11-302', 'zoneName': 'zone-2', 'conversionRate': 40.4, 'avgDwellTime': 39.9, 'overallFootfall': 400, 'zoneFootfall': 90 },
153
- { 'storeName': 'LKST11-303', 'zoneName': 'zone-3', 'conversionRate': 40.4, 'avgDwellTime': 39.9, 'overallFootfall': 400, 'zoneFootfall': 90 },
154
- { 'storeName': 'LKST11-304', 'zoneName': 'zone-4', 'conversionRate': 40.4, 'avgDwellTime': 39.9, 'overallFootfall': 400, 'zoneFootfall': 90 },
150
+ { 'storeName': 'LKST11-300', 'zoneName': 'zone-0', 'concentrationRate': 40.4, 'avgDwellTime': 39.9, 'overallFootfall': 400, 'zoneFootfall': 90 },
151
+ { 'storeName': 'LKST11-301', 'zoneName': 'zone-1', 'concentrationRate': 40.4, 'avgDwellTime': 39.9, 'overallFootfall': 400, 'zoneFootfall': 90 },
152
+ { 'storeName': 'LKST11-302', 'zoneName': 'zone-2', 'concentrationRate': 40.4, 'avgDwellTime': 39.9, 'overallFootfall': 400, 'zoneFootfall': 90 },
153
+ { 'storeName': 'LKST11-303', 'zoneName': 'zone-3', 'concentrationRate': 40.4, 'avgDwellTime': 39.9, 'overallFootfall': 400, 'zoneFootfall': 90 },
154
+ { 'storeName': 'LKST11-304', 'zoneName': 'zone-4', 'concentrationRate': 40.4, 'avgDwellTime': 39.9, 'overallFootfall': 400, 'zoneFootfall': 90 },
155
155
  ],
156
156
  };
157
157
  return res.sendSuccess( result );
@@ -192,7 +192,7 @@ export const zoneSummaryTable = async ( req, res ) => {
192
192
  'engagersCount': 60,
193
193
  'missedOpportunityCount': 70,
194
194
  'potentialBuyersCount': 80,
195
- 'conversionRate': 70.5,
195
+ 'concentrationRate': 70.5,
196
196
  'avgDwellTime': 50,
197
197
  'avgInfraDowntime': 70,
198
198
  'bellow12': 30,
@@ -214,7 +214,7 @@ export const zoneSummaryTable = async ( req, res ) => {
214
214
  'engagersCount': 60,
215
215
  'missedOpportunityCount': 70,
216
216
  'potentialBuyersCount': 80,
217
- 'conversionRate': 70.5,
217
+ 'concentrationRate': 70.5,
218
218
  'avgDwellTime': 50,
219
219
  'avgInfraDowntime': 70,
220
220
  'bellow12': 30,
@@ -236,7 +236,7 @@ export const zoneSummaryTable = async ( req, res ) => {
236
236
  'engagersCount': 60,
237
237
  'missedOpportunityCount': 70,
238
238
  'potentialBuyersCount': 80,
239
- 'conversionRate': 70.5,
239
+ 'concentrationRate': 70.5,
240
240
  'avgDwellTime': 50,
241
241
  'avgInfraDowntime': 70,
242
242
  'bellow12': 30,
@@ -258,7 +258,7 @@ export const zoneSummaryTable = async ( req, res ) => {
258
258
  'engagersCount': 60,
259
259
  'missedOpportunityCount': 70,
260
260
  'potentialBuyersCount': 80,
261
- 'conversionRate': 70.5,
261
+ 'concentrationRate': 70.5,
262
262
  'avgDwellTime': 50,
263
263
  'avgInfraDowntime': 70,
264
264
  'bellow12': 30,
@@ -280,7 +280,7 @@ export const zoneSummaryTable = async ( req, res ) => {
280
280
  'engagersCount': 60,
281
281
  'missedOpportunityCount': 70,
282
282
  'potentialBuyersCount': 80,
283
- 'conversionRate': 70.5,
283
+ 'concentrationRate': 70.5,
284
284
  'avgDwellTime': 50,
285
285
  'avgInfraDowntime': 70,
286
286
  'bellow12': 30,
@@ -302,7 +302,7 @@ export const zoneSummaryTable = async ( req, res ) => {
302
302
  'engagersCount': 60,
303
303
  'missedOpportunityCount': 70,
304
304
  'potentialBuyersCount': 80,
305
- 'conversionRate': 70.5,
305
+ 'concentrationRate': 70.5,
306
306
  'avgDwellTime': 50,
307
307
  'avgInfraDowntime': 70,
308
308
  'bellow12': 30,
@@ -324,7 +324,7 @@ export const zoneSummaryTable = async ( req, res ) => {
324
324
  'engagersCount': 60,
325
325
  'missedOpportunityCount': 70,
326
326
  'potentialBuyersCount': 80,
327
- 'conversionRate': 70.5,
327
+ 'concentrationRate': 70.5,
328
328
  'avgDwellTime': 50,
329
329
  'avgInfraDowntime': 70,
330
330
  'bellow12': 30,
@@ -346,7 +346,7 @@ export const zoneSummaryTable = async ( req, res ) => {
346
346
  'engagersCount': 60,
347
347
  'missedOpportunityCount': 70,
348
348
  'potentialBuyersCount': 80,
349
- 'conversionRate': 70.5,
349
+ 'concentrationRate': 70.5,
350
350
  'avgDwellTime': 50,
351
351
  'avgInfraDowntime': 70,
352
352
  'bellow12': 30,
@@ -368,7 +368,7 @@ export const zoneSummaryTable = async ( req, res ) => {
368
368
  'engagersCount': 60,
369
369
  'missedOpportunityCount': 70,
370
370
  'potentialBuyersCount': 80,
371
- 'conversionRate': 70.5,
371
+ 'concentrationRate': 70.5,
372
372
  'avgDwellTime': 50,
373
373
  'avgInfraDowntime': 70,
374
374
  'bellow12': 30,
@@ -390,7 +390,7 @@ export const zoneSummaryTable = async ( req, res ) => {
390
390
  'engagersCount': 60,
391
391
  'missedOpportunityCount': 70,
392
392
  'potentialBuyersCount': 80,
393
- 'conversionRate': 70.5,
393
+ 'concentrationRate': 70.5,
394
394
  'avgDwellTime': 50,
395
395
  'avgInfraDowntime': 70,
396
396
  'bellow12': 30,
@@ -412,7 +412,7 @@ export const zoneSummaryTable = async ( req, res ) => {
412
412
  'engagersCount': 60,
413
413
  'missedOpportunityCount': 70,
414
414
  'potentialBuyersCount': 80,
415
- 'conversionRate': 70.5,
415
+ 'concentrationRate': 70.5,
416
416
  'avgDwellTime': 50,
417
417
  'avgInfraDowntime': 70,
418
418
  'bellow12': 30,
@@ -457,31 +457,31 @@ export const zoneConcentrationSummaryTable = async ( req, res ) => {
457
457
  'zoneName': 'zone-1',
458
458
  'footfallCount': 400,
459
459
  'avgDwellTime': 50,
460
- 'conversionRate': 70.5,
460
+ 'concentrationRate': 70.5,
461
461
  },
462
462
  {
463
463
  'zoneName': 'zone-2',
464
464
  'footfallCount': 400,
465
465
  'avgDwellTime': 50,
466
- 'conversionRate': 70.5,
466
+ 'concentrationRate': 70.5,
467
467
  },
468
468
  {
469
469
  'zoneName': 'zone-3',
470
470
  'footfallCount': 400,
471
471
  'avgDwellTime': 50,
472
- 'conversionRate': 70.5,
472
+ 'concentrationRate': 70.5,
473
473
  },
474
474
  {
475
475
  'zoneName': 'zone-4',
476
476
  'footfallCount': 400,
477
477
  'avgDwellTime': 50,
478
- 'conversionRate': 70.5,
478
+ 'concentrationRate': 70.5,
479
479
  },
480
480
  {
481
481
  'zoneName': 'zone-5',
482
482
  'footfallCount': 400,
483
483
  'avgDwellTime': 50,
484
- 'conversionRate': 70.5,
484
+ 'concentrationRate': 70.5,
485
485
  },
486
486
  ],
487
487
  };
@@ -544,14 +544,22 @@ export const zoneHeatmapDatas = async ( req, res ) => {
544
544
 
545
545
  let result = {
546
546
  'overallStoreConcentrationDatas': {
547
- 'ImageURL\'s': [
547
+ 'ImageURLs': [
548
548
  {
549
- 'streamName': 'ABC',
550
- 'URL': 'DEFGHI',
549
+ 'streamName': 'cam1',
550
+ 'URL': 'https://devtangoretail-api.tangoeye.ai/heatmapimg1.jpeg',
551
551
  },
552
552
  {
553
- 'streamName': 'ABC-1',
554
- 'URL': 'DEFGHI-1',
553
+ 'streamName': 'cam2',
554
+ 'URL': 'https://devtangoretail-api.tangoeye.ai/heatmapimg2.jpeg',
555
+ },
556
+ {
557
+ 'streamName': 'cam3',
558
+ 'URL': 'https://devtangoretail-api.tangoeye.ai/heatmapimg3.jpeg',
559
+ },
560
+ {
561
+ 'streamName': 'cam4',
562
+ 'URL': 'https://devtangoretail-api.tangoeye.ai/heatmapimg4.jpeg',
555
563
  },
556
564
  ],
557
565
  'totalFootfall': 560,
@@ -0,0 +1,256 @@
1
+ import { logger, download } from 'tango-app-api-middleware';
2
+
3
+ // Lamda Service Call //
4
+ async function LamdaServiceCall( url, data ) {
5
+ try {
6
+ const requestOptions = {
7
+ method: 'POST',
8
+ headers: {
9
+ 'Content-Type': 'application/json',
10
+ },
11
+ body: JSON.stringify( data ),
12
+ };
13
+ const response = await fetch( url, requestOptions );
14
+ if ( !response.ok ) {
15
+ throw new Error( `Response status: ${response.status}` );
16
+ return false;
17
+ }
18
+ const json = await response.json();
19
+ return json;
20
+ } catch ( error ) {
21
+ console.log( 'error =>', error );
22
+ logger.error( { error: error, message: data, function: 'LamdaServiceCall' } );
23
+ }
24
+ }
25
+
26
+ // ///// V1 API's ///////
27
+ export const cardsAgeAnalysisV1 = async ( req, res ) => {
28
+ try {
29
+ let reqestData = req.body;
30
+ let LamdaURL = 'https://oybi27bocyk4zysjdcni7ueaxe0gzunc.lambda-url.ap-south-1.on.aws/';
31
+ let resultData = await LamdaServiceCall( LamdaURL, reqestData );
32
+ if ( resultData ) {
33
+ if ( resultData.status_code == '200' ) {
34
+ return res.sendSuccess( resultData );
35
+ } else {
36
+ return res.sendError( 'No Content', 204 );
37
+ }
38
+ } else {
39
+ return res.sendError( 'No Content', 204 );
40
+ }
41
+ } catch ( error ) {
42
+ logger.error( { error: error, message: req.query, function: 'cardsFunnelV1' } );
43
+ return res.sendError( { error: error }, 500 );
44
+ }
45
+ };
46
+
47
+ export const topPerformingZonesV1 = async ( req, res ) => {
48
+ try {
49
+ let reqestData = req.body;
50
+ let LamdaURL = 'https://qcv73azgbnc4f33fbbi4yjosp40aaevs.lambda-url.ap-south-1.on.aws/';
51
+ let resultData = await LamdaServiceCall( LamdaURL, reqestData );
52
+ if ( resultData ) {
53
+ if ( resultData.status_code == '200' ) {
54
+ return res.sendSuccess( resultData );
55
+ } else {
56
+ return res.sendError( 'No Content', 204 );
57
+ }
58
+ } else {
59
+ return res.sendError( 'No Content', 204 );
60
+ }
61
+ } catch ( error ) {
62
+ logger.error( { error: error, message: req.query, function: 'topPerformingZonesV1' } );
63
+ return res.sendError( { error: error }, 500 );
64
+ }
65
+ };
66
+
67
+ export const topPerformingStoresV1 = async ( req, res ) => {
68
+ try {
69
+ let reqestData = req.body;
70
+ let LamdaURL = 'https://judkzgsc2tipbvwhgs7h7rxmfq0bedpy.lambda-url.ap-south-1.on.aws/';
71
+ let resultData = await LamdaServiceCall( LamdaURL, reqestData );
72
+ if ( resultData ) {
73
+ if ( resultData.status_code == '200' ) {
74
+ if ( reqestData.export ) {
75
+ if ( resultData.topPerformingStores.length>0 ) {
76
+ const exportdata = [];
77
+ resultData.topPerformingStores.forEach( ( element ) => {
78
+ exportdata.push( {
79
+ 'Store Name': element.storeName,
80
+ 'Zone Name': element.zoneName,
81
+ 'Concentration': element.concentrationRate,
82
+ 'AVG DwellTime': element.avgDwellTime,
83
+ 'Overall Footfall': element.overallFootfall,
84
+ 'Zone Footfall': element.zoneFootfall,
85
+ } );
86
+ } );
87
+ return await download( exportdata, res );
88
+ } else {
89
+ return res.sendError( 'No Content', 204 );
90
+ }
91
+ } else {
92
+ return res.sendSuccess( resultData );
93
+ }
94
+ } else {
95
+ return res.sendError( 'No Content', 204 );
96
+ }
97
+ } else {
98
+ return res.sendError( 'No Content', 204 );
99
+ }
100
+ } catch ( error ) {
101
+ logger.error( { error: error, message: req.query, function: 'topPerformingStoresV1' } );
102
+ return res.sendError( { error: error }, 500 );
103
+ }
104
+ };
105
+
106
+ export const zoneSummaryTableV1 = async ( req, res ) => {
107
+ try {
108
+ let reqestData = req.body;
109
+ if ( reqestData.export ) {
110
+ reqestData.limit = 1000;
111
+ }
112
+ let LamdaURL = 'https://hxpnn5weq3lm4nqouk4pjm3chy0jmqdb.lambda-url.ap-south-1.on.aws/';
113
+ let resultData = await LamdaServiceCall( LamdaURL, reqestData );
114
+ if ( resultData ) {
115
+ if ( resultData.status_code == '200' ) {
116
+ if ( reqestData.export ) {
117
+ if ( resultData.zoneSummaryData.length>0 ) {
118
+ const exportdata = [];
119
+ resultData.zoneSummaryData.forEach( ( element ) => {
120
+ exportdata.push( {
121
+ 'Date': element.date,
122
+ 'Zone Name': element.zoneName,
123
+ 'Store Name': element.storeName,
124
+ 'StoreId': element.storeId,
125
+ 'Zone Conc.Rate': element.concentrationRate,
126
+ 'AVG.Dwell Time': element.avgDwellTime,
127
+ 'Zone FF': element.footfallCount,
128
+ 'Zone Bounced': element.bouncedCount,
129
+ 'Zone Engagers': element.engagersCount,
130
+ 'Age Below 12': element.below12,
131
+ 'Age 13-19': element['13-19'],
132
+ 'Age 20-30': element['20-30'],
133
+ 'Age 31-40': element['31-40'],
134
+ 'Age 41-50': element['41-50'],
135
+ 'Age 51-60': element['51-60'],
136
+ 'Age 60+': element['60 above'],
137
+ 'Male': element.male,
138
+ 'Female': element.female,
139
+ } );
140
+ } );
141
+ return await download( exportdata, res );
142
+ } else {
143
+ return res.sendError( 'No Content', 204 );
144
+ }
145
+ } else {
146
+ return res.sendSuccess( resultData );
147
+ }
148
+ } else {
149
+ return res.sendError( 'No Content', 204 );
150
+ }
151
+ } else {
152
+ return res.sendError( 'No Content', 204 );
153
+ }
154
+ } catch ( error ) {
155
+ logger.error( { error: error, message: req.query, function: 'zoneSummaryTableV1' } );
156
+ return res.sendError( { error: error }, 500 );
157
+ }
158
+ };
159
+
160
+ export const zoneConcentrationSummaryTableV1 = async ( req, res ) => {
161
+ try {
162
+ let reqestData = req.body;
163
+ let LamdaURL = 'https://ebinpkkji5wghr6rwm7jojwstu0idgiu.lambda-url.ap-south-1.on.aws/';
164
+ let resultData = await LamdaServiceCall( LamdaURL, reqestData );
165
+ if ( resultData ) {
166
+ if ( resultData.status_code == '200' ) {
167
+ return res.sendSuccess( resultData );
168
+ } else {
169
+ return res.sendError( 'No Content', 204 );
170
+ }
171
+ } else {
172
+ return res.sendError( 'No Content', 204 );
173
+ }
174
+ } catch ( error ) {
175
+ logger.error( { error: error, message: req.query, function: 'cardsFunnelV1' } );
176
+ return res.sendError( { error: error }, 500 );
177
+ }
178
+ };
179
+
180
+ export const zoneHeatmapAvailableDatesV1 = async ( req, res ) => {
181
+ try {
182
+ let reqestData = req.body;
183
+ let LamdaURL = 'https://tgtkai5zzq7fhp7ymtsnm3a2lm0czulr.lambda-url.ap-south-1.on.aws/';
184
+ let resultData = await LamdaServiceCall( LamdaURL, reqestData );
185
+ if ( resultData ) {
186
+ if ( resultData.status_code == '200' ) {
187
+ return res.sendSuccess( resultData );
188
+ } else {
189
+ return res.sendError( 'No Content', 204 );
190
+ }
191
+ } else {
192
+ return res.sendError( 'No Content', 204 );
193
+ }
194
+ } catch ( error ) {
195
+ logger.error( { error: error, message: req.query, function: 'cardsFunnelV1' } );
196
+ return res.sendError( { error: error }, 500 );
197
+ }
198
+ };
199
+
200
+ export const zoneHeatmapDatasV1 = async ( req, res ) => {
201
+ try {
202
+ let reqestData = req.body;
203
+ let LamdaURL = 'https://3m24ba6cibsqlc5ngkgtfyk42u0oinhr.lambda-url.ap-south-1.on.aws/';
204
+ let resultData = await LamdaServiceCall( LamdaURL, reqestData );
205
+ if ( resultData ) {
206
+ if ( resultData.status_code == '200' ) {
207
+ return res.sendSuccess( resultData );
208
+ } else {
209
+ return res.sendError( 'No Content', 204 );
210
+ }
211
+ } else {
212
+ return res.sendError( 'No Content', 204 );
213
+ }
214
+ } catch ( error ) {
215
+ logger.error( { error: error, message: req.query, function: 'cardsFunnelV1' } );
216
+ return res.sendError( { error: error }, 500 );
217
+ }
218
+ };
219
+
220
+ export async function isAllowedClient( req, res, next ) {
221
+ try {
222
+ let reqestData = req.body;
223
+ let getUserEmail = req.user.email;
224
+ let getUserType = req.user.userType;
225
+ let getClientId = req.user.clientId;
226
+ let getRole = req.user.role;
227
+ if ( getUserType == 'tango' ) {
228
+ if ( getRole == 'superadmin' ) {
229
+ next();
230
+ } else {
231
+ const assignedQuery = {
232
+ userEmail: getUserEmail,
233
+ assignedType: 'client',
234
+ assignedValue: reqestData.clientId,
235
+ };
236
+ const getAssignedType = await findOneUserAssignedStore( assignedQuery );
237
+ if ( getAssignedType ) {
238
+ next();
239
+ } else {
240
+ return res.sendError( 'Client Not Assigned', 400 );
241
+ }
242
+ }
243
+ } else if ( getUserType == 'client' ) {
244
+ if ( getClientId == reqestData.clientId ) {
245
+ next();
246
+ } else {
247
+ return res.sendError( 'Client Not Assigned', 400 );
248
+ }
249
+ } else {
250
+ return res.sendError( 'Client Not Assigned', 400 );
251
+ }
252
+ } catch ( error ) {
253
+ logger.error( { error: error, function: 'isAllowedClient' } );
254
+ return res.sendError( error, 500 );
255
+ }
256
+ }
@@ -0,0 +1,83 @@
1
+ import joi from 'joi';
2
+
3
+ // Base schema
4
+ const baseSchema = {
5
+ clientId: joi.string().required(),
6
+ storeId: joi.array().required().empty(),
7
+ fromDate: joi.string().required(),
8
+ toDate: joi.string().required(),
9
+ };
10
+
11
+ // Schema for Card Funnel
12
+ export const validateCardsAgeAnalysisSchema = joi.object( {
13
+ ...baseSchema,
14
+ } );
15
+
16
+ export const validateCardsAgeAnalysisParams = {
17
+ body: validateCardsAgeAnalysisSchema,
18
+ };
19
+
20
+ // Schema for Card Graph (extends baseSchema with additional fields)
21
+ export const validateTopPerformingZonesSchema = joi.object( {
22
+ ...baseSchema,
23
+ } );
24
+
25
+ export const validateTopPerformingZonesParams = {
26
+ body: validateTopPerformingZonesSchema,
27
+ };
28
+
29
+ export const validateTopPerformingStoresSchema = joi.object( {
30
+ ...baseSchema,
31
+ search: joi.string().optional().allow( '' ),
32
+ export: joi.boolean().required(),
33
+ } );
34
+
35
+ export const validateTopPerformingStoresParams = {
36
+ body: validateTopPerformingStoresSchema,
37
+ };
38
+
39
+ export const validateZoneSummaryTableSchema = joi.object( {
40
+ ...baseSchema,
41
+ search: joi.string().optional().allow( '' ),
42
+ sortBy: joi.number().optional().allow( '' ),
43
+ sort: joi.string().optional().allow( '' ),
44
+ limit: joi.number().required(),
45
+ offset: joi.number().required(),
46
+ export: joi.boolean().required(),
47
+ } );
48
+
49
+ export const validateZoneSummaryTableParams = {
50
+ body: validateZoneSummaryTableSchema,
51
+ };
52
+
53
+ export const validateZoneConcentrationSummaryTableSchema = joi.object( {
54
+ ...baseSchema,
55
+ search: joi.string().optional().allow( '' ),
56
+ sortBy: joi.number().optional().allow( '' ),
57
+ sort: joi.string().optional().allow( '' ),
58
+ } );
59
+
60
+ export const validateZoneConcentrationSummaryTableParams = {
61
+ body: validateZoneConcentrationSummaryTableSchema,
62
+ };
63
+
64
+ export const validateZoneHeatmapAvailableDatesSchema = joi.object( {
65
+ ...baseSchema,
66
+ zoneName: joi.string().required(),
67
+ dateType: joi.string().required(),
68
+ } );
69
+
70
+ export const validateZoneHeatmapAvailableDatesParams = {
71
+ body: validateZoneHeatmapAvailableDatesSchema,
72
+ };
73
+
74
+ export const validateZoneHeatmapDatasSchema = joi.object( {
75
+ ...baseSchema,
76
+ zoneName: joi.string().required(),
77
+ dateType: joi.string().required(),
78
+ zoneDate: joi.string().required(),
79
+ } );
80
+
81
+ export const validateZoneHeatmapDatasParams = {
82
+ body: validateZoneHeatmapDatasSchema,
83
+ };
@@ -0,0 +1,74 @@
1
+ import express from 'express';
2
+ import { validate, isAllowedSessionHandler, authorize } from 'tango-app-api-middleware';
3
+ import * as validationDtos from '../dtos/validation.dtos.js';
4
+
5
+ export const analysisZoneRouter = express.Router();
6
+
7
+ import {
8
+ welcome,
9
+ cardsAgeAnalysis,
10
+ topPerformingZones,
11
+ topPerformingStores,
12
+ zoneSummaryTable,
13
+ zoneConcentrationSummaryTable,
14
+ zoneHeatmapAvailableDates,
15
+ zoneHeatmapDatas,
16
+ } from '../controllers/analysisZone.controllers.js';
17
+
18
+ import {
19
+ cardsAgeAnalysisV1,
20
+ topPerformingZonesV1,
21
+ topPerformingStoresV1,
22
+ zoneSummaryTableV1,
23
+ zoneConcentrationSummaryTableV1,
24
+ zoneHeatmapAvailableDatesV1,
25
+ zoneHeatmapDatasV1,
26
+ isAllowedClient,
27
+ } from '../controllers/analysisZoneV1.controllers.js';
28
+
29
+ analysisZoneRouter
30
+ .get( '/welcome', welcome )
31
+ .post( '/cardsAgeAnalysis', cardsAgeAnalysis )
32
+ .post( '/topPerformingZones', topPerformingZones )
33
+ .post( '/topPerformingStores', topPerformingStores )
34
+ .post( '/zoneSummaryTable', zoneSummaryTable )
35
+ .post( '/zoneConcentrationSummaryTable', zoneConcentrationSummaryTable )
36
+ .post( '/zoneHeatmapAvailableDates', zoneHeatmapAvailableDates )
37
+ .post( '/zoneHeatmapDatas', zoneHeatmapDatas )
38
+ .post( '/cardsAgeAnalysis_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
39
+ userType: [ 'tango', 'client' ], access: [
40
+ { featureName: 'analytics', name: 'tangoZone', permissions: [ 'isView' ] },
41
+ ],
42
+ } ), validate( validationDtos.validateCardsAgeAnalysisParams ), cardsAgeAnalysisV1 )
43
+ .post( '/topPerformingZones_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
44
+ userType: [ 'tango', 'client' ], access: [
45
+ { featureName: 'analytics', name: 'tangoZone', permissions: [ 'isView' ] },
46
+ ],
47
+ } ), validate( validationDtos.validateTopPerformingZonesParams ), topPerformingZonesV1 )
48
+ .post( '/topPerformingStores_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
49
+ userType: [ 'tango', 'client' ], access: [
50
+ { featureName: 'analytics', name: 'tangoZone', permissions: [ 'isView' ] },
51
+ ],
52
+ } ), validate( validationDtos.validateTopPerformingStoresParams ), topPerformingStoresV1 )
53
+ .post( '/zoneSummaryTable_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
54
+ userType: [ 'tango', 'client' ], access: [
55
+ { featureName: 'analytics', name: 'tangoZone', permissions: [ 'isView' ] },
56
+ ],
57
+ } ), validate( validationDtos.validateZoneSummaryTableParams ), zoneSummaryTableV1 )
58
+ .post( '/zoneConcentrationSummaryTable_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
59
+ userType: [ 'tango', 'client' ], access: [
60
+ { featureName: 'analytics', name: 'tangoZone', permissions: [ 'isView' ] },
61
+ ],
62
+ } ), validate( validationDtos.validateZoneConcentrationSummaryTableParams ), zoneConcentrationSummaryTableV1 )
63
+ .post( '/zoneHeatmapAvailableDates_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
64
+ userType: [ 'tango', 'client' ], access: [
65
+ { featureName: 'analytics', name: 'tangoZone', permissions: [ 'isView' ] },
66
+ ],
67
+ } ), validate( validationDtos.validateZoneHeatmapAvailableDatesParams ), zoneHeatmapAvailableDatesV1 )
68
+ .post( '/zoneHeatmapDatas_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
69
+ userType: [ 'tango', 'client' ], access: [
70
+ { featureName: 'analytics', name: 'tangoZone', permissions: [ 'isView' ] },
71
+ ],
72
+ } ), validate( validationDtos.validateZoneHeatmapDatasParams ), zoneHeatmapDatasV1 );
73
+
74
+ export default analysisZoneRouter;
@@ -1,26 +0,0 @@
1
- import express from 'express';
2
-
3
- export const analyseZoneRouter = express.Router();
4
-
5
- import {
6
- welcome,
7
- cardsAgeAnalysis,
8
- topPerformingZones,
9
- topPerformingStores,
10
- zoneSummaryTable,
11
- zoneConcentrationSummaryTable,
12
- zoneHeatmapAvailableDates,
13
- zoneHeatmapDatas,
14
- } from '../controllers/analyseZone.controllers.js';
15
-
16
- analyseZoneRouter
17
- .get( '/welcome', welcome )
18
- .post( '/cardsAgeAnalysis', cardsAgeAnalysis )
19
- .post( '/topPerformingZones', topPerformingZones )
20
- .post( '/topPerformingStores', topPerformingStores )
21
- .post( '/zoneSummaryTable', zoneSummaryTable )
22
- .post( '/zoneConcentrationSummaryTable', zoneConcentrationSummaryTable )
23
- .post( '/zoneHeatmapAvailableDates', zoneHeatmapAvailableDates )
24
- .post( '/zoneHeatmapDatas', zoneHeatmapDatas );
25
-
26
- export default analyseZoneRouter;