tango-app-api-analysis-traffic 3.0.0-alpha.10 → 3.0.0-alpha.12
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
|
@@ -394,6 +394,26 @@ export const performanceMatrixV1 = async ( req, res ) => {
|
|
|
394
394
|
}
|
|
395
395
|
};
|
|
396
396
|
|
|
397
|
+
export const zoneDwellTimeSplitV1 = async ( req, res ) => {
|
|
398
|
+
try {
|
|
399
|
+
let reqestData = req.body;
|
|
400
|
+
let LamdaURL = 'https://7tfzazsi6lcejnjdzijv7bwg7y0yxhdx.lambda-url.ap-south-1.on.aws/';
|
|
401
|
+
let resultData = await LamdaServiceCall( LamdaURL, reqestData );
|
|
402
|
+
if ( resultData ) {
|
|
403
|
+
if ( resultData.status_code == '200' ) {
|
|
404
|
+
return res.sendSuccess( resultData );
|
|
405
|
+
} else {
|
|
406
|
+
return res.sendError( 'No Content', 204 );
|
|
407
|
+
}
|
|
408
|
+
} else {
|
|
409
|
+
return res.sendError( 'No Content', 204 );
|
|
410
|
+
}
|
|
411
|
+
} catch ( error ) {
|
|
412
|
+
logger.error( { error: error, message: req.query, function: 'trafficCards' } );
|
|
413
|
+
return res.sendError( { error: error }, 500 );
|
|
414
|
+
}
|
|
415
|
+
};
|
|
416
|
+
|
|
397
417
|
export const storesMapV1 = async ( req, res ) => {
|
|
398
418
|
try {
|
|
399
419
|
let reqestData = req.body;
|
|
@@ -405,8 +425,8 @@ export const storesMapV1 = async ( req, res ) => {
|
|
|
405
425
|
$and: [
|
|
406
426
|
{ 'storeProfile.latitude': { $exists: true } },
|
|
407
427
|
{ 'storeProfile.latitude': { $gt: 0 } },
|
|
408
|
-
{ 'storeProfile.
|
|
409
|
-
{ 'storeProfile.
|
|
428
|
+
{ 'storeProfile.longitude': { $exists: true } },
|
|
429
|
+
{ 'storeProfile.longitude': { $gt: 0 } },
|
|
410
430
|
],
|
|
411
431
|
},
|
|
412
432
|
},
|
|
@@ -417,6 +437,8 @@ export const storesMapV1 = async ( req, res ) => {
|
|
|
417
437
|
'storeName': 1,
|
|
418
438
|
'appId': 1,
|
|
419
439
|
'storeProfile': 1,
|
|
440
|
+
'lat': '$storeProfile.latitude',
|
|
441
|
+
'lng': '$storeProfile.longitude',
|
|
420
442
|
'spocDetails': { $arrayElemAt: [ '$spocDetails', 0 ] },
|
|
421
443
|
'businessType': 1,
|
|
422
444
|
'storeType': 1,
|
|
@@ -1231,3 +1253,30 @@ export async function isAllowedClient( req, res, next ) {
|
|
|
1231
1253
|
return res.sendError( error, 500 );
|
|
1232
1254
|
}
|
|
1233
1255
|
}
|
|
1256
|
+
|
|
1257
|
+
// async function getGeocodedAddress( lat, lng ) {
|
|
1258
|
+
// try {
|
|
1259
|
+
// const apiKey = 'AIzaSyDlOezgwQO0JviD0aizrCuN1FY9tcWfR3o'; // Use this if you're using dotenv
|
|
1260
|
+
// const url = `https://maps.googleapis.com/maps/api/geocode/json?latlng=${lat},${lng}&key=${apiKey}`;
|
|
1261
|
+
|
|
1262
|
+
// const requestOptions = {
|
|
1263
|
+
// method: 'GET',
|
|
1264
|
+
// headers: {
|
|
1265
|
+
// 'Content-Type': 'application/json',
|
|
1266
|
+
// },
|
|
1267
|
+
// };
|
|
1268
|
+
// const response = await fetch( url, requestOptions );
|
|
1269
|
+
// console.log( 'response =>', response );
|
|
1270
|
+
// if ( !response.ok ) {
|
|
1271
|
+
// throw new Error( `Response status: ${response.status}` );
|
|
1272
|
+
// return false;
|
|
1273
|
+
// }
|
|
1274
|
+
// const json = await response.json();
|
|
1275
|
+
// return json;
|
|
1276
|
+
// } catch ( error ) {
|
|
1277
|
+
// console.log( 'getGeocodedAddress error =>', error );
|
|
1278
|
+
// logger.error( { error: error, message: data, function: 'getGeocodedAddress' } );
|
|
1279
|
+
// }
|
|
1280
|
+
// }
|
|
1281
|
+
// let getGEO = await getGeocodedAddress( 12.900260100404893, 80.23384232089138 );
|
|
1282
|
+
// console.log( 'getGEO =>', getGEO );
|
|
@@ -46,6 +46,7 @@ import {
|
|
|
46
46
|
footfallTrendV1,
|
|
47
47
|
storeOperationV1,
|
|
48
48
|
performanceMatrixV1,
|
|
49
|
+
zoneDwellTimeSplitV1,
|
|
49
50
|
storesMapV1,
|
|
50
51
|
headerStoresV1,
|
|
51
52
|
headerLocationsV1,
|
|
@@ -157,6 +158,11 @@ analysisTrafficRouter
|
|
|
157
158
|
{ featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
|
|
158
159
|
],
|
|
159
160
|
} ), validate( validationDtos.validateperformanceMatrixParams ), performanceMatrixV1 )
|
|
161
|
+
.post( '/zoneDwellTimeSplit_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
|
|
162
|
+
userType: [ 'tango', 'client' ], access: [
|
|
163
|
+
{ featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
|
|
164
|
+
],
|
|
165
|
+
} ), validate( validationDtos.validateStoreOperationParams ), zoneDwellTimeSplitV1 )
|
|
160
166
|
.post( '/storesMap_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
|
|
161
167
|
userType: [ 'tango', 'client' ], access: [
|
|
162
168
|
{ featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
|