tango-app-api-store-zone 3.0.11-dev → 3.0.12-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.11-dev",
3
+ "version": "3.0.12-dev",
4
4
  "description": "zone",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -21,8 +21,8 @@
21
21
  "mongodb": "^6.5.0",
22
22
  "nodemon": "^3.1.0",
23
23
  "swagger-ui-express": "^5.0.0",
24
- "tango-api-schema": "^2.0.102",
25
- "tango-app-api-middleware": "^1.0.71-test",
24
+ "tango-api-schema": "^2.0.104",
25
+ "tango-app-api-middleware": "^1.0.73-test",
26
26
  "winston": "^3.13.0",
27
27
  "winston-daily-rotate-file": "^5.0.0"
28
28
  },
@@ -23,12 +23,13 @@ export const addCustomTag = async ( req, res ) => {
23
23
  userName: req.user?.userName,
24
24
  email: req.user?.email,
25
25
  date: new Date(),
26
- logType: 'add Zone',
27
- logSubType: inputData.tagName,
28
- changes: [ ],
29
- eventType: 'add',
26
+ logType: 'zone',
27
+ logSubType: 'addCustomTag',
28
+ changes: [ `${inputData.tagName} customtag Created.` ],
29
+ eventType: '',
30
+ showTo: [ 'client', 'tango' ],
30
31
  };
31
- insertOpenSearchData( 'tango-retail-activity-logs', logObj );
32
+ insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
32
33
  return res.sendSuccess( 'Tag Created Successfully' );
33
34
  } catch ( e ) {
34
35
  logger.error( { error: 'e', function: 'addCustomTag' } );
@@ -114,12 +115,13 @@ export const tagging = async ( req, res ) => {
114
115
  userName: req.user?.userName,
115
116
  email: req.user?.email,
116
117
  date: new Date(),
117
- logType: 'add Zone Tagging',
118
- logSubType: InputData.tagName,
119
- changes: [ 'coordinates' ],
120
- eventType: 'add Tagging',
118
+ logType: 'zone',
119
+ logSubType: 'addZoneTagging',
120
+ changes: [ `${InputData.tagName} zone added tagging` ],
121
+ eventType: '',
122
+ showTo: [ 'client', 'tango' ],
121
123
  };
122
- insertOpenSearchData( 'tango-retail-activity-logs', logObj );
124
+ insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
123
125
  let response = await taggingService.create( InputData );
124
126
  await taggingService.deleteOne( { clientId: InputData.clientId, storeId: InputData.storeId, cameraId: { $exists: false }, tagName: InputData.tagName } );
125
127
  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 } ) );
@@ -130,12 +132,12 @@ export const tagging = async ( req, res ) => {
130
132
  userName: req.user?.userName,
131
133
  email: req.user?.email,
132
134
  date: new Date(),
133
- logType: 'add Zone Tagging',
134
- logSubType: InputData.tagName,
135
- changes: [ 'coordinates' ],
136
- eventType: 'update Tagging',
135
+ logType: 'zone',
136
+ logSubType: 'updateZoneTagging',
137
+ changes: [ `${InputData.tagName} zone Updated tagging` ],
138
+ eventType: '',
137
139
  };
138
- insertOpenSearchData( 'tango-retail-activity-logs', logObj );
140
+ insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
139
141
  taggingDetails.cameraId = InputData.cameraId;
140
142
  taggingDetails.streamName = InputData.streamName;
141
143
  if ( req.body?.redoPoint ) {
@@ -281,12 +283,13 @@ export const updateTag = async ( req, res ) => {
281
283
  userName: req.user?.userName,
282
284
  email: req.user?.email,
283
285
  date: new Date(),
284
- logType: 'add Zone Tagging',
285
- logSubType: req.body.existTag,
286
- changes: [ 'tagName' ],
287
- eventType: 'update Custom Tag Name',
286
+ logType: 'zone',
287
+ logSubType: 'updateCustomTag',
288
+ changes: [ `${req.body.tagName} tagName Updated` ],
289
+ eventType: '',
290
+ showTo: [ 'client', 'tango' ],
288
291
  };
289
- insertOpenSearchData( 'tango-retail-activity-logs', logObj );
292
+ insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
290
293
  logger.error( { error: 'something went wrong', function: 'updateTag' } );
291
294
  return res.sendError( 'something went wrong', 500 );
292
295
  } catch ( e ) {
@@ -340,12 +343,13 @@ export const deleteTag = async ( req, res ) => {
340
343
  userName: req.user?.userName,
341
344
  email: req.user?.email,
342
345
  date: new Date(),
343
- logType: 'add Zone Tagging',
344
- logSubType: req.body?.tagName,
345
- changes: [ 'tagName' ],
346
- eventType: 'Delete Tagging Name',
346
+ logType: 'zone',
347
+ logSubType: 'deleteTag',
348
+ changes: [ `${req.body.tagName} tag Deleted` ],
349
+ eventType: '',
350
+ showTo: [ 'client', 'tango' ],
347
351
  };
348
- insertOpenSearchData( 'tango-retail-activity-logs', logObj );
352
+ insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
349
353
  await updatezoneTagging( req, res );
350
354
  // return res.sendSuccess( 'Tag Deleted Successfully' );
351
355
  } catch ( e ) {
@@ -422,7 +426,7 @@ async function getCamTaggingDetails( req, res ) {
422
426
  try {
423
427
  let camDetails = await cameraService.find( { storeId: req.body.storeId, isActivated: true, isUp: true } );
424
428
  if ( !camDetails.length ) {
425
- return res.sendError( 'no data found', 204 );
429
+ return false;
426
430
  }
427
431
  let result = [];
428
432
  for ( let camera of camDetails ) {
@@ -515,8 +519,8 @@ export const updateOldData = async ( req, res ) => {
515
519
  if ( !upload.Key ) {
516
520
  logger.error( { message: `JSON Upload Error`, store: item.storeId } );
517
521
  }
518
- if ( index == tagDetails.length-1 ) {
519
- return res.sendSuccess( 'Zone Updated Successfully' );
522
+ if ( index == 0 ) {
523
+ res.sendSuccess( 'Zone Updated Successfully' );
520
524
  }
521
525
  } else {
522
526
  logger.error( { message: 'no data', store: item.storeId } );