tango-app-api-store-zone 3.0.8-dev → 3.0.10-dev

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-store-zone",
3
- "version": "3.0.8-dev",
3
+ "version": "3.0.10-dev",
4
4
  "description": "zone",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -22,7 +22,7 @@
22
22
  "nodemon": "^3.1.0",
23
23
  "swagger-ui-express": "^5.0.0",
24
24
  "tango-api-schema": "^2.0.102",
25
- "tango-app-api-middleware": "^1.0.70-test",
25
+ "tango-app-api-middleware": "^1.0.71-test",
26
26
  "winston": "^3.13.0",
27
27
  "winston-daily-rotate-file": "^5.0.0"
28
28
  },
@@ -119,8 +119,9 @@ export const tagging = async ( req, res ) => {
119
119
  eventType: 'add Tagging',
120
120
  };
121
121
  insertOpenSearchData( 'tango-retail-activity-logs', logObj );
122
- await taggingService.create( InputData );
122
+ let response = await taggingService.create( InputData );
123
123
  await taggingService.deleteOne( { clientId: InputData.clientId, storeId: InputData.storeId, cameraId: { $exists: false }, tagName: InputData.tagName } );
124
+ await axios.post( `${appConfig.url.oldapidomain}/tagging/oldTaggingAdd`, [ response ], { headers: { Authorization: 'Bearer d47433f8-9a33-47c7-ba43-1a0fbac28f66' } } ).then( ( res ) => logger.info( res?.data ) ).catch( ( error ) => logger.error( { error: error } ) );
124
125
  } else {
125
126
  const logObj = {
126
127
  clientId: InputData.clientId,
@@ -143,6 +144,11 @@ export const tagging = async ( req, res ) => {
143
144
  if ( InputData.coordinates[0].coor.length ) {
144
145
  taggingDetails.coordinates.push( InputData.coordinates[0] );
145
146
  taggingDetails.save();
147
+ await axios.post( `${appConfig.url.oldapidomain}/tagging/oldTaggingUpdate/${taggingDetails._id}`, taggingDetails, { headers: { Authorization: 'Bearer d47433f8-9a33-47c7-ba43-1a0fbac28f66' } } ).then( ( res ) => {
148
+ logger.info( res?.data );
149
+ } ).catch( ( error ) => {
150
+ logger.error( { error: error } );
151
+ } );
146
152
  } else {
147
153
  return res.sendError( 'coordinate is required', 500 );
148
154
  }
@@ -261,6 +267,13 @@ export const updateTag = async ( req, res ) => {
261
267
  logger.info( 'Custom Tag Updated Successfully' );
262
268
  return res.sendSuccess( 'Custom Tag Updated Successfully' );
263
269
  }
270
+ taggingDetails.forEach( async ( item ) => {
271
+ await axios.post( `${appConfig.url.oldapidomain}/tagging/oldTaggingUpdate/${item._id}`, item, { headers: { Authorization: 'Bearer d47433f8-9a33-47c7-ba43-1a0fbac28f66' } } ).then( ( res ) => {
272
+ logger.info( res?.data );
273
+ } ).catch( ( error ) => {
274
+ logger.error( { error: error } );
275
+ } );
276
+ } );
264
277
  const logObj = {
265
278
  clientId: req.body.clientId,
266
279
  storeId: taggingDetails?.storeId,
@@ -302,8 +315,24 @@ export const deleteTag = async ( req, res ) => {
302
315
  if ( req.user?.role == 'superadmin' || ( req.user?.role == 'admin' && enableDelete ) ) {
303
316
  await taggingService.deleteMany( { clientId: req.body.clientId, tagName: req.body.tagName } );
304
317
  } else {
305
- await taggingService.updateOne( { clientId: req.body.clientId, storeId: req.body.storeId, tagName: req.body.tagName }, { isDeleted: true } );
318
+ let deleteTag = await taggingService.updateOne( { clientId: req.body.clientId, storeId: req.body.storeId, tagName: req.body.tagName }, { isDeleted: true } );
319
+ if ( !deleteTag.modifiedCount ) {
320
+ let data = {
321
+ clientId: req.body.clientId,
322
+ storeId: req.body.storeId,
323
+ tagName: req.body.tagName,
324
+ isDeleted: true,
325
+ };
326
+ taggingService.create( data );
327
+ }
306
328
  }
329
+ taggingDetails.forEach( async ( item ) => {
330
+ await axios.post( `${appConfig.url.oldapidomain}/tagging/oldTaggingDelete/${item._id}`, '', { headers: { Authorization: 'Bearer d47433f8-9a33-47c7-ba43-1a0fbac28f66' } } ).then( ( res ) => {
331
+ logger.info( res?.data );
332
+ } ).catch( ( error ) => {
333
+ logger.error( { error: error } );
334
+ } );
335
+ } );
307
336
  const logObj = {
308
337
  clientId: req.body?.clientId,
309
338
  storeId: taggingDetails ? taggingDetails.map( ( item ) => item?.storeId ) : '',