tango-app-api-analysis-traffic 3.8.15-alpha.0 → 3.8.15
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,7 +1415,6 @@ 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 || '',
|
|
1419
1418
|
clientId: inputData.storeId.split( '-' )[0],
|
|
1420
1419
|
storeId: inputData.storeId,
|
|
1421
1420
|
tempId: inputData.tempId,
|
|
@@ -89,6 +89,16 @@ export const validateOverallCharParams = {
|
|
|
89
89
|
body: validateOverallCharSchema,
|
|
90
90
|
};
|
|
91
91
|
|
|
92
|
+
// Same as validateOverallCharSchema, plus an optional hourFormat key used only by overallHourlyChart_v3
|
|
93
|
+
export const validateOverallHourlyCharSchema = validateOverallCharSchema.keys( {
|
|
94
|
+
hourBucket: joi.number().optional(),
|
|
95
|
+
} );
|
|
96
|
+
|
|
97
|
+
export const validateOverallHourlyCharParams = {
|
|
98
|
+
body: validateOverallHourlyCharSchema,
|
|
99
|
+
...validateOverallCharSchema,
|
|
100
|
+
};
|
|
101
|
+
|
|
92
102
|
export const validateSingleStoreChartSchema = joi.object( {
|
|
93
103
|
...baseSchema,
|
|
94
104
|
limit: joi.number().required(),
|
|
@@ -3,8 +3,7 @@ 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
|
|
7
|
-
|
|
6
|
+
import { deleteTaggedDuplicate, getTaggingConfig, mappingConfig } from '../validations/revop.validation.js';
|
|
8
7
|
|
|
9
8
|
export const revopRouter = express.Router();
|
|
10
9
|
|
|
@@ -20,7 +19,7 @@ revopRouter
|
|
|
20
19
|
// new enhancement (for footfall directory)
|
|
21
20
|
.get( '/store-processed-data', isAllowedSessionHandler, validate( storeProcessedDataValid ), storeProcessedData )
|
|
22
21
|
.get( '/footfall-images', isAllowedSessionHandler, validate( footfallImagesValid ), getTaggingConfig, footFallImages )
|
|
23
|
-
.post( '/tag-tempId', isAllowedSessionHandler, validate( tagTempIdValid ), mappingConfig, deleteTaggedDuplicate,
|
|
22
|
+
.post( '/tag-tempId', isAllowedSessionHandler, validate( tagTempIdValid ), mappingConfig, deleteTaggedDuplicate, tagTempId )
|
|
24
23
|
.post( '/get-categorized-images', isAllowedSessionHandler, validate( getCategorizedImagesValid ), getCategorizedImages )
|
|
25
24
|
.post( '/vms-data-migration', validate( vmsDataMigrationValid ), vmsDataMigration );
|
|
26
25
|
|
|
@@ -159,7 +159,7 @@ analysisTrafficRouter
|
|
|
159
159
|
.post( '/densityDwell_v3', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateDensityDwellParams ), densityDwellV3 )
|
|
160
160
|
.post( '/trafficDensityDwell_v3', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateDensityDwellParams ), trafficDensityDwellV3 )
|
|
161
161
|
.post( '/overallCards_v3', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateOverallCharParams ), overallCardsV3 )
|
|
162
|
-
.post( '/overallHourlyChart_v3', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.
|
|
162
|
+
.post( '/overallHourlyChart_v3', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateOverallHourlyCharParams ), overallHourlyChartV3 )
|
|
163
163
|
.post( '/overallChart_v3', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateOverallCharParams ), overallChartV3 )
|
|
164
164
|
.post( '/singleStoreChart_v3', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateSingleStoreChartParams ), singleStoreChartV3 )
|
|
165
165
|
.post( '/demographicChart_v3', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateDemographicChartParams ), demographicChartV3 )
|
|
@@ -366,38 +366,3 @@ 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
|
-
|