tango-app-api-analysis-zone 3.0.0-alpha.20 → 3.0.0-alpha.22
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
|
@@ -99,10 +99,10 @@ export const zoneSummaryTableV2 = async ( req, res ) => {
|
|
|
99
99
|
const exportdata = [];
|
|
100
100
|
resultData.zoneSummaryData.forEach( ( element ) => {
|
|
101
101
|
exportdata.push( {
|
|
102
|
-
'Date': element.date,
|
|
103
|
-
'Zone Name': element.zoneName,
|
|
104
102
|
'Store Name': element.storeName,
|
|
105
103
|
'StoreId': element.storeId,
|
|
104
|
+
'Date': element.date,
|
|
105
|
+
'Zone Name': element.zoneName,
|
|
106
106
|
'Zone Conc.Rate': element.concentrationRate,
|
|
107
107
|
'Avg Dwell Time': element.avgDwellTime,
|
|
108
108
|
'Zone FF': element.footfallCount,
|
|
@@ -219,7 +219,7 @@ export const overallStoreConcentrationHeatmapV2 = async ( req, res ) => {
|
|
|
219
219
|
export const trajectoryAnalysisV2 = async ( req, res ) => {
|
|
220
220
|
try {
|
|
221
221
|
let reqestData = req.body;
|
|
222
|
-
let LamdaURL = '';
|
|
222
|
+
let LamdaURL = 'https://yf27g6zv55gge5zhjjiipgz3py0hntal.lambda-url.ap-south-1.on.aws/';
|
|
223
223
|
let resultData = await LamdaServiceCall( LamdaURL, reqestData );
|
|
224
224
|
if ( resultData ) {
|
|
225
225
|
if ( resultData.status_code == '200' ) {
|
|
@@ -235,6 +235,25 @@ export const trajectoryAnalysisV2 = async ( req, res ) => {
|
|
|
235
235
|
return res.sendError( { error: error }, 500 );
|
|
236
236
|
}
|
|
237
237
|
};
|
|
238
|
+
export const trajectoryAnalysisRateV2 = async ( req, res ) => {
|
|
239
|
+
try {
|
|
240
|
+
let reqestData = req.body;
|
|
241
|
+
let LamdaURL = 'https://h3xn5ktondejvwpaapkwb5wmbu0dqxop.lambda-url.ap-south-1.on.aws/%27';
|
|
242
|
+
let resultData = await LamdaServiceCall( LamdaURL, reqestData );
|
|
243
|
+
if ( resultData ) {
|
|
244
|
+
if ( resultData.status_code == '200' ) {
|
|
245
|
+
return res.sendSuccess( resultData );
|
|
246
|
+
} else {
|
|
247
|
+
return res.sendError( 'No Content', 204 );
|
|
248
|
+
}
|
|
249
|
+
} else {
|
|
250
|
+
return res.sendError( 'No Content', 204 );
|
|
251
|
+
}
|
|
252
|
+
} catch ( error ) {
|
|
253
|
+
logger.error( { error: error, message: req.query, function: 'trajectoryAnalysisRateV2' } );
|
|
254
|
+
return res.sendError( { error: error }, 500 );
|
|
255
|
+
}
|
|
256
|
+
};
|
|
238
257
|
export const customerJourneyV2 = async ( req, res ) => {
|
|
239
258
|
try {
|
|
240
259
|
let reqestData = req.body;
|
|
@@ -254,6 +273,46 @@ export const customerJourneyV2 = async ( req, res ) => {
|
|
|
254
273
|
return res.sendError( { error: error }, 500 );
|
|
255
274
|
}
|
|
256
275
|
};
|
|
276
|
+
export const customerJourneyTableV2 = async ( req, res ) => {
|
|
277
|
+
try {
|
|
278
|
+
let reqestData = req.body;
|
|
279
|
+
if ( reqestData.export ) {
|
|
280
|
+
reqestData.limit = 1000;
|
|
281
|
+
}
|
|
282
|
+
let LamdaURL = '';
|
|
283
|
+
let resultData = await LamdaServiceCall( LamdaURL, reqestData );
|
|
284
|
+
if ( resultData ) {
|
|
285
|
+
if ( resultData.status_code == '200' ) {
|
|
286
|
+
if ( reqestData.export ) {
|
|
287
|
+
if ( resultData.customerJourneyTableData.length>0 ) {
|
|
288
|
+
const exportdata = [];
|
|
289
|
+
resultData.customerJourneyTableData.forEach( ( element ) => {
|
|
290
|
+
exportdata.push( {
|
|
291
|
+
'Zone Name': element.zoneName,
|
|
292
|
+
'No of Stores': element.noOfStores,
|
|
293
|
+
'Zone FF': element.zoneFF,
|
|
294
|
+
'Impressions': element.impressions,
|
|
295
|
+
'Avg Dwell Time': element.AvgDwellTime,
|
|
296
|
+
} );
|
|
297
|
+
} );
|
|
298
|
+
return await download( exportdata, res );
|
|
299
|
+
} else {
|
|
300
|
+
return res.sendError( 'No Content', 204 );
|
|
301
|
+
}
|
|
302
|
+
} else {
|
|
303
|
+
return res.sendSuccess( resultData );
|
|
304
|
+
}
|
|
305
|
+
} else {
|
|
306
|
+
return res.sendError( 'No Content', 204 );
|
|
307
|
+
}
|
|
308
|
+
} else {
|
|
309
|
+
return res.sendError( 'No Content', 204 );
|
|
310
|
+
}
|
|
311
|
+
} catch ( error ) {
|
|
312
|
+
logger.error( { error: error, message: req.query, function: 'customerJourneyTableV2' } );
|
|
313
|
+
return res.sendError( { error: error }, 500 );
|
|
314
|
+
}
|
|
315
|
+
};
|
|
257
316
|
|
|
258
317
|
export async function isAllowedClient( req, res, next ) {
|
|
259
318
|
try {
|
|
@@ -168,18 +168,48 @@ export const validateOverallStoreConcentrationHeatmapV2Params = {
|
|
|
168
168
|
|
|
169
169
|
export const validateTrajectoryAnalysisV2Schema = joi.object( {
|
|
170
170
|
...baseSchema,
|
|
171
|
+
zoneName: joi.string().required(),
|
|
171
172
|
} );
|
|
172
173
|
|
|
173
174
|
export const validateTrajectoryAnalysisV2Params = {
|
|
174
175
|
body: validateTrajectoryAnalysisV2Schema,
|
|
175
176
|
};
|
|
176
177
|
|
|
178
|
+
export const validateTrajectoryAnalysisRateV2Schema = joi.object( {
|
|
179
|
+
...baseSchema,
|
|
180
|
+
zoneName: joi.string().required(),
|
|
181
|
+
} );
|
|
182
|
+
|
|
183
|
+
export const validateTrajectoryAnalysisRateV2Params = {
|
|
184
|
+
body: validateTrajectoryAnalysisRateV2Schema,
|
|
185
|
+
};
|
|
186
|
+
|
|
177
187
|
export const validateCustomerJourneyV2Schema = joi.object( {
|
|
178
188
|
...baseSchema,
|
|
189
|
+
search: joi.string().optional().allow( '' ),
|
|
190
|
+
sortBy: joi.number().optional().allow( '' ),
|
|
191
|
+
sort: joi.string().optional().allow( '' ),
|
|
192
|
+
limit: joi.number().required(),
|
|
193
|
+
offset: joi.number().required(),
|
|
194
|
+
export: joi.boolean().required(),
|
|
179
195
|
} );
|
|
180
196
|
|
|
181
197
|
export const validateCustomerJourneyV2Params = {
|
|
182
198
|
body: validateCustomerJourneyV2Schema,
|
|
183
199
|
};
|
|
184
200
|
|
|
201
|
+
export const validatCustomerJourneyTableV2Schema = joi.object( {
|
|
202
|
+
...baseSchema,
|
|
203
|
+
search: joi.string().optional().allow( '' ),
|
|
204
|
+
sortBy: joi.number().optional().allow( '' ),
|
|
205
|
+
sort: joi.string().optional().allow( '' ),
|
|
206
|
+
limit: joi.number().required(),
|
|
207
|
+
offset: joi.number().required(),
|
|
208
|
+
export: joi.boolean().required(),
|
|
209
|
+
} );
|
|
210
|
+
|
|
211
|
+
export const validateCustomerJourneyTableV2Params = {
|
|
212
|
+
body: validatCustomerJourneyTableV2Schema,
|
|
213
|
+
};
|
|
214
|
+
|
|
185
215
|
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
overallStoreConcentrationHeatmap,
|
|
15
15
|
trajectoryAnalysis,
|
|
16
16
|
customerJourney,
|
|
17
|
+
customerJourneyTable,
|
|
17
18
|
} from '../controllers/analysisZoneSampleDataV2.controllers.js';
|
|
18
19
|
|
|
19
20
|
import {
|
|
@@ -26,6 +27,9 @@ import {
|
|
|
26
27
|
overallStoreConcentrationDatesV2,
|
|
27
28
|
overallStoreConcentrationHeatmapV2,
|
|
28
29
|
trajectoryAnalysisV2,
|
|
30
|
+
trajectoryAnalysisRateV2,
|
|
31
|
+
customerJourneyV2,
|
|
32
|
+
customerJourneyTableV2,
|
|
29
33
|
} from '../controllers/analysisZoneV2.controllers.js';
|
|
30
34
|
|
|
31
35
|
analysisZoneV2Router
|
|
@@ -39,6 +43,7 @@ analysisZoneV2Router
|
|
|
39
43
|
.post( '/overallStoreConcentrationHeatmap', overallStoreConcentrationHeatmap )
|
|
40
44
|
.post( '/trajectoryAnalysis', trajectoryAnalysis )
|
|
41
45
|
.post( '/customerJourney', customerJourney )
|
|
46
|
+
.post( '/customerJourneyTable', customerJourneyTable )
|
|
42
47
|
.post( '/zonecards_V2', isAllowedSessionHandler, isAllowedClient, authorize( {
|
|
43
48
|
userType: [ 'tango', 'client' ], access: [
|
|
44
49
|
{ featureName: 'analytics', name: 'tangoZone', permissions: [ 'isView' ] },
|
|
@@ -84,9 +89,19 @@ analysisZoneV2Router
|
|
|
84
89
|
{ featureName: 'analytics', name: 'tangoZone', permissions: [ 'isView' ] },
|
|
85
90
|
],
|
|
86
91
|
} ), validate( validationDtos.validateTrajectoryAnalysisV2Params ), trajectoryAnalysisV2 )
|
|
92
|
+
.post( '/trajectoryAnalysisRate_v2', isAllowedSessionHandler, isAllowedClient, authorize( {
|
|
93
|
+
userType: [ 'tango', 'client' ], access: [
|
|
94
|
+
{ featureName: 'analytics', name: 'tangoZone', permissions: [ 'isView' ] },
|
|
95
|
+
],
|
|
96
|
+
} ), validate( validationDtos.validateTrajectoryAnalysisRateV2Params ), trajectoryAnalysisRateV2 )
|
|
87
97
|
.post( '/customerJourney_v2', isAllowedSessionHandler, isAllowedClient, authorize( {
|
|
88
98
|
userType: [ 'tango', 'client' ], access: [
|
|
89
99
|
{ featureName: 'analytics', name: 'tangoZone', permissions: [ 'isView' ] },
|
|
90
100
|
],
|
|
91
|
-
} ), validate( validationDtos.validateCustomerJourneyV2Params ),
|
|
101
|
+
} ), validate( validationDtos.validateCustomerJourneyV2Params ), customerJourneyV2 )
|
|
102
|
+
.post( '/customerJourneyTable_v2', isAllowedSessionHandler, isAllowedClient, authorize( {
|
|
103
|
+
userType: [ 'tango', 'client' ], access: [
|
|
104
|
+
{ featureName: 'analytics', name: 'tangoZone', permissions: [ 'isView' ] },
|
|
105
|
+
],
|
|
106
|
+
} ), validate( validationDtos.validateCustomerJourneyTableV2Params ), customerJourneyTableV2 );
|
|
92
107
|
export default analysisZoneV2Router;
|