tango-app-api-analysis-traffic 3.0.0-alpha.3 → 3.0.0-alpha.5
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
|
@@ -1677,7 +1677,6 @@ export const footfallTrend = async ( req, res ) => {
|
|
|
1677
1677
|
}
|
|
1678
1678
|
};
|
|
1679
1679
|
|
|
1680
|
-
|
|
1681
1680
|
export const storesMap = async ( req, res ) => {
|
|
1682
1681
|
try {
|
|
1683
1682
|
let reqestData = req.body;
|
|
@@ -1752,11 +1751,27 @@ export const performanceMatrix = async ( req, res ) => {
|
|
|
1752
1751
|
}
|
|
1753
1752
|
|
|
1754
1753
|
let result = {
|
|
1755
|
-
'
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1754
|
+
'performanceData': [
|
|
1755
|
+
{
|
|
1756
|
+
'storeId': '11-1',
|
|
1757
|
+
'storeName': 'Lositon',
|
|
1758
|
+
'avgFootfall': 50,
|
|
1759
|
+
'avgOpenTime': '10:31 AM',
|
|
1760
|
+
'avgCloseTime': '10:31 PM',
|
|
1761
|
+
'top': '40%',
|
|
1762
|
+
'left': '45%',
|
|
1763
|
+
'position': 'High_High',
|
|
1764
|
+
},
|
|
1765
|
+
{
|
|
1766
|
+
'storeId': '11-2',
|
|
1767
|
+
'storeName': 'Lositon-1',
|
|
1768
|
+
'avgFootfall': 50,
|
|
1769
|
+
'avgOpenTime': '10:31 AM',
|
|
1770
|
+
'avgCloseTime': '10:31 PM',
|
|
1771
|
+
'top': '40%',
|
|
1772
|
+
'left': '45%',
|
|
1773
|
+
'position': 'High_Low',
|
|
1774
|
+
},
|
|
1760
1775
|
],
|
|
1761
1776
|
};
|
|
1762
1777
|
return res.sendSuccess( result );
|
|
@@ -336,6 +336,26 @@ export const storeOperationV1 = async ( req, res ) => {
|
|
|
336
336
|
}
|
|
337
337
|
};
|
|
338
338
|
|
|
339
|
+
export const performanceMatrixV1 = async ( req, res ) => {
|
|
340
|
+
try {
|
|
341
|
+
let reqestData = req.body;
|
|
342
|
+
let LamdaURL = 'https://5l3pjpivqpyboludmbridailpu0axrov.lambda-url.ap-south-1.on.aws/';
|
|
343
|
+
let resultData = await LamdaServiceCall( LamdaURL, reqestData );
|
|
344
|
+
if ( resultData ) {
|
|
345
|
+
if ( resultData.status_code == '200' ) {
|
|
346
|
+
return res.sendSuccess( resultData );
|
|
347
|
+
} else {
|
|
348
|
+
return res.sendError( 'No Content', 204 );
|
|
349
|
+
}
|
|
350
|
+
} else {
|
|
351
|
+
return res.sendError( 'No Content', 204 );
|
|
352
|
+
}
|
|
353
|
+
} catch ( error ) {
|
|
354
|
+
logger.error( { error: error, message: req.query, function: 'performanceMatrixV1' } );
|
|
355
|
+
return res.sendError( { error: error }, 500 );
|
|
356
|
+
}
|
|
357
|
+
};
|
|
358
|
+
|
|
339
359
|
export const storesMapV1 = async ( req, res ) => {
|
|
340
360
|
try {
|
|
341
361
|
let reqestData = req.body;
|
|
@@ -407,8 +427,9 @@ export const headerLocationsV1 = async ( req, res ) => {
|
|
|
407
427
|
try {
|
|
408
428
|
let reqestData = req.body;
|
|
409
429
|
let getUserEmail = req.user.email;
|
|
430
|
+
let getUserType = req.user.userType;
|
|
410
431
|
let getClientId = reqestData.clientId;
|
|
411
|
-
let totalStores = await getAllStores( getUserEmail, getClientId );
|
|
432
|
+
let totalStores = await getAllStores( getUserEmail, getClientId, getUserType );
|
|
412
433
|
if ( totalStores && totalStores.length>0 ) {
|
|
413
434
|
let storeQuery = [
|
|
414
435
|
{
|
|
@@ -455,6 +476,7 @@ export const headerGroupsV1 = async ( req, res ) => {
|
|
|
455
476
|
try {
|
|
456
477
|
let requestData = req.body;
|
|
457
478
|
let getUserEmail = req.user.email;
|
|
479
|
+
let getUserType = req.user.userType;
|
|
458
480
|
const assignedQuery = {
|
|
459
481
|
clientId: requestData.clientId,
|
|
460
482
|
userEmail: getUserEmail,
|
|
@@ -474,7 +496,11 @@ export const headerGroupsV1 = async ( req, res ) => {
|
|
|
474
496
|
groupIds = [];
|
|
475
497
|
}
|
|
476
498
|
} else {
|
|
477
|
-
|
|
499
|
+
if ( getUserType == 'tango' ) {
|
|
500
|
+
groupIds = await getGroupIds( requestData.clientId );
|
|
501
|
+
} else {
|
|
502
|
+
return res.sendError( 'No User Assign', 400 );
|
|
503
|
+
}
|
|
478
504
|
}
|
|
479
505
|
|
|
480
506
|
if ( groupIds && groupIds.length > 0 ) {
|
|
@@ -514,8 +540,9 @@ export const headerStoresV1 = async ( req, res ) => {
|
|
|
514
540
|
try {
|
|
515
541
|
let reqestData = req.body;
|
|
516
542
|
let getUserEmail = req.user.email;
|
|
543
|
+
let getUserType = req.user.userType;
|
|
517
544
|
let getClientId = reqestData.clientId;
|
|
518
|
-
let totalStores = await getAllStores( getUserEmail, getClientId );
|
|
545
|
+
let totalStores = await getAllStores( getUserEmail, getClientId, getUserType );
|
|
519
546
|
if ( totalStores && totalStores.length>0 ) {
|
|
520
547
|
let storeQuery = [];
|
|
521
548
|
if ( reqestData.city.length>0 && reqestData.group.length>0 ) {
|
|
@@ -578,7 +605,7 @@ export const headerStoresV1 = async ( req, res ) => {
|
|
|
578
605
|
},
|
|
579
606
|
];
|
|
580
607
|
} else {
|
|
581
|
-
let totalStores = await getAllStores( getUserEmail, getClientId );
|
|
608
|
+
let totalStores = await getAllStores( getUserEmail, getClientId, getUserType );
|
|
582
609
|
storeQuery = [
|
|
583
610
|
{
|
|
584
611
|
$match: {
|
|
@@ -613,7 +640,7 @@ export const headerStoresV1 = async ( req, res ) => {
|
|
|
613
640
|
}
|
|
614
641
|
};
|
|
615
642
|
|
|
616
|
-
async function getAllStores( getUserEmail, getClientId ) {
|
|
643
|
+
async function getAllStores( getUserEmail, getClientId, getUserType ) {
|
|
617
644
|
try {
|
|
618
645
|
if ( getUserEmail && getUserEmail !='' ) {
|
|
619
646
|
const assignedQuery = {
|
|
@@ -662,7 +689,16 @@ async function getAllStores( getUserEmail, getClientId ) {
|
|
|
662
689
|
return false;
|
|
663
690
|
}
|
|
664
691
|
} else {
|
|
665
|
-
|
|
692
|
+
if ( getUserType && getUserType == 'tango' ) {
|
|
693
|
+
let overAllStores = [];
|
|
694
|
+
let getAllS = await getAssignedAllStores( getClientId );
|
|
695
|
+
if ( getAllS && getAllS.length >0 ) {
|
|
696
|
+
overAllStores = getAllS;
|
|
697
|
+
}
|
|
698
|
+
return overAllStores;
|
|
699
|
+
} else {
|
|
700
|
+
return false;
|
|
701
|
+
}
|
|
666
702
|
}
|
|
667
703
|
} else {
|
|
668
704
|
return false;
|
|
@@ -135,9 +135,9 @@ export const validateFootfallDirectoryParams = {
|
|
|
135
135
|
export const validateSummaryTableSchema = joi.object( {
|
|
136
136
|
...baseSchema,
|
|
137
137
|
valueType: joi.string().required(),
|
|
138
|
-
search: joi.string().optional(),
|
|
139
|
-
sortBy: joi.number().optional(),
|
|
140
|
-
sort: joi.string().optional(),
|
|
138
|
+
search: joi.string().optional().allow( '' ),
|
|
139
|
+
sortBy: joi.number().optional().allow( '' ),
|
|
140
|
+
sort: joi.string().optional().allow( '' ),
|
|
141
141
|
limit: joi.number().required(),
|
|
142
142
|
offset: joi.number().required(),
|
|
143
143
|
} );
|
|
@@ -148,11 +148,14 @@ export const validateSummaryTableParams = {
|
|
|
148
148
|
|
|
149
149
|
export const validateFootfallTrendSchema = joi.object( {
|
|
150
150
|
...baseSchema,
|
|
151
|
+
dateType: joi.string().required(),
|
|
151
152
|
filterBy: joi.string().required(),
|
|
152
153
|
processType: joi.string().required(),
|
|
153
154
|
forecast: joi.boolean().optional(),
|
|
154
155
|
limit: joi.number().required(),
|
|
155
156
|
offset: joi.number().required(),
|
|
157
|
+
sortBy: joi.number().optional().allow( '' ),
|
|
158
|
+
sort: joi.string().optional().allow( '' ),
|
|
156
159
|
} );
|
|
157
160
|
|
|
158
161
|
export const validateFootfallTrendParams = {
|
|
@@ -177,6 +180,16 @@ export const validateStoresMapParams = {
|
|
|
177
180
|
body: validateStoresMapSchema,
|
|
178
181
|
};
|
|
179
182
|
|
|
183
|
+
export const validateperformanceMatrixSchema = joi.object( {
|
|
184
|
+
...baseSchema,
|
|
185
|
+
processtype1: joi.string().required(),
|
|
186
|
+
processtype2: joi.string().required(),
|
|
187
|
+
} );
|
|
188
|
+
|
|
189
|
+
export const validateperformanceMatrixParams = {
|
|
190
|
+
body: validateperformanceMatrixSchema,
|
|
191
|
+
};
|
|
192
|
+
|
|
180
193
|
export const validateHeaderSchema = joi.object( {
|
|
181
194
|
clientId: joi.string().required(),
|
|
182
195
|
city: joi.array().required(),
|
|
@@ -45,6 +45,7 @@ import {
|
|
|
45
45
|
summaryTableV1,
|
|
46
46
|
footfallTrendV1,
|
|
47
47
|
storeOperationV1,
|
|
48
|
+
performanceMatrixV1,
|
|
48
49
|
storesMapV1,
|
|
49
50
|
headerStoresV1,
|
|
50
51
|
headerLocationsV1,
|
|
@@ -150,6 +151,11 @@ analysisTrafficRouter
|
|
|
150
151
|
{ featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
|
|
151
152
|
],
|
|
152
153
|
} ), validate( validationDtos.validateStoreOperationParams ), storeOperationV1 )
|
|
154
|
+
.post( '/performanceMatrix_v1', isAllowedSessionHandler, authorize( {
|
|
155
|
+
userType: [ 'tango', 'client' ], access: [
|
|
156
|
+
{ featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
|
|
157
|
+
],
|
|
158
|
+
} ), validate( validationDtos.validateperformanceMatrixParams ), performanceMatrixV1 )
|
|
153
159
|
.post( '/storesMap_v1', isAllowedSessionHandler, authorize( {
|
|
154
160
|
userType: [ 'tango', 'client' ], access: [
|
|
155
161
|
{ featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
|