tango-app-api-analysis-traffic 3.8.15 → 3.8.16-dev
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
|
@@ -1415,6 +1415,7 @@ export async function tagTempId( req, res ) {
|
|
|
1415
1415
|
const openSearch = JSON.parse( process.env.OPENSEARCH );
|
|
1416
1416
|
|
|
1417
1417
|
const upsertRecord = {
|
|
1418
|
+
mode: inputData.mode || '',
|
|
1418
1419
|
clientId: inputData.storeId.split( '-' )[0],
|
|
1419
1420
|
storeId: inputData.storeId,
|
|
1420
1421
|
tempId: inputData.tempId,
|
|
@@ -3,7 +3,8 @@ import express from 'express';
|
|
|
3
3
|
import { storeProcessedData, getconfig, revoptagging, getrevoptagging, revoptaggingcount, footFallImages, tagTempId, getCategorizedImages, vmsDataMigration, migrateRevopIndex, expireReviewStatus, expireApproveStatus } from '../controllers/revop.controller.js';
|
|
4
4
|
import { isAllowedSessionHandler, validate } from 'tango-app-api-middleware';
|
|
5
5
|
import { footfallImagesValid, getCategorizedImagesValid, storeProcessedDataValid, tagTempIdValid, vmsDataMigrationValid } from '../dtos/revop.dtos.js';
|
|
6
|
-
import { deleteTaggedDuplicate, getTaggingConfig, mappingConfig } from '../validations/revop.validation.js';
|
|
6
|
+
import { deleteTaggedDuplicate, getTaggingConfig, mappingConfig, validateDateAndFilePath } from '../validations/revop.validation.js';
|
|
7
|
+
|
|
7
8
|
|
|
8
9
|
export const revopRouter = express.Router();
|
|
9
10
|
|
|
@@ -19,7 +20,7 @@ revopRouter
|
|
|
19
20
|
// new enhancement (for footfall directory)
|
|
20
21
|
.get( '/store-processed-data', isAllowedSessionHandler, validate( storeProcessedDataValid ), storeProcessedData )
|
|
21
22
|
.get( '/footfall-images', isAllowedSessionHandler, validate( footfallImagesValid ), getTaggingConfig, footFallImages )
|
|
22
|
-
.post( '/tag-tempId', isAllowedSessionHandler, validate( tagTempIdValid ), mappingConfig, deleteTaggedDuplicate, tagTempId )
|
|
23
|
+
.post( '/tag-tempId', isAllowedSessionHandler, validate( tagTempIdValid ), mappingConfig, deleteTaggedDuplicate, validateDateAndFilePath, tagTempId )
|
|
23
24
|
.post( '/get-categorized-images', isAllowedSessionHandler, validate( getCategorizedImagesValid ), getCategorizedImages )
|
|
24
25
|
.post( '/vms-data-migration', validate( vmsDataMigrationValid ), vmsDataMigration );
|
|
25
26
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import express from 'express';
|
|
2
|
-
import { validate, isAllowedSessionHandler,
|
|
2
|
+
import { validate, isAllowedSessionHandler, getAssinedStore } from 'tango-app-api-middleware';
|
|
3
3
|
import * as validationDtos from '../dtos/validation.dtos.js';
|
|
4
4
|
|
|
5
5
|
export const analysisTrafficRouter = express.Router();
|
|
@@ -117,65 +117,65 @@ analysisTrafficRouter
|
|
|
117
117
|
.post( '/headerLocations', headerLocations )
|
|
118
118
|
.post( '/headerGroups', headerGroups )
|
|
119
119
|
.post( '/headerStores', headerStores )
|
|
120
|
-
.post( '/cardsFunnel_v1', isAllowedSessionHandler,
|
|
121
|
-
.post( '/funnel_v1', isAllowedSessionHandler,
|
|
122
|
-
.post( '/cardsGraphs_v1', isAllowedSessionHandler,
|
|
123
|
-
.post( '/recapVideo_v1', isAllowedSessionHandler,
|
|
124
|
-
.post( '/densityDwell_v1', isAllowedSessionHandler,
|
|
125
|
-
.post( '/overallCards_v1', isAllowedSessionHandler,
|
|
126
|
-
.post( '/overallHourlyChart_v1', isAllowedSessionHandler,
|
|
127
|
-
.post( '/overallChart_v1', isAllowedSessionHandler,
|
|
128
|
-
.post( '/singleStoreChart_v1', isAllowedSessionHandler,
|
|
129
|
-
.post( '/demographicChart_v1', isAllowedSessionHandler,
|
|
130
|
-
.post( '/buyerChart_v1', isAllowedSessionHandler,
|
|
131
|
-
.post( '/footfallDirectoryFolders_v1', isAllowedSessionHandler,
|
|
132
|
-
.post( '/footfallDirectory_v1', isAllowedSessionHandler,
|
|
133
|
-
.post( '/summaryTable_v1', isAllowedSessionHandler,
|
|
134
|
-
.post( '/footfallTrend_v1', isAllowedSessionHandler,
|
|
135
|
-
.post( '/storeOperation_v1', isAllowedSessionHandler,
|
|
136
|
-
.post( '/performanceMatrix_v1', isAllowedSessionHandler,
|
|
137
|
-
.post( '/zoneDwellTimeSplit_v1', isAllowedSessionHandler,
|
|
138
|
-
.post( '/storesMap_v1', isAllowedSessionHandler,
|
|
139
|
-
.post( '/headerLocations_v1', isAllowedSessionHandler,
|
|
140
|
-
.post( '/headerGroups_v1', isAllowedSessionHandler,
|
|
141
|
-
.post( '/headerStores_v1', isAllowedSessionHandler,
|
|
120
|
+
.post( '/cardsFunnel_v1', isAllowedSessionHandler, validate( validationDtos.validateCardFunnelParams ), cardsFunnelV1 )
|
|
121
|
+
.post( '/funnel_v1', isAllowedSessionHandler, validate( validationDtos.validateCardFunnelParams ), funnelV1 )
|
|
122
|
+
.post( '/cardsGraphs_v1', isAllowedSessionHandler, validate( validationDtos.validateCardGraphParams ), cardsGraphsV1 )
|
|
123
|
+
.post( '/recapVideo_v1', isAllowedSessionHandler, validate( validationDtos.validateRecapVideoParams ), recapVideoV1 )
|
|
124
|
+
.post( '/densityDwell_v1', isAllowedSessionHandler, validate( validationDtos.validateDensityDwellParams ), densityDwellV1 )
|
|
125
|
+
.post( '/overallCards_v1', isAllowedSessionHandler, validate( validationDtos.validateOverallCharParams ), overallCardsV1 )
|
|
126
|
+
.post( '/overallHourlyChart_v1', isAllowedSessionHandler, validate( validationDtos.validateOverallCharParams ), overallHourlyChartV1 )
|
|
127
|
+
.post( '/overallChart_v1', isAllowedSessionHandler, validate( validationDtos.validateOverallCharParams ), overallChartV1 )
|
|
128
|
+
.post( '/singleStoreChart_v1', isAllowedSessionHandler, validate( validationDtos.validateSingleStoreChartParams ), singleStoreChartV1 )
|
|
129
|
+
.post( '/demographicChart_v1', isAllowedSessionHandler, validate( validationDtos.validateDemographicChartParams ), demographicChartV1 )
|
|
130
|
+
.post( '/buyerChart_v1', isAllowedSessionHandler, validate( validationDtos.validateBuyerChartParams ), buyerChartV1 )
|
|
131
|
+
.post( '/footfallDirectoryFolders_v1', isAllowedSessionHandler, validate( validationDtos.validateFootfallDirectoryFoldersParams ), footfallDirectoryFoldersV1 )
|
|
132
|
+
.post( '/footfallDirectory_v1', isAllowedSessionHandler, validate( validationDtos.validateFootfallDirectoryParams ), footfallDirectoryV1 )
|
|
133
|
+
.post( '/summaryTable_v1', isAllowedSessionHandler, validate( validationDtos.validateSummaryTableParams ), summaryTableV1 )
|
|
134
|
+
.post( '/footfallTrend_v1', isAllowedSessionHandler, validate( validationDtos.validateFootfallTrendParams ), footfallTrendV1 )
|
|
135
|
+
.post( '/storeOperation_v1', isAllowedSessionHandler, validate( validationDtos.validateStoreOperationParams ), storeOperationV1 )
|
|
136
|
+
.post( '/performanceMatrix_v1', isAllowedSessionHandler, validate( validationDtos.validateperformanceMatrixParams ), performanceMatrixV1 )
|
|
137
|
+
.post( '/zoneDwellTimeSplit_v1', isAllowedSessionHandler, validate( validationDtos.validateStoreOperationParams ), zoneDwellTimeSplitV1 )
|
|
138
|
+
.post( '/storesMap_v1', isAllowedSessionHandler, validate( validationDtos.validateStoresMapParams ), storesMapV1 )
|
|
139
|
+
.post( '/headerLocations_v1', isAllowedSessionHandler, validate( validationDtos.validateHeaderParams ), headerLocationsV1 )
|
|
140
|
+
.post( '/headerGroups_v1', isAllowedSessionHandler, validate( validationDtos.validateHeaderParams ), headerGroupsV1 )
|
|
141
|
+
.post( '/headerStores_v1', isAllowedSessionHandler, validate( validationDtos.validateHeaderParams ), headerStoresV1 )
|
|
142
142
|
.post( '/getMySubscription', isAllowedSessionHandler, validate( validationDtos.getMyProductParams ), getMySubscription )
|
|
143
143
|
.post( '/getStoreMapData_v1', isAllowedSessionHandler, validate( validationDtos.getStoreCameraImageParams ), getStoreMapData )
|
|
144
144
|
.post( '/getStoreMapData', isAllowedSessionHandler, validate( validationDtos.getStoreCameraImageParams ), getStoreMapDataV3 )
|
|
145
|
-
.post( '/headerStores_v2', isAllowedSessionHandler,
|
|
146
|
-
.post( '/headercluster_v2', isAllowedSessionHandler,
|
|
147
|
-
.post( '/headerLocations_v2', isAllowedSessionHandler,
|
|
148
|
-
.post( '/cardsFunnel_v3', isAllowedSessionHandler,
|
|
149
|
-
.post( '/footfallCards_v3', isAllowedSessionHandler,
|
|
150
|
-
.post( '/conversionCards_v3', isAllowedSessionHandler,
|
|
151
|
-
.post( '/bouncedCards_v3', isAllowedSessionHandler,
|
|
152
|
-
.post( '/engagersCards_v3', isAllowedSessionHandler,
|
|
153
|
-
.post( '/missedOpportunityCards_v3', isAllowedSessionHandler,
|
|
154
|
-
.post( '/potentialBuyersCards_v3', isAllowedSessionHandler,
|
|
155
|
-
.post( '/potentialBuyersDistributionCards_v3', isAllowedSessionHandler,
|
|
156
|
-
.post( '/funnel_v3', isAllowedSessionHandler,
|
|
157
|
-
.post( '/cardsGraphs_v3', isAllowedSessionHandler,
|
|
158
|
-
.post( '/recapVideo_v3', isAllowedSessionHandler,
|
|
159
|
-
.post( '/densityDwell_v3', isAllowedSessionHandler,
|
|
160
|
-
.post( '/trafficDensityDwell_v3', isAllowedSessionHandler,
|
|
161
|
-
.post( '/overallCards_v3', isAllowedSessionHandler,
|
|
162
|
-
.post( '/overallHourlyChart_v3', isAllowedSessionHandler,
|
|
163
|
-
.post( '/overallChart_v3', isAllowedSessionHandler,
|
|
164
|
-
.post( '/singleStoreChart_v3', isAllowedSessionHandler,
|
|
165
|
-
.post( '/demographicChart_v3', isAllowedSessionHandler,
|
|
166
|
-
.post( '/buyerChart_v3', isAllowedSessionHandler,
|
|
167
|
-
.post( '/footfallDirectoryFolders_v3', isAllowedSessionHandler,
|
|
168
|
-
.post( '/footfallDirectory_v3', isAllowedSessionHandler,
|
|
169
|
-
.post( '/summaryTable_v3', isAllowedSessionHandler,
|
|
170
|
-
.post( '/footfallTrend_v3', isAllowedSessionHandler,
|
|
171
|
-
.post( '/storeOperation_v3', isAllowedSessionHandler,
|
|
172
|
-
.post( '/performanceMatrix_v3', isAllowedSessionHandler,
|
|
173
|
-
.post( '/zoneDwellTimeSplit_v3', isAllowedSessionHandler,
|
|
174
|
-
.post( '/storesMap_v1', isAllowedSessionHandler,
|
|
145
|
+
.post( '/headerStores_v2', isAllowedSessionHandler, validate( validationDtos.validateHeaderParamsv2 ), getAssinedStore, headerStoresV2 )
|
|
146
|
+
.post( '/headercluster_v2', isAllowedSessionHandler, validate( validationDtos.validateHeaderParams ), getAssinedStore, headerClustersV2 )
|
|
147
|
+
.post( '/headerLocations_v2', isAllowedSessionHandler, validate( validationDtos.validateHeaderParams ), getAssinedStore, headerLocationsV2 )
|
|
148
|
+
.post( '/cardsFunnel_v3', isAllowedSessionHandler, validate( validationDtos.validateCardFunnelParams ), cardsFunnelV3 )
|
|
149
|
+
.post( '/footfallCards_v3', isAllowedSessionHandler, validate( validationDtos.validateCardFunnelParams ), footfallCardsV3 )
|
|
150
|
+
.post( '/conversionCards_v3', isAllowedSessionHandler, validate( validationDtos.validateCardFunnelParams ), conversionCardsV3 )
|
|
151
|
+
.post( '/bouncedCards_v3', isAllowedSessionHandler, validate( validationDtos.validateCardFunnelParams ), bouncedCardsV3 )
|
|
152
|
+
.post( '/engagersCards_v3', isAllowedSessionHandler, validate( validationDtos.validateCardFunnelParams ), engagersCardsV3 )
|
|
153
|
+
.post( '/missedOpportunityCards_v3', isAllowedSessionHandler, validate( validationDtos.validateCardFunnelParams ), missedOpportunityCardsV3 )
|
|
154
|
+
.post( '/potentialBuyersCards_v3', isAllowedSessionHandler, validate( validationDtos.validateCardFunnelParams ), potentialBuyersCardsV3 )
|
|
155
|
+
.post( '/potentialBuyersDistributionCards_v3', isAllowedSessionHandler, validate( validationDtos.validateCardFunnelParams ), potentialBuyersDistributionCardsV3 )
|
|
156
|
+
.post( '/funnel_v3', isAllowedSessionHandler, validate( validationDtos.validateCardFunnelParams ), funnelV3 )
|
|
157
|
+
.post( '/cardsGraphs_v3', isAllowedSessionHandler, validate( validationDtos.validateCardGraphParams ), cardsGraphsV3 )
|
|
158
|
+
.post( '/recapVideo_v3', isAllowedSessionHandler, validate( validationDtos.validateRecapVideoParams ), recapVideoV3 )
|
|
159
|
+
.post( '/densityDwell_v3', isAllowedSessionHandler, validate( validationDtos.validateDensityDwellParams ), densityDwellV3 )
|
|
160
|
+
.post( '/trafficDensityDwell_v3', isAllowedSessionHandler, validate( validationDtos.validateDensityDwellParams ), trafficDensityDwellV3 )
|
|
161
|
+
.post( '/overallCards_v3', isAllowedSessionHandler, validate( validationDtos.validateOverallCharParams ), overallCardsV3 )
|
|
162
|
+
.post( '/overallHourlyChart_v3', isAllowedSessionHandler, validate( validationDtos.validateOverallHourlyCharParams ), overallHourlyChartV3 )
|
|
163
|
+
.post( '/overallChart_v3', isAllowedSessionHandler, validate( validationDtos.validateOverallCharParams ), overallChartV3 )
|
|
164
|
+
.post( '/singleStoreChart_v3', isAllowedSessionHandler, validate( validationDtos.validateSingleStoreChartParams ), singleStoreChartV3 )
|
|
165
|
+
.post( '/demographicChart_v3', isAllowedSessionHandler, validate( validationDtos.validateDemographicChartParams ), demographicChartV3 )
|
|
166
|
+
.post( '/buyerChart_v3', isAllowedSessionHandler, validate( validationDtos.validateBuyerChartParams ), buyerChartV3 )
|
|
167
|
+
.post( '/footfallDirectoryFolders_v3', isAllowedSessionHandler, validate( validationDtos.validateFootfallDirectoryFoldersParams ), footfallDirectoryFoldersV3 )
|
|
168
|
+
.post( '/footfallDirectory_v3', isAllowedSessionHandler, validate( validationDtos.validateFootfallDirectoryParams ), footfallDirectoryV3 )
|
|
169
|
+
.post( '/summaryTable_v3', isAllowedSessionHandler, validate( validationDtos.validateSummaryTableParams ), summaryTableV3 )
|
|
170
|
+
.post( '/footfallTrend_v3', isAllowedSessionHandler, validate( validationDtos.validateFootfallTrendParams ), footfallTrendV3 )
|
|
171
|
+
.post( '/storeOperation_v3', isAllowedSessionHandler, validate( validationDtos.validateStoreOperationParams ), storeOperationV3 )
|
|
172
|
+
.post( '/performanceMatrix_v3', isAllowedSessionHandler, validate( validationDtos.validateperformanceMatrixParams ), performanceMatrixV3 )
|
|
173
|
+
.post( '/zoneDwellTimeSplit_v3', isAllowedSessionHandler, validate( validationDtos.validateStoreOperationParams ), zoneDwellTimeSplitV3 )
|
|
174
|
+
.post( '/storesMap_v1', isAllowedSessionHandler, validate( validationDtos.validateStoresMapParams ), storesMapV1 )
|
|
175
175
|
.post( '/headerUserEmails_v2', isAllowedSessionHandler, getUserEmails )
|
|
176
|
-
.post( '/headerCountry_v2', isAllowedSessionHandler,
|
|
176
|
+
.post( '/headerCountry_v2', isAllowedSessionHandler, validate( validationDtos.validateCountryHeaderParamsv2 ), getAssinedStore, headerCountryV2 )
|
|
177
177
|
.post( '/checkTodayReportStatus', isAllowedSessionHandler, checkTodayReportStatus )
|
|
178
178
|
.post( '/headerZoneV2', isAllowedSessionHandler, headerZoneV2 )
|
|
179
179
|
.post( '/trafficDensityExport_v2', managerTrafficDensityExport )
|
|
180
|
-
.post( '/get-store-list-v2', isAllowedSessionHandler,
|
|
180
|
+
.post( '/get-store-list-v2', isAllowedSessionHandler, validate( validationDtos.validateGetStoreList ), getStoreListv2 );
|
|
181
181
|
export default analysisTrafficRouter;
|
|
@@ -366,3 +366,38 @@ export async function deleteTaggedDuplicate( req, res, next ) {
|
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
368
|
|
|
369
|
+
|
|
370
|
+
export async function validateDateAndFilePath( req, res, next ) {
|
|
371
|
+
try {
|
|
372
|
+
const inputData = req.body;
|
|
373
|
+
const getDateString = inputData?.dateString;
|
|
374
|
+
const dateString = getDateString ?
|
|
375
|
+
getDateString.split( '-' ).reverse().join( '-' ) :
|
|
376
|
+
'';
|
|
377
|
+
const filePath = inputData?.filePath;
|
|
378
|
+
|
|
379
|
+
if ( !dateString ) {
|
|
380
|
+
return res.sendError( 'Missing payload field: dateString', 400 );
|
|
381
|
+
}
|
|
382
|
+
if ( !filePath ) {
|
|
383
|
+
return res.sendError( 'Missing payload field: filePath', 400 );
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
// Based on requirement: match payload dateString with filePath.split[1]
|
|
387
|
+
// Example: 11-1001/06-05-2026/5_customer_entry_frame.jpeg
|
|
388
|
+
// split('/') => [ '11-1001', '06-05-2026', '5_customer_entry_frame.jpeg' ] => index 1 is '06-05-2026'
|
|
389
|
+
const parts = String( filePath ).split( '/' );
|
|
390
|
+
const pathDateString = parts?.[1];
|
|
391
|
+
|
|
392
|
+
if ( dateString !== pathDateString ) {
|
|
393
|
+
return res.sendError( `Invalid payload: Image Date Mismatch `, 400 );
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
next();
|
|
397
|
+
} catch ( error ) {
|
|
398
|
+
logger.error( { error: error, message: req.body, function: 'traffic-revop-validateDateAndFilePath' } );
|
|
399
|
+
return res.sendError( error.message || 'Error validating date and filePath', 400 );
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
|