tango-app-api-analysis-traffic 3.8.1-alpha.7 → 3.8.1-alpha.9

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.1-alpha.7",
3
+ "version": "3.8.1-alpha.9",
4
4
  "description": "Traffic Analysis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -272,24 +272,28 @@ export async function footFallImages( req, res ) {
272
272
  ],
273
273
  },
274
274
  },
275
- '_source': [ 'dateString', 'storeId', 'duplicateCount', 'footfallCount', 'employeeCount', 'houseKeeppingCount', 'status', 'ticketId', 'comments' ],
275
+ '_source': [ 'dateString', 'storeId', 'duplicateCount', 'footfallCount', 'employeeCount', 'houseKeepingCount', 'status', 'ticketId', 'comments', 'userName', 'role' ],
276
276
 
277
277
  };
278
278
 
279
279
  const getData = await getOpenSearchData( opensearch.footfallDirectory, query );
280
- const ticketDetails = getData?.body?.hits?.hits;
281
-
282
- const LamdaURL = 'https://cncmzszloku7y3bewxbpiy6nkm0yunqe.lambda-url.ap-south-1.on.aws/';
283
- let resultData = await LamdaServiceCall( LamdaURL, inputData );
284
- if ( resultData ) {
285
- if ( resultData.status_code == '200' ) {
286
- return res.sendSuccess( { ...resultData, ticketStatus: ticketDetails?.[0]?._source, config: req?.store?.revopTagging } );
287
- } else {
288
- return res.sendError( 'No Content', 204 );
289
- }
290
- } else {
291
- return res.sendError( 'No Content', 204 );
292
- }
280
+ const ticketDetails = getData?.body?.hits?.hits[0];
281
+ let temp = [];
282
+ ticketDetails?._source? temp.push( ticketDetails?._source ) :null;
283
+ if ( ticketDetails?._source?.status == 'close' ) {
284
+ temp.push( ticketDetails?._source );
285
+ }
286
+ const LamdaURL = 'https://cncmzszloku7y3bewxbpiy6nkm0yunqe.lambda-url.ap-south-1.on.aws/';
287
+ let resultData = await LamdaServiceCall( LamdaURL, inputData );
288
+ if ( resultData ) {
289
+ if ( resultData.status_code == '200' ) {
290
+ return res.sendSuccess( { ...resultData, ticketStatus: temp?.length > 0? temp : null, config: req?.store?.revopTagging } );
291
+ } else {
292
+ return res.sendError( 'No Content', 204 );
293
+ }
294
+ } else {
295
+ return res.sendError( 'No Content', 204 );
296
+ }
293
297
  } catch ( error ) {
294
298
  logger.error( { message: error, data: req.query, function: 'storeProcessedData' } );
295
299
  const err = error.message || 'Internal Server Error';