tango-app-api-store-zone 3.3.1-beta.26 → 3.3.1-beta.27

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.3.1-beta.26",
3
+ "version": "3.3.1-beta.27",
4
4
  "description": "zone",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1174,6 +1174,7 @@ export const getCameraTagging = async ( req, res ) => {
1174
1174
  // query = { clientId: req.query.clientId, cameraId: camDetails._id, streamName: camDetails.streamName, storeId: req.query.storeId };
1175
1175
  // }
1176
1176
  let taggingDetails = await taggingService.find( query );
1177
+ console.log( '🚀 ~ getCameraTagging ~ taggingDetails:', taggingDetails );
1177
1178
  if ( taggingDetails.length ) {
1178
1179
  let coordinates = [];
1179
1180
  details = {
@@ -1303,6 +1304,7 @@ export const updateOldData = async ( req, res ) => {
1303
1304
  try {
1304
1305
  let tagDetails = await taggingService.find( { clientId: req.body.clientId, tagName: req.body.tagName }, { storeId: 1 } );
1305
1306
 
1307
+
1306
1308
  if ( tagDetails.length ) {
1307
1309
  for ( let [ index, item ] of tagDetails.entries() ) {
1308
1310
  req.body.storeId = item.storeId;
@@ -1324,7 +1326,8 @@ export const updateOldData = async ( req, res ) => {
1324
1326
  if ( !upload.Key ) {
1325
1327
  logger.error( { message: `JSON Upload Error`, store: item.storeId } );
1326
1328
  }
1327
- if ( index == 0 ) {
1329
+ console.log( '🚀 ~ updateOldData ~ index:', index );
1330
+ if ( index == tagDetails.entries().length ) {
1328
1331
  res.sendSuccess( 'Zone Updated Successfully' );
1329
1332
  }
1330
1333
  } else {
@@ -1966,7 +1969,8 @@ export const updateZoneCustomTag = async ( req, res ) => {
1966
1969
  tagName: { $regex: `^${tagName}$`, $options: 'i' },
1967
1970
  };
1968
1971
  }
1969
-
1972
+ await externalService.updateMany( { zoneName: oldTag, clientId: req.body.clientId }, { zoneName: req.body.tagName } );
1973
+ updateOldData( req, res );
1970
1974
  let customZoneTagDetails = await customZoneTagService.findOne( findQuery );
1971
1975
 
1972
1976
  if ( !customZoneTagDetails ) {
@@ -2089,13 +2093,13 @@ export const updateZoneCustomTag = async ( req, res ) => {
2089
2093
  // If tagName changed, update tagging collection records with oldTag to have new tagName and groupName
2090
2094
  await taggingService.updateMany(
2091
2095
  { clientId, tagName: oldTag },
2092
- { $set: { tagName, groupName: groupName || null } },
2096
+ { $set: { tagName, 'groupName': groupName || null, 'coordinates.$[].zoneName': tagName } },
2093
2097
  );
2094
2098
  } else if ( groupName !== oldGroupName ) {
2095
2099
  // If only groupName changed, update tagging collection with new groupName
2096
2100
  await taggingService.updateMany(
2097
2101
  { clientId, tagName },
2098
- { $set: { groupName: groupName || null } },
2102
+ { $set: { 'groupName': groupName || null } },
2099
2103
  );
2100
2104
  }
2101
2105