tango-app-api-infra 3.9.5-vms.76 → 3.9.5-vms.77

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,11 +1,11 @@
1
1
  {
2
2
  "name": "tango-app-api-infra",
3
- "version": "3.9.5-vms.76",
3
+ "version": "3.9.5-vms.77",
4
4
  "description": "infra",
5
5
  "main": "index.js",
6
6
  "type": "module",
7
7
  "scripts": {
8
- "start": "nodemon --exec \"eslint --fix . && node app.js\""
8
+ "start": "nodemon --exec \"eslint --fix . && node index.js\""
9
9
  },
10
10
  "engines": {
11
11
  "node": ">=18.10.0"
@@ -86,6 +86,10 @@ export async function createinternalTicket( req, res ) {
86
86
  mappingInfo: [],
87
87
  };
88
88
  const id = `${inputData.storeId}_${inputData.dateString}_internal_footfall-directory-tagging`;
89
+ let getExistingOne = await getOpenSearchById( openSearch.footfallDirectory, id );
90
+ if ( getExistingOne?.body?._source ) {
91
+ return res.sendError( 'Ticket Already Exists', 500 );
92
+ }
89
93
  const insertResult = await insertWithId( openSearch.footfallDirectory, id, record );
90
94
  if ( insertResult && insertResult.statusCode === 201 ) {
91
95
  return res.sendSuccess( 'Ticket raised successfully' );
@@ -380,11 +384,15 @@ export async function tangoReviewTicket( req, res ) {
380
384
  // return;
381
385
 
382
386
  let id = `${inputData.storeId}_${inputData.dateString}_footfall-directory-tagging`;
383
- if ( inputData.ticketType === 'internal' ) {
387
+ let getExistingOne = await getOpenSearchById( openSearch.footfallDirectory, id );
388
+ console.log( '🚀 ~ tangoReviewTicket ~ getExistingOne:', getExistingOne );
389
+ if ( inputData.ticketType === 'internal'&&!getExistingOne?.body?._source ) {
384
390
  id = `${inputData.storeId}_${inputData.dateString}_internal_footfall-directory-tagging`;
385
391
  }
386
392
 
393
+
387
394
  const insertResult = await updateOpenSearchData( openSearch.footfallDirectory, id, { doc: record } );
395
+ console.log( insertResult );
388
396
 
389
397
  if ( insertResult && ( insertResult.statusCode === 201 || insertResult.statusCode === 200 ) ) {
390
398
  return res.sendSuccess( 'Ticket closed successfully' );
@@ -392,6 +400,7 @@ export async function tangoReviewTicket( req, res ) {
392
400
  return res.sendError( 'Internal Server Error', 500 );
393
401
  }
394
402
  } catch ( error ) {
403
+ console.log( '🚀 ~ tangoReviewTicket ~ error:', error );
395
404
  const err = error.message || 'Internal Server Error';
396
405
  logger.error( { error: error, funtion: 'tangoReviewTicket' } );
397
406
  return res.sendError( err, 500 );