tango-app-api-analysis-zone 3.7.1-alpha.2 → 3.7.1-alpha.20
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 +3 -3
- package/src/controllers/analysisZoneV1.controllers.js +315 -7
- package/src/controllers/analysisZoneV2.controllers.js +24 -4
- package/src/dtos/validation.dtos.js +3 -2
- package/src/routes/analysisZone.js +24 -1
- package/src/routes/analysisZoneV2.js +3 -1
- package/src/services/clients.services.js +23 -0
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tango-app-api-analysis-zone",
|
|
3
|
-
"version": "3.7.1-alpha.
|
|
3
|
+
"version": "3.7.1-alpha.20",
|
|
4
4
|
"description": "zone Analysis",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"start": "nodemon --exec \"eslint --fix . && node
|
|
8
|
+
"start": "nodemon --exec \"eslint --fix . && node app.js\""
|
|
9
9
|
},
|
|
10
10
|
"engines": {
|
|
11
11
|
"node": ">=18.10.0"
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"mongodb": "^6.8.0",
|
|
22
22
|
"nodemon": "^3.1.4",
|
|
23
23
|
"tango-api-schema": "^2.2.21",
|
|
24
|
-
"tango-app-api-middleware": "^3.
|
|
24
|
+
"tango-app-api-middleware": "^3.6.8",
|
|
25
25
|
"winston": "^3.13.1",
|
|
26
26
|
"winston-daily-rotate-file": "^5.0.0"
|
|
27
27
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { logger, download, convertSecondstoTimeFormat } from 'tango-app-api-middleware';
|
|
1
|
+
import { logger, download, downloadint, convertSecondstoTimeFormat } from 'tango-app-api-middleware';
|
|
2
2
|
import { findOneUserAssignedStore } from '../services/userAssignedStore.service.js';
|
|
3
|
-
|
|
3
|
+
import * as clientService from '../services/clients.services.js';
|
|
4
4
|
// Lamda Service Call //
|
|
5
5
|
async function LamdaServiceCall( url, data ) {
|
|
6
6
|
try {
|
|
@@ -107,10 +107,16 @@ export const topPerformingStoresV1 = async ( req, res ) => {
|
|
|
107
107
|
export const zoneSummaryTableV1 = async ( req, res ) => {
|
|
108
108
|
try {
|
|
109
109
|
let reqestData = req.body;
|
|
110
|
+
const getClientData = await getClientConfig( reqestData.clientId );
|
|
111
|
+
if ( !getClientData ) {
|
|
112
|
+
return res.sendError( 'Invalid Client Id', 400 );
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
reqestData.featureConfigs = getClientData.featureConfigs;
|
|
110
116
|
if ( reqestData.export ) {
|
|
111
|
-
reqestData.limit =
|
|
117
|
+
reqestData.limit = 10000;
|
|
112
118
|
}
|
|
113
|
-
let LamdaURL = 'https://hxpnn5weq3lm4nqouk4pjm3chy0jmqdb.lambda-url.ap-south-1.on.aws/';
|
|
119
|
+
let LamdaURL = 'https://l6dgzeiq6lgcfk54uiofhhwini0yserp.lambda-url.ap-south-1.on.aws/'; // 'https://hxpnn5weq3lm4nqouk4pjm3chy0jmqdb.lambda-url.ap-south-1.on.aws/';
|
|
114
120
|
let resultData = await LamdaServiceCall( LamdaURL, reqestData );
|
|
115
121
|
if ( resultData ) {
|
|
116
122
|
if ( resultData.status_code == '200' ) {
|
|
@@ -121,8 +127,14 @@ export const zoneSummaryTableV1 = async ( req, res ) => {
|
|
|
121
127
|
exportdata.push( {
|
|
122
128
|
'Date': element.date,
|
|
123
129
|
'Zone Name': element.zoneName,
|
|
130
|
+
...( element.zoneGroupName ? { 'Zone Group Name': element.zoneGroupName } : {} ),
|
|
124
131
|
'Store Name': element.storeName,
|
|
125
132
|
'Store ID': element.storeId,
|
|
133
|
+
...( element.storefootfallCount !== undefined && { 'Store FF': element.storefootfallCount } ),
|
|
134
|
+
...( reqestData.featureConfigs?.isNOB ?
|
|
135
|
+
{ 'Zone Wise NoB': element.nob ?? 0 } :
|
|
136
|
+
{ 'Zone Wise Conversion': element.nob ?? 0 }
|
|
137
|
+
),
|
|
126
138
|
'Zone Conc.Rate': element.concentrationRate,
|
|
127
139
|
'Avg Dwell Time (Mins)': element.avgDwellTime,
|
|
128
140
|
'Zone FF': element.footfallCount,
|
|
@@ -138,7 +150,7 @@ export const zoneSummaryTableV1 = async ( req, res ) => {
|
|
|
138
150
|
'Female': element.femaleCount,
|
|
139
151
|
} );
|
|
140
152
|
} );
|
|
141
|
-
return await
|
|
153
|
+
return await downloadint( exportdata, res );
|
|
142
154
|
} else {
|
|
143
155
|
return res.sendError( 'No Content', 204 );
|
|
144
156
|
}
|
|
@@ -160,7 +172,7 @@ export const zoneSummaryTableV1 = async ( req, res ) => {
|
|
|
160
172
|
export const zoneConcentrationSummaryTableV1 = async ( req, res ) => {
|
|
161
173
|
try {
|
|
162
174
|
let reqestData = req.body;
|
|
163
|
-
let LamdaURL = 'https://ebinpkkji5wghr6rwm7jojwstu0idgiu.lambda-url.ap-south-1.on.aws/';
|
|
175
|
+
let LamdaURL ='https://ygywlvudrnvmvklfwiugufzuky0vblph.lambda-url.ap-south-1.on.aws/'; // 'https://ebinpkkji5wghr6rwm7jojwstu0idgiu.lambda-url.ap-south-1.on.aws/';
|
|
164
176
|
let resultData = await LamdaServiceCall( LamdaURL, reqestData );
|
|
165
177
|
if ( resultData ) {
|
|
166
178
|
if ( resultData.status_code == '200' ) {
|
|
@@ -219,6 +231,7 @@ export const zoneHeatmapAvailableDatesV1 = async ( req, res ) => {
|
|
|
219
231
|
let LamdaURL = 'https://tgtkai5zzq7fhp7ymtsnm3a2lm0czulr.lambda-url.ap-south-1.on.aws/';
|
|
220
232
|
let resultData = await LamdaServiceCall( LamdaURL, reqestData );
|
|
221
233
|
if ( resultData ) {
|
|
234
|
+
console.log( resultData, reqestData );
|
|
222
235
|
if ( resultData.status_code == '200' ) {
|
|
223
236
|
return res.sendSuccess( resultData );
|
|
224
237
|
} else {
|
|
@@ -446,7 +459,7 @@ export const zoneInteractionTableExport430 = async ( req, res ) => {
|
|
|
446
459
|
export const zoneConcentrationTableExport = async ( req, res ) => {
|
|
447
460
|
try {
|
|
448
461
|
let reqestData = req.body;
|
|
449
|
-
let LamdaURL = 'https://d6t5hy4qdautrffztmpeipslku0vforb.lambda-url.ap-south-1.on.aws/';
|
|
462
|
+
let LamdaURL = 'https://4bdorfgq75zujog7v3mdj7kuke0efiia.lambda-url.ap-south-1.on.aws/';// 'https://d6t5hy4qdautrffztmpeipslku0vforb.lambda-url.ap-south-1.on.aws/';
|
|
450
463
|
let resultData = await LamdaServiceCall( LamdaURL, reqestData );
|
|
451
464
|
if ( resultData ) {
|
|
452
465
|
if ( resultData.status_code == '200' ) {
|
|
@@ -810,3 +823,298 @@ export const ZonewiseCustomerFunnelExport = async ( req, res ) => {
|
|
|
810
823
|
}
|
|
811
824
|
};
|
|
812
825
|
|
|
826
|
+
|
|
827
|
+
// new Pantprojects api for Zone FF V2
|
|
828
|
+
export const getZoneAPIFFV2 = async ( req, res ) => {
|
|
829
|
+
try {
|
|
830
|
+
let reqestData = req.body;
|
|
831
|
+
let LamdaURL = 'https://kxz75vd4lsgpf4ykytgmyllmoa0xwixt.lambda-url.ap-south-1.on.aws/';
|
|
832
|
+
let resultData = await LamdaServiceCall( LamdaURL, reqestData );
|
|
833
|
+
if ( resultData ) {
|
|
834
|
+
return res.sendSuccess( resultData );
|
|
835
|
+
} else {
|
|
836
|
+
return res.sendError( 'No Content', 204 );
|
|
837
|
+
}
|
|
838
|
+
} catch ( error ) {
|
|
839
|
+
logger.error( { error: error, message: req.query, function: 'getZoneAPIFFV2' } );
|
|
840
|
+
return res.sendError( { error: error }, 500 );
|
|
841
|
+
}
|
|
842
|
+
};
|
|
843
|
+
|
|
844
|
+
export const getNewZoneFFV2 = async ( req, res ) => {
|
|
845
|
+
try {
|
|
846
|
+
let reqestData = req.body;
|
|
847
|
+
let LamdaURL ='https://qraodev2brfhvlmlqk6mzsotlm0ggcjv.lambda-url.ap-south-1.on.aws/';
|
|
848
|
+
// 'https://gcizlv6zpfhvwyrqzgpjsxneoi0rfnuc.lambda-url.ap-south-1.on.aws/';
|
|
849
|
+
let resultData = await LamdaServiceCall( LamdaURL, reqestData );
|
|
850
|
+
if ( resultData ) {
|
|
851
|
+
if ( resultData.status_code == '200' ) {
|
|
852
|
+
return res.sendSuccess( resultData );
|
|
853
|
+
} else {
|
|
854
|
+
return res.sendError( 'No Content', 204 );
|
|
855
|
+
}
|
|
856
|
+
} else {
|
|
857
|
+
return res.sendError( 'No Content', 204 );
|
|
858
|
+
}
|
|
859
|
+
} catch ( error ) {
|
|
860
|
+
logger.error( { error: error, message: req.query, function: 'getNewZoneFFV2' } );
|
|
861
|
+
return res.sendError( { error: error }, 500 );
|
|
862
|
+
}
|
|
863
|
+
};
|
|
864
|
+
export const getSelectedZoneFFV2 = async ( req, res ) => {
|
|
865
|
+
try {
|
|
866
|
+
let reqestData = req.body;
|
|
867
|
+
let LamdaURL = 'https://rueg2hacc7ttlvbxkr73oij47q0upjqz.lambda-url.ap-south-1.on.aws/';
|
|
868
|
+
// 'https://6adocjaelheviyminlomqqncmi0japrn.lambda-url.ap-south-1.on.aws/';
|
|
869
|
+
let resultData = await LamdaServiceCall( LamdaURL, reqestData );
|
|
870
|
+
if ( resultData ) {
|
|
871
|
+
if ( resultData.status_code == '200' ) {
|
|
872
|
+
if ( reqestData.export ) {
|
|
873
|
+
const exportdata = [];
|
|
874
|
+
const element = resultData.data;
|
|
875
|
+
const row = {
|
|
876
|
+
'Store Name': element.storeName || '--',
|
|
877
|
+
'Overall FF': ( element.zone1FF ?? element.zone2FF ?? element.zone3FF ) != null ?
|
|
878
|
+
element.overallFootfall ?? '--' :
|
|
879
|
+
'--',
|
|
880
|
+
'NOB': element.noB ?? '--',
|
|
881
|
+
};
|
|
882
|
+
|
|
883
|
+
// Conditionally add zone values if present
|
|
884
|
+
if ( element.zone1FF !== undefined && element.zone1FF !== null ) {
|
|
885
|
+
row['Zone 1 FF'] = element.zone1FF;
|
|
886
|
+
}
|
|
887
|
+
if ( element.zone2FF !== undefined && element.zone2FF !== null ) {
|
|
888
|
+
row['Zone 2 FF'] = element.zone2FF;
|
|
889
|
+
}
|
|
890
|
+
if ( element.zone3FF !== undefined && element.zone3FF !== null ) {
|
|
891
|
+
row['Zone 3 FF'] = element.zone3FF;
|
|
892
|
+
}
|
|
893
|
+
if ( element.zone1Percentage !== undefined && element.zone1Percentage !== null ) {
|
|
894
|
+
row['Zone 1 Conc %'] = element.zone1Percentage !== undefined ?`${element.zone1Percentage}%` : '--';
|
|
895
|
+
}
|
|
896
|
+
if ( element.zone2Percentage !== undefined && element.zone2Percentage !== null ) {
|
|
897
|
+
row['Zone 2 Conc %'] = element.zone2Percentage !== undefined ? `${element.zone2Percentage}%` : '--';
|
|
898
|
+
}
|
|
899
|
+
if ( element.zone3Percentage !== undefined && element.zone3Percentage !== null ) {
|
|
900
|
+
row['Zone 3 Conc %'] = element.zone3Percentage !== undefined ? `${element.zone3Percentage}%` : '--';
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
|
|
904
|
+
exportdata.push( row );
|
|
905
|
+
|
|
906
|
+
return await downloadint( exportdata, res );
|
|
907
|
+
}
|
|
908
|
+
return res.sendSuccess( resultData );
|
|
909
|
+
} else {
|
|
910
|
+
return res.sendError( 'No Content', 204 );
|
|
911
|
+
}
|
|
912
|
+
} else {
|
|
913
|
+
return res.sendError( 'No Content', 204 );
|
|
914
|
+
}
|
|
915
|
+
} catch ( error ) {
|
|
916
|
+
logger.error( { error: error, message: req.query, function: 'getSelectedZoneFFV2' } );
|
|
917
|
+
return res.sendError( { error: error }, 500 );
|
|
918
|
+
}
|
|
919
|
+
};
|
|
920
|
+
|
|
921
|
+
// end v2 API's for pantprojects//
|
|
922
|
+
// pant New Api start date 19-12-2025
|
|
923
|
+
|
|
924
|
+
|
|
925
|
+
export const getNewHoTColdZoneV1 = async ( req, res ) => {
|
|
926
|
+
try {
|
|
927
|
+
let reqestData = req.body;
|
|
928
|
+
let LamdaURL = 'https://j7e5uxgkna6qnuu4vip57kl2wu0pqxza.lambda-url.ap-south-1.on.aws/';
|
|
929
|
+
let resultData = await LamdaServiceCall( LamdaURL, reqestData );
|
|
930
|
+
if ( resultData ) {
|
|
931
|
+
return res.sendSuccess( resultData );
|
|
932
|
+
} else {
|
|
933
|
+
return res.sendError( 'No Content', 204 );
|
|
934
|
+
}
|
|
935
|
+
} catch ( error ) {
|
|
936
|
+
logger.error( { error: error, message: req.query, function: 'getNewHoTColdZoneV1' } );
|
|
937
|
+
return res.sendError( { error: error }, 500 );
|
|
938
|
+
}
|
|
939
|
+
};
|
|
940
|
+
|
|
941
|
+
export const getNewZoneShopperAnalysisV1 = async ( req, res ) => {
|
|
942
|
+
try {
|
|
943
|
+
const reqestData = req.body;
|
|
944
|
+
|
|
945
|
+
const getClientData = await getClientConfig( reqestData.clientId );
|
|
946
|
+
if ( !getClientData ) {
|
|
947
|
+
return res.sendError( 'Invalid Client Id', 400 );
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
reqestData.featureConfigs = getClientData.featureConfigs;
|
|
951
|
+
const LamdaURL =
|
|
952
|
+
'https://sekueyolczfjl2ggy4hadzxxxu0zqcmt.lambda-url.ap-south-1.on.aws/';
|
|
953
|
+
|
|
954
|
+
const resultData = await LamdaServiceCall( LamdaURL, reqestData );
|
|
955
|
+
|
|
956
|
+
if ( !resultData || resultData.status_code !== '200' ) {
|
|
957
|
+
return res.sendError( 'No Content', 204 );
|
|
958
|
+
}
|
|
959
|
+
if ( reqestData.export && resultData.shopperJourneyExportData?.length ) {
|
|
960
|
+
const finalRow = {
|
|
961
|
+
'Overall FF': resultData['Overall FF'] ?? 0,
|
|
962
|
+
};
|
|
963
|
+
if ( reqestData.featureConfigs?.isNOB ) {
|
|
964
|
+
finalRow['NOB'] = resultData.NoB ?? 0;
|
|
965
|
+
} else {
|
|
966
|
+
finalRow['Conversion'] = resultData.NoB ?? 0;
|
|
967
|
+
}
|
|
968
|
+
resultData.shopperJourneyExportData.forEach( ( zoneObj ) => {
|
|
969
|
+
Object.entries( zoneObj ).forEach( ( [ key, value ] ) => {
|
|
970
|
+
finalRow[key] = value ?? 0;
|
|
971
|
+
} );
|
|
972
|
+
} );
|
|
973
|
+
|
|
974
|
+
return await downloadint( [ finalRow ], res );
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
return res.sendSuccess( resultData );
|
|
978
|
+
} catch ( error ) {
|
|
979
|
+
logger.error( {
|
|
980
|
+
error,
|
|
981
|
+
message: req.query,
|
|
982
|
+
function: 'getNewZoneShopperAnalysisV1',
|
|
983
|
+
} );
|
|
984
|
+
return res.sendError( { error }, 500 );
|
|
985
|
+
}
|
|
986
|
+
};
|
|
987
|
+
|
|
988
|
+
|
|
989
|
+
export const getNewZoneShopperBubbleChartV1 = async ( req, res ) => {
|
|
990
|
+
try {
|
|
991
|
+
let reqestData = req.body;
|
|
992
|
+
let LamdaURL = 'https://iqh6vcxtdxeszpfgdenhsrnvwq0rseou.lambda-url.ap-south-1.on.aws/';
|
|
993
|
+
let resultData = await LamdaServiceCall( LamdaURL, reqestData );
|
|
994
|
+
if ( resultData ) {
|
|
995
|
+
if ( resultData.status_code == '200' ) {
|
|
996
|
+
return res.sendSuccess( resultData );
|
|
997
|
+
} else {
|
|
998
|
+
return res.sendError( 'No Content', 204 );
|
|
999
|
+
}
|
|
1000
|
+
} else {
|
|
1001
|
+
return res.sendError( 'No Content', 204 );
|
|
1002
|
+
}
|
|
1003
|
+
} catch ( error ) {
|
|
1004
|
+
logger.error( { error: error, message: req.query, function: 'getNewZoneShopperBubbleChartV1' } );
|
|
1005
|
+
return res.sendError( { error: error }, 500 );
|
|
1006
|
+
}
|
|
1007
|
+
};
|
|
1008
|
+
|
|
1009
|
+
export const getNewCustomerTravelZoneV1 = async ( req, res ) => {
|
|
1010
|
+
try {
|
|
1011
|
+
let reqestData = req.body;
|
|
1012
|
+
let LamdaURL = 'https://id7qgpex6qbft4kcnloqdrby2q0hyldr.lambda-url.ap-south-1.on.aws/';
|
|
1013
|
+
let resultData = await LamdaServiceCall( LamdaURL, reqestData );
|
|
1014
|
+
if ( resultData ) {
|
|
1015
|
+
if ( resultData.status_code == '200' ) {
|
|
1016
|
+
return res.sendSuccess( resultData );
|
|
1017
|
+
} else {
|
|
1018
|
+
return res.sendError( 'No Content', 204 );
|
|
1019
|
+
}
|
|
1020
|
+
} else {
|
|
1021
|
+
return res.sendError( 'No Content', 204 );
|
|
1022
|
+
}
|
|
1023
|
+
} catch ( error ) {
|
|
1024
|
+
logger.error( { error: error, message: req.query, function: 'getNewCustomerTravelZoneV1' } );
|
|
1025
|
+
return res.sendError( { error: error }, 500 );
|
|
1026
|
+
}
|
|
1027
|
+
};
|
|
1028
|
+
|
|
1029
|
+
export const getNewAnalysisZoneV1 = async ( req, res ) => {
|
|
1030
|
+
try {
|
|
1031
|
+
let reqestData = req.body;
|
|
1032
|
+
let LamdaURL ='https://z46gmtwh772hx3flboykgvrq5u0wnval.lambda-url.ap-south-1.on.aws/';
|
|
1033
|
+
// 'https://udcada6kh2bpchpgmigky4bxee0drhwb.lambda-url.ap-south-1.on.aws/';
|
|
1034
|
+
let resultData = await LamdaServiceCall( LamdaURL, reqestData );
|
|
1035
|
+
if ( resultData ) {
|
|
1036
|
+
return res.sendSuccess( resultData );
|
|
1037
|
+
} else {
|
|
1038
|
+
return res.sendError( 'No Content', 204 );
|
|
1039
|
+
}
|
|
1040
|
+
} catch ( error ) {
|
|
1041
|
+
logger.error( { error: error, message: req.query, function: 'getNewAnalysisZoneV1' } );
|
|
1042
|
+
return res.sendError( { error: error }, 500 );
|
|
1043
|
+
}
|
|
1044
|
+
};
|
|
1045
|
+
|
|
1046
|
+
export const getOverallStoreCardsV1 = async ( req, res ) => {
|
|
1047
|
+
try {
|
|
1048
|
+
let reqestData = req.body;
|
|
1049
|
+
let LamdaURL = 'https://fdeqsx2kouac3n4wodmczoxyke0xpikn.lambda-url.ap-south-1.on.aws/';
|
|
1050
|
+
let resultData = await LamdaServiceCall( LamdaURL, reqestData );
|
|
1051
|
+
if ( resultData ) {
|
|
1052
|
+
if ( resultData.status_code == '200' ) {
|
|
1053
|
+
return res.sendSuccess( resultData );
|
|
1054
|
+
} else {
|
|
1055
|
+
return res.sendError( 'No Content', 204 );
|
|
1056
|
+
}
|
|
1057
|
+
} else {
|
|
1058
|
+
return res.sendError( 'No Content', 204 );
|
|
1059
|
+
}
|
|
1060
|
+
} catch ( error ) {
|
|
1061
|
+
logger.error( { error: error, message: req.query, function: 'getOverallStoreCardsV1' } );
|
|
1062
|
+
return res.sendError( { error: error }, 500 );
|
|
1063
|
+
}
|
|
1064
|
+
};
|
|
1065
|
+
|
|
1066
|
+
async function getClientConfig( clientId ) {
|
|
1067
|
+
try {
|
|
1068
|
+
let getClientData = await clientService.findOne( { clientId: clientId }, { 'paymentInvoice.currencyType': 1, 'averageTransactionValue': 1, 'featureConfigs.billableCalculation': 1, 'featureConfigs.missedOpportunityCalculation': 1, 'featureConfigs.conversionCalculation': 1, 'featureConfigs.open': 1, 'featureConfigs.close': 1, 'isFootfallAuditStores': 1, 'clientName': 1, 'featureConfigs.isNOB': 1 } );
|
|
1069
|
+
if ( !getClientData ) {
|
|
1070
|
+
return false;
|
|
1071
|
+
}
|
|
1072
|
+
return getClientData;
|
|
1073
|
+
} catch ( error ) {
|
|
1074
|
+
logger.error( { error: error, message: data, function: 'getClientConfig' } );
|
|
1075
|
+
return false;
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
|
|
1080
|
+
// New Api for shilla
|
|
1081
|
+
export const getZoneGroupAnalysis = async ( req, res ) => {
|
|
1082
|
+
try {
|
|
1083
|
+
let reqestData = req.body;
|
|
1084
|
+
let LamdaURL = 'https://vngwgn2actalutntl4ilv6elqm0pnhib.lambda-url.ap-south-1.on.aws/';
|
|
1085
|
+
let resultData = await LamdaServiceCall( LamdaURL, reqestData );
|
|
1086
|
+
if ( resultData ) {
|
|
1087
|
+
if ( resultData.status_code == '200' ) {
|
|
1088
|
+
return res.sendSuccess( resultData );
|
|
1089
|
+
} else {
|
|
1090
|
+
return res.sendError( 'No Content', 204 );
|
|
1091
|
+
}
|
|
1092
|
+
} else {
|
|
1093
|
+
return res.sendError( 'No Content', 204 );
|
|
1094
|
+
}
|
|
1095
|
+
} catch ( error ) {
|
|
1096
|
+
logger.error( { error: error, message: req.query, function: 'getZoneGroupAnalysis' } );
|
|
1097
|
+
return res.sendError( { error: error }, 500 );
|
|
1098
|
+
}
|
|
1099
|
+
};
|
|
1100
|
+
|
|
1101
|
+
|
|
1102
|
+
export const getViewInsightsV1 = async ( req, res ) => {
|
|
1103
|
+
try {
|
|
1104
|
+
let reqestData = req.body;
|
|
1105
|
+
let LamdaURL = 'https://f65azvtljclaxp6l7rnx65cdmm0lcgvp.lambda-url.ap-south-1.on.aws/';
|
|
1106
|
+
let resultData = await LamdaServiceCall( LamdaURL, reqestData );
|
|
1107
|
+
if ( resultData ) {
|
|
1108
|
+
if ( resultData.status_code == '200' ) {
|
|
1109
|
+
return res.sendSuccess( resultData );
|
|
1110
|
+
} else {
|
|
1111
|
+
return res.sendError( 'No Content', 204 );
|
|
1112
|
+
}
|
|
1113
|
+
} else {
|
|
1114
|
+
return res.sendError( 'No Content', 204 );
|
|
1115
|
+
}
|
|
1116
|
+
} catch ( error ) {
|
|
1117
|
+
logger.error( { error: error, message: req.query, function: 'getViewInsightsV1' } );
|
|
1118
|
+
return res.sendError( { error: error }, 500 );
|
|
1119
|
+
}
|
|
1120
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { logger,
|
|
1
|
+
import { logger, downloadint } from 'tango-app-api-middleware';
|
|
2
2
|
import { findOneUserAssignedStore } from '../services/userAssignedStore.service.js';
|
|
3
3
|
|
|
4
4
|
// Lamda Service Call //
|
|
@@ -89,7 +89,7 @@ export const zoneSummaryTableV2 = async ( req, res ) => {
|
|
|
89
89
|
try {
|
|
90
90
|
let reqestData = req.body;
|
|
91
91
|
if ( reqestData.export ) {
|
|
92
|
-
reqestData.limit =
|
|
92
|
+
reqestData.limit = 10000;
|
|
93
93
|
}
|
|
94
94
|
let LamdaURL = 'https://obtvnopiiuwlsrjygprlvjp2p40wokyd.lambda-url.ap-south-1.on.aws/';
|
|
95
95
|
let resultData = await LamdaServiceCall( LamdaURL, reqestData );
|
|
@@ -104,7 +104,7 @@ export const zoneSummaryTableV2 = async ( req, res ) => {
|
|
|
104
104
|
'StoreId': element.storeId,
|
|
105
105
|
'Date': element.date,
|
|
106
106
|
'Zone Name': element.zoneName,
|
|
107
|
-
'
|
|
107
|
+
'Impression Rate': element.impressionRate,
|
|
108
108
|
'Avg Dwell Time': element.avgDwellTime,
|
|
109
109
|
'Zone FF': element.footfallCount,
|
|
110
110
|
'Zone Bounced': element.bouncedCount,
|
|
@@ -119,7 +119,7 @@ export const zoneSummaryTableV2 = async ( req, res ) => {
|
|
|
119
119
|
'Female': element.femaleCount,
|
|
120
120
|
} );
|
|
121
121
|
} );
|
|
122
|
-
return await
|
|
122
|
+
return await downloadint( exportdata, res );
|
|
123
123
|
} else {
|
|
124
124
|
return res.sendError( 'No Content', 204 );
|
|
125
125
|
}
|
|
@@ -346,6 +346,26 @@ export const customerJourneyTableV2 = async ( req, res ) => {
|
|
|
346
346
|
}
|
|
347
347
|
};
|
|
348
348
|
|
|
349
|
+
export const sankychartV2 = async ( req, res ) => {
|
|
350
|
+
try {
|
|
351
|
+
let reqestData = req.body;
|
|
352
|
+
let LamdaURL = 'https://35np436xn3emlfrs56qrhmjymu0rbxem.lambda-url.ap-south-1.on.aws/';
|
|
353
|
+
let resultData = await LamdaServiceCall( LamdaURL, reqestData );
|
|
354
|
+
if ( resultData ) {
|
|
355
|
+
if ( resultData.status_code == '200' ) {
|
|
356
|
+
return res.sendSuccess( resultData );
|
|
357
|
+
} else {
|
|
358
|
+
return res.sendError( 'No Content', 204 );
|
|
359
|
+
}
|
|
360
|
+
} else {
|
|
361
|
+
return res.sendError( 'No Content', 204 );
|
|
362
|
+
}
|
|
363
|
+
} catch ( error ) {
|
|
364
|
+
logger.error( { error: error, message: req.query, function: 'sankychartV2' } );
|
|
365
|
+
return res.sendError( { error: error }, 500 );
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
|
|
349
369
|
export async function isAllowedClient( req, res, next ) {
|
|
350
370
|
try {
|
|
351
371
|
let reqestData = req.body;
|
|
@@ -47,6 +47,7 @@ export const validateZoneSummaryTableSchema = joi.object( {
|
|
|
47
47
|
limit: joi.number().required(),
|
|
48
48
|
offset: joi.number().required(),
|
|
49
49
|
export: joi.boolean().required(),
|
|
50
|
+
nob: joi.boolean().optional().allow( '' ),
|
|
50
51
|
} );
|
|
51
52
|
|
|
52
53
|
export const validateZoneSummaryTableParams = {
|
|
@@ -67,7 +68,7 @@ export const validateZoneConcentrationSummaryTableParams = {
|
|
|
67
68
|
|
|
68
69
|
export const validateZoneHeatmapAvailableDatesSchema = joi.object( {
|
|
69
70
|
...baseSchema,
|
|
70
|
-
zoneName: joi.
|
|
71
|
+
zoneName: joi.any().required(),
|
|
71
72
|
dateType: joi.string().required(),
|
|
72
73
|
} );
|
|
73
74
|
|
|
@@ -77,7 +78,7 @@ export const validateZoneHeatmapAvailableDatesParams = {
|
|
|
77
78
|
|
|
78
79
|
export const validateZoneHeatmapDatasSchema = joi.object( {
|
|
79
80
|
...baseSchema,
|
|
80
|
-
zoneName: joi.
|
|
81
|
+
zoneName: joi.any().required(),
|
|
81
82
|
dateType: joi.string().required(),
|
|
82
83
|
zoneDate: joi.string().required(),
|
|
83
84
|
} );
|
|
@@ -39,6 +39,17 @@ import {
|
|
|
39
39
|
interactionTable430Export,
|
|
40
40
|
ZonewiseCustomerFunnelV1,
|
|
41
41
|
ZonewiseCustomerFunnelExport,
|
|
42
|
+
getNewZoneFFV2,
|
|
43
|
+
getSelectedZoneFFV2,
|
|
44
|
+
getZoneAPIFFV2,
|
|
45
|
+
getNewHoTColdZoneV1,
|
|
46
|
+
getNewZoneShopperAnalysisV1,
|
|
47
|
+
getNewZoneShopperBubbleChartV1,
|
|
48
|
+
getNewCustomerTravelZoneV1,
|
|
49
|
+
getNewAnalysisZoneV1,
|
|
50
|
+
getOverallStoreCardsV1,
|
|
51
|
+
getZoneGroupAnalysis,
|
|
52
|
+
getViewInsightsV1,
|
|
42
53
|
} from '../controllers/analysisZoneV1.controllers.js';
|
|
43
54
|
|
|
44
55
|
analysisZoneRouter
|
|
@@ -159,6 +170,18 @@ analysisZoneRouter
|
|
|
159
170
|
userType: [ 'tango', 'client' ], access: [
|
|
160
171
|
{ featureName: 'TangoEye', name: 'ZoneTag', permissions: [] },
|
|
161
172
|
],
|
|
162
|
-
} ), validate( validationDtos.validatezoneInteractionTable430ExportParams ), ZonewiseCustomerFunnelExport )
|
|
173
|
+
} ), validate( validationDtos.validatezoneInteractionTable430ExportParams ), ZonewiseCustomerFunnelExport )
|
|
163
174
|
|
|
175
|
+
|
|
176
|
+
.post( '/getNewZoneFF_v2', getNewZoneFFV2 )
|
|
177
|
+
.post( '/getSelectedZoneFF_v2', getSelectedZoneFFV2 )
|
|
178
|
+
.post( '/getZoneAPI_v2', getZoneAPIFFV2 )
|
|
179
|
+
.post( '/getNewHoTColdZone_v1', isAllowedSessionHandler, validate( validationDtos.validateTopPerformingZonesSchema ), getNewHoTColdZoneV1 )
|
|
180
|
+
.post( '/getNewZoneShopperAnalysis_v1', getNewZoneShopperAnalysisV1 )
|
|
181
|
+
.post( '/getNewZoneShopperBubbleChart_v1', isAllowedSessionHandler, validate( validationDtos.validateTopPerformingZonesSchema ), getNewZoneShopperBubbleChartV1 )
|
|
182
|
+
.post( '/getNewCustomerTravelZone_v1', isAllowedSessionHandler, validate( validationDtos.validateTopPerformingZonesSchema ), getNewCustomerTravelZoneV1 )
|
|
183
|
+
.post( '/getNewAnalysisZone_v1', isAllowedSessionHandler, validate( validationDtos.validateTopPerformingZonesSchema ), getNewAnalysisZoneV1 )
|
|
184
|
+
.post( '/getZoneGroupAnalysis_v1', getZoneGroupAnalysis )
|
|
185
|
+
.post( '/getOverallStoreCards_v1', isAllowedSessionHandler, validate( validationDtos.validateTopPerformingZonesSchema ), getOverallStoreCardsV1 )
|
|
186
|
+
.post( '/getViewInsights_v1', getViewInsightsV1 );
|
|
164
187
|
export default analysisZoneRouter;
|
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
trajectoryAnalysisRateV2,
|
|
31
31
|
customerJourneyV2,
|
|
32
32
|
customerJourneyTableV2,
|
|
33
|
+
sankychartV2,
|
|
33
34
|
} from '../controllers/analysisZoneV2.controllers.js';
|
|
34
35
|
|
|
35
36
|
analysisZoneV2Router
|
|
@@ -103,5 +104,6 @@ analysisZoneV2Router
|
|
|
103
104
|
userType: [ 'tango', 'client' ], access: [
|
|
104
105
|
{ featureName: 'TangoEye', name: 'ZoneTag', permissions: [] },
|
|
105
106
|
],
|
|
106
|
-
} ), validate( validationDtos.validateCustomerJourneyTableV2Params ), customerJourneyTableV2 )
|
|
107
|
+
} ), validate( validationDtos.validateCustomerJourneyTableV2Params ), customerJourneyTableV2 )
|
|
108
|
+
.post( '/sankychart_v2', sankychartV2 );
|
|
107
109
|
export default analysisZoneV2Router;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import model from 'tango-api-schema';
|
|
2
|
+
|
|
3
|
+
export const find = ( query = {}, record = {} ) => {
|
|
4
|
+
return model.clientModel.find( query, record );
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export const findOne = ( query = {}, record = {} ) => {
|
|
8
|
+
return model.clientModel.findOne( query, record ).sort( { updatedAt: -1 } );
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const updateOne = ( query = {}, record = {} ) => {
|
|
12
|
+
return model.clientModel.updateOne( query, { $set: record } );
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const aggregate = ( query = [] ) => {
|
|
16
|
+
return model.clientModel.aggregate( query );
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const getClientCount = ( query = {} ) => {
|
|
20
|
+
return model.clientModel.count( query );
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
|