tango-app-api-analysis-traffic 3.8.7-vms.14 → 3.8.7-vms.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-app-api-analysis-traffic",
3
- "version": "3.8.7-vms.14",
3
+ "version": "3.8.7-vms.16",
4
4
  "description": "Traffic Analysis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -434,7 +434,7 @@ export async function footFallImages( req, res ) {
434
434
  if ( req.user.userType !== 'tango' && req.user.role !== 'superadmin' ) {
435
435
  switch ( req.user.role ) {
436
436
  case 'user':
437
- const actionTypesUser = [ 'tagging', 'finalreview' ];
437
+ const actionTypesUser = [ 'tagging', 'finalRevision' ];
438
438
 
439
439
  temp = [];
440
440
  actionTypesUser.forEach( ( type ) => {
@@ -458,7 +458,7 @@ export async function footFallImages( req, res ) {
458
458
  createdByRole: mapping.createdByRole ?? '',
459
459
  isUp: false,
460
460
  } );
461
- } else if ( type !== 'tagging' && mapping.status === 'closed' ) {
461
+ } else if ( type !== 'tagging' && mapping.status === 'Closed' ) {
462
462
  const revisedFootfall = mapping.revicedFootfall ?? 0;
463
463
  const revisedPerc =
464
464
  footfallValue > 0 ?
@@ -480,7 +480,7 @@ export async function footFallImages( req, res ) {
480
480
  } );
481
481
  break;
482
482
  case 'admin':
483
- const actionTypesAdmin = [ 'tagging', 'review', 'finalreview' ];
483
+ const actionTypesAdmin = [ 'tagging', 'review', 'finalRevision' ];
484
484
  temp = [];
485
485
  actionTypesAdmin.forEach( ( type ) => {
486
486
  const mapping = getMappingForType( type );
@@ -503,7 +503,7 @@ export async function footFallImages( req, res ) {
503
503
  createdByRole: mapping.createdByRole ?? '',
504
504
  isUp: false,
505
505
  } );
506
- } else if ( type !== 'tagging' && mapping.status === 'closed' ) {
506
+ } else if ( type !== 'tagging' && mapping.status === 'Closed' ) {
507
507
  const revisedFootfall = mapping.revicedFootfall ?? 0;
508
508
  const revisedPerc =
509
509
  footfallValue > 0 ?
@@ -525,7 +525,7 @@ export async function footFallImages( req, res ) {
525
525
  } );
526
526
  }
527
527
  } else {
528
- const actionTypes = [ 'tagging', 'review', 'approve', 'finalreview' ];
528
+ const actionTypes = [ 'tagging', 'review', 'approve', 'tangoreview', 'finalRevision' ];
529
529
 
530
530
  // Dynamically add to temp only if actionType matches and status is 'closed',
531
531
  // except for 'tagging' where status must be 'raised'
@@ -551,7 +551,7 @@ export async function footFallImages( req, res ) {
551
551
  createdByRole: mapping.createdByRole ?? '',
552
552
  isUp: false,
553
553
  } );
554
- } else if ( type !== 'tagging' && mapping.status === 'closed' ) {
554
+ } else if ( type !== 'tagging' && mapping.status === 'Closed' ) {
555
555
  const revisedFootfall = mapping.revicedFootfall ?? 0;
556
556
  const revisedPerc =
557
557
  footfallValue > 0 ?
@@ -3129,29 +3129,30 @@ export const managerTrafficDensityExport = async ( req, res ) => {
3129
3129
  }
3130
3130
  };
3131
3131
 
