tango-app-api-analysis-traffic 3.0.0-alpha.4 → 3.0.0-alpha.5

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.0.0-alpha.4",
3
+ "version": "3.0.0-alpha.5",
4
4
  "description": "Traffic Analysis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1677,7 +1677,6 @@ export const footfallTrend = async ( req, res ) => {
1677
1677
  }
1678
1678
  };
1679
1679
 
1680
-
1681
1680
  export const storesMap = async ( req, res ) => {
1682
1681
  try {
1683
1682
  let reqestData = req.body;
@@ -1752,11 +1751,27 @@ export const performanceMatrix = async ( req, res ) => {
1752
1751
  }
1753
1752
 
1754
1753
  let result = {
1755
- 'downTime': 22,
1756
- 'health': 'GOOD',
1757
- 'recapVideoData': [
1758
- { 'thumbImage': 'https://123', 'videoURL': 'https://123' },
1759
- { 'thumbImage': 'https://123', 'videoURL': 'https://123' },
1754
+ 'performanceData': [
1755
+ {
1756
+ 'storeId': '11-1',
1757
+ 'storeName': 'Lositon',
1758
+ 'avgFootfall': 50,
1759
+ 'avgOpenTime': '10:31 AM',
1760
+ 'avgCloseTime': '10:31 PM',
1761
+ 'top': '40%',
1762
+ 'left': '45%',
1763
+ 'position': 'High_High',
1764
+ },
1765
+ {
1766
+ 'storeId': '11-2',
1767
+ 'storeName': 'Lositon-1',
1768
+ 'avgFootfall': 50,
1769
+ 'avgOpenTime': '10:31 AM',
1770
+ 'avgCloseTime': '10:31 PM',
1771
+ 'top': '40%',
1772
+ 'left': '45%',
1773
+ 'position': 'High_Low',
1774
+ },
1760
1775
  ],
1761
1776
  };
1762
1777
  return res.sendSuccess( result );
@@ -336,6 +336,26 @@ export const storeOperationV1 = async ( req, res ) => {
336
336
  }
337
337
  };
338
338
 
339
+ export const performanceMatrixV1 = async ( req, res ) => {
340
+ try {
341
+ let reqestData = req.body;
342
+ let LamdaURL = 'https://5l3pjpivqpyboludmbridailpu0axrov.lambda-url.ap-south-1.on.aws/';
343
+ let resultData = await LamdaServiceCall( LamdaURL, reqestData );
344
+ if ( resultData ) {
345
+ if ( resultData.status_code == '200' ) {
346
+ return res.sendSuccess( resultData );
347
+ } else {
348
+ return res.sendError( 'No Content', 204 );
349
+ }
350
+ } else {
351
+ return res.sendError( 'No Content', 204 );
352
+ }
353
+ } catch ( error ) {
354
+ logger.error( { error: error, message: req.query, function: 'performanceMatrixV1' } );
355
+ return res.sendError( { error: error }, 500 );
356
+ }
357
+ };
358
+
339
359
  export const storesMapV1 = async ( req, res ) => {
340
360
  try {
341
361
  let reqestData = req.body;
@@ -135,9 +135,9 @@ export const validateFootfallDirectoryParams = {
135
135
  export const validateSummaryTableSchema = joi.object( {
136
136
  ...baseSchema,
137
137
  valueType: joi.string().required(),
138
- search: joi.string().optional(),
139
- sortBy: joi.number().optional(),
140
- sort: joi.string().optional(),
138
+ search: joi.string().optional().allow( '' ),
139
+ sortBy: joi.number().optional().allow( '' ),
140
+ sort: joi.string().optional().allow( '' ),
141
141
  limit: joi.number().required(),
142
142
  offset: joi.number().required(),
143
143
  } );
@@ -148,11 +148,14 @@ export const validateSummaryTableParams = {
148
148
 
149
149
  export const validateFootfallTrendSchema = joi.object( {
150
150
  ...baseSchema,
151
+ dateType: joi.string().required(),
151
152
  filterBy: joi.string().required(),
152
153
  processType: joi.string().required(),
153
154
  forecast: joi.boolean().optional(),
154
155
  limit: joi.number().required(),
155
156
  offset: joi.number().required(),
157
+ sortBy: joi.number().optional().allow( '' ),
158
+ sort: joi.string().optional().allow( '' ),
156
159
  } );
157
160
 
158
161
  export const validateFootfallTrendParams = {
@@ -177,6 +180,16 @@ export const validateStoresMapParams = {
177
180
  body: validateStoresMapSchema,
178
181
  };
179
182
 
183
+ export const validateperformanceMatrixSchema = joi.object( {
184
+ ...baseSchema,
185
+ processtype1: joi.string().required(),
186
+ processtype2: joi.string().required(),
187
+ } );
188
+
189
+ export const validateperformanceMatrixParams = {
190
+ body: validateperformanceMatrixSchema,
191
+ };
192
+
180
193
  export const validateHeaderSchema = joi.object( {
181
194
  clientId: joi.string().required(),
182
195
  city: joi.array().required(),
@@ -45,6 +45,7 @@ import {
45
45
  summaryTableV1,
46
46
  footfallTrendV1,
47
47
  storeOperationV1,
48
+ performanceMatrixV1,
48
49
  storesMapV1,
49
50
  headerStoresV1,
50
51
  headerLocationsV1,
@@ -150,6 +151,11 @@ analysisTrafficRouter
150
151
  { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
151
152
  ],
152
153
  } ), validate( validationDtos.validateStoreOperationParams ), storeOperationV1 )
154
+ .post( '/performanceMatrix_v1', isAllowedSessionHandler, authorize( {
155
+ userType: [ 'tango', 'client' ], access: [
156
+ { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
157
+ ],
158
+ } ), validate( validationDtos.validateperformanceMatrixParams ), performanceMatrixV1 )
153
159
  .post( '/storesMap_v1', isAllowedSessionHandler, authorize( {
154
160
  userType: [ 'tango', 'client' ], access: [
155
161
  { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },