tango-app-api-analysis-traffic 3.8.15 → 3.8.16
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
|
|
|
@@ -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
|
+
|