3132
- // async function getGeocodedAddress( lat, lng ) {
3133
- // try {
3134
- // const apiKey = 'AIzaSyDlOezgwQO0JviD0aizrCuN1FY9tcWfR3o'; // Use this if you're using dotenv
3135
- // const url = `https://maps.googleapis.com/maps/api/geocode/json?latlng=${lat},${lng}&key=${apiKey}`;
3136
-
3137
- // const requestOptions = {
3138
- // method: 'GET',
3139
- // headers: {
3140
- // 'Content-Type': 'application/json',
3141
- // },
3142
- // };
3143
- // const response = await fetch( url, requestOptions );
3144
- // console.log( 'response =>', response );
3145
- // if ( !response.ok ) {
3146
- // throw new Error( `Response status: ${response.status}` );
3147
- // return false;
3148
- // }
3149
- // const json = await response.json();
3150
- // return json;
3151
- // } catch ( error ) {
3152
- // console.log( 'getGeocodedAddress error =>', error );
3153
- // logger.error( { error: error, message: data, function: 'getGeocodedAddress' } );
3154
- // }
3155
- // }
3156
- // let getGEO = await getGeocodedAddress( 12.900260100404893, 80.23384232089138 );
3157
- // console.log( 'getGEO =>', getGEO );
3132
+
3133
+ export const getStoreListv2 = async ( req, res ) => {
3134
+ try {
3135
+ let reqestData = req.body;
3136
+ let getClientData = await getClientConfig( reqestData.clientId );
3137
+ if ( !getClientData ) {
3138
+ return res.sendError( 'Invalid Client Id', 400 );
3139
+ }
3140
+ reqestData.featureConfigs = getClientData.featureConfigs;
3141
+ let LamdaURL = 'https://nmnnlq3ie65bljcvxauhxmsrpa0edhfa.lambda-url.ap-south-1.on.aws/';
3142
+ let resultData = await LamdaServiceCall( LamdaURL, reqestData );
3143
+ if ( resultData ) {
3144
+ if ( resultData.status_code == '200' ) {
3145
+ return res.sendSuccess( resultData );
3146
+ } else {
3147
+ return res.sendError( 'No Content', 204 );
3148
+ }
3149
+ } else {
3150
+ return res.sendError( 'No Content', 204 );
3151
+ }
3152
+ } catch ( error ) {
3153
+ const err = error.message || 'Internal Server Error';
3154
+ logger.error( { error: error, message: req.body, function: 'getStoreListv2' } );
3155
+ return res.sendError( err, 500 );
3156
+ }
3157
+ };
3158
+
@@ -239,6 +239,17 @@ export const validateCountryHeaderSchemav2 = joi.object( {
239
239
  export const validateCountryHeaderParamsv2 = {
240
240
  body: validateCountryHeaderSchemav2,
241
241
  };
242
+
243
+ export const validateGetStoreListSchemav2 = joi.object( {
244
+ clientId: joi.string().required(),
245
+ storeId: joi.array().items( joi.string().required() ).required(),
246
+ downtime: joi.array().items( joi.string().required() ).required(),
247
+ fromDate: joi.string().required(),
248
+ toDate: joi.string().required(),
249
+ } );
250
+ export const validateGetStoreList = {
251
+ body: validateGetStoreListSchemav2,
252
+ };
242
253
  export const getMyProductSchema = joi.object( {
243
254
  clientId: joi.string().required(),
244
255
  storeId: joi.array().optional().empty(),
@@ -92,6 +92,7 @@ import {
92
92
  funnelV3,
93
93
  getStoreMapDataV3,
94
94
  managerTrafficDensityExport,
95
+ getStoreListv2,
95
96
  } from '../controllers/tangoTrafficV3.controllers.js';
96
97
  analysisTrafficRouter
97
98
  .get( '/welcome', welcome )
@@ -175,5 +176,6 @@ analysisTrafficRouter
175
176
  .post( '/headerCountry_v2', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateCountryHeaderParamsv2 ), getAssinedStore, headerCountryV2 )
176
177
  .post( '/checkTodayReportStatus', isAllowedSessionHandler, checkTodayReportStatus )
177
178
  .post( '/headerZoneV2', isAllowedSessionHandler, headerZoneV2 )
178
- .post( '/trafficDensityExport_v2', managerTrafficDensityExport );
179
+ .post( '/trafficDensityExport_v2', managerTrafficDensityExport )
180
+ .post( '/get-store-list-v2', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateGetStoreList ), getStoreListv2 );
179
181
  export default analysisTrafficRouter;