tango-app-api-store-zone 3.3.1-beta.17 → 3.3.1-beta.19

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.17",
3
+ "version": "3.3.1-beta.19",
4
4
  "description": "zone",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -525,6 +525,20 @@ export const tagging = async ( req, res ) => {
525
525
 
526
526
  await externalService.create( data );
527
527
  }
528
+
529
+ let cameraDetails = await cameraService.findOne( { _id: InputData.cameraId, streamName: InputData.streamName }, { productModule: 1 } );
530
+ if ( cameraDetails ) {
531
+ if ( !cameraDetails?.productModule.includes( 'tangoZone' ) ) {
532
+ cameraDetails.productModule.push( { productName: 'tangoZone', checked: true } );
533
+ cameraDetails.save();
534
+ } else {
535
+ let camIndex = cameraDetails.productModule.findIndex( ( ele ) => ele.productName == 'tangoZone' );
536
+ if ( !cameraDetails?.productModule?.[camIndex]?.checked ) {
537
+ cameraDetails.productModule[camIndex].checked = true;
538
+ cameraDetails.save();
539
+ }
540
+ }
541
+ }
528
542
  await updatezoneTagging( req, res );
529
543
  } catch ( e ) {
530
544
  logger.error( { error: e, function: 'tagging' } );
@@ -769,6 +783,11 @@ export const deleteTag = async ( req, res ) => {
769
783
  if ( !taggingDetails.length ) {
770
784
  return res.sendError( 'no data found', 204 );
771
785
  }
786
+
787
+ let tagNameDetails = await taggingService.findOne( { clientId: req.body.clientId, tagName: req.body.tagName, $expr: { $ne: [ { $size: '$coordinates' }, 0 ] } } );
788
+ if ( tagNameDetails ) {
789
+ return res.sendError( 'This zone tag is already mapped to other stores.', 400 );
790
+ }
772
791
  // let enableDelete = false;
773
792
  // if ( req.user.permission ) {
774
793
  // let permissions = req.user.permission;