tango-app-api-store-zone 3.3.1-beta.11 → 3.3.1-beta.13

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.11",
3
+ "version": "3.3.1-beta.13",
4
4
  "description": "zone",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -264,6 +264,7 @@ export const customTagListv2 = async ( req, res ) => {
264
264
  let Query = [ {
265
265
  $match: {
266
266
  client_id: req.query.clientId,
267
+ publish: true,
267
268
  checkListType: { $ne: 'custom' },
268
269
  },
269
270
  }, {
@@ -592,17 +593,17 @@ export const getCameraList = async ( req, res ) => {
592
593
  };
593
594
  export const getCameraListv2 = async ( req, res ) => {
594
595
  try {
595
- let cameraDetails = await cameraService.find( { clientId: req.query.clientId, storeId: req.query.storeId, isActivated: true, isUp: true }, { cameraNumber: 1, streamName: 1, isActivated: 1, isUp: 1, cameraName: 1, taggedChecklist: 1 } );
596
+ let cameraDetails = await cameraService.find( { clientId: req.body.clientId, storeId: req.body.storeId, isActivated: true, isUp: true }, { cameraNumber: 1, streamName: 1, isActivated: 1, isUp: 1, cameraName: 1, taggedChecklist: 1 } );
596
597
  if ( !cameraDetails.length ) {
597
598
  return res.sendError( 'no data found', 204 );
598
599
  }
599
600
  const folderPath = {
600
- file_path: `${req.query.storeId}/zone_base_images/`,
601
+ file_path: `${req.body.storeId}/zone_base_images/`,
601
602
  Bucket: JSON.parse( process.env.BUCKET ).zoneBaseImage, MaxKeys: 1000,
602
603
  };
603
604
  let fileList = await listFileByPath( folderPath );
604
605
  const TaggedfolderPath = {
605
- file_path: `${req.query.storeId}/zone_tagged_image/`,
606
+ file_path: `${req.body.storeId}/zone_tagged_image/`,
606
607
  Bucket: JSON.parse( process.env.BUCKET ).zoneTaggingImage, MaxKeys: 1000,
607
608
  };
608
609
  let tagFileList = await listFileByPath( TaggedfolderPath );
@@ -615,7 +616,7 @@ export const getCameraListv2 = async ( req, res ) => {
615
616
  baseImg: '',
616
617
  tagImg: '',
617
618
  };
618
- let taggingDetails = await taggingService.find( { cameraId: camera._id, streamName: camera.streamName, clientId: req.query.clientId, isDeleted: false }, { tagName: 1, coordinates: 1 } );
619
+ let taggingDetails = await taggingService.find( { cameraId: camera._id, streamName: camera.streamName, clientId: req.body.clientId, isDeleted: false }, { tagName: 1, coordinates: 1 } );
619
620
  if ( taggingDetails.length ) {
620
621
  tagList = taggingDetails.filter( ( item ) => item.coordinates.length ).map( ( item ) => {
621
622
  if ( item.coordinates.length ) {
@@ -630,7 +631,7 @@ export const getCameraListv2 = async ( req, res ) => {
630
631
  let splitStream = item.Key.split( '/' );
631
632
  let getStream = splitStream[splitStream.length - 1].split( '.' );
632
633
 
633
- if ( getStream && getStream[0] == `${req.query.storeId}_${camera.streamName}` ) {
634
+ if ( getStream && getStream[0] == `${req.body.storeId}_${camera.streamName}` ) {
634
635
  tagPath = item.Key;
635
636
  }
636
637
  }
@@ -640,7 +641,7 @@ export const getCameraListv2 = async ( req, res ) => {
640
641
  fileList.data.forEach( ( ele ) => {
641
642
  let splitStream = ele.Key.split( '/' );
642
643
  let getStream = splitStream[splitStream.length - 1].split( '.' );
643
- if ( getStream && getStream[0] == `${req.query.storeId}_${camera.streamName}` ) {
644
+ if ( getStream && getStream[0] == `${req.body.storeId}_${camera.streamName}` ) {
644
645
  imgPath = ele.Key;
645
646
  }
646
647
  } );
@@ -662,6 +663,7 @@ export const getCameraListv2 = async ( req, res ) => {
662
663
  camera.baseImg = cameraBaseImage;
663
664
  }
664
665
  camera.tagging = tagList;
666
+ camera.taggedCount = tagList.filter( ( ele ) => ele.tagName===req.body.tagName );
665
667
  cameraDetails[index] = camera;
666
668
  }
667
669
  cameraDetails.sort( ( a, b ) => a.tagging?.length > b.tagging?.length ? -1 : 1 );
@@ -16,10 +16,11 @@ export const validateAddTagParams = {
16
16
  export const tagSchema = joi.object( {
17
17
  clientId: joi.string().required(),
18
18
  storeId: joi.string().required(),
19
+ tagName: joi.string().optional(),
19
20
  } );
20
21
 
21
22
  export const validateTagParams = {
22
- query: tagSchema,
23
+ body: tagSchema,
23
24
  };
24
25
 
25
26
  export const validateUpdateTagSchema = joi.object( {
@@ -12,7 +12,7 @@ zoneTaggingRouter.get( '/customTagList', isAllowedSessionHandler, accessVerifica
12
12
  zoneTaggingRouter.get( '/customTagListv2', isAllowedSessionHandler, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoEye', name: 'ZoneTag', permissions: [ ] } ] } ), tagController.customTagListv2 );
13
13
  zoneTaggingRouter.post( '/tagging', isAllowedSessionHandler, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoEye', name: 'ZoneTag', permissions: [ 'isEdit' ] } ] } ), validate( validation.validateTaggingParams ), tagController.tagging );
14
14
  zoneTaggingRouter.get( '/cameraList', isAllowedSessionHandler, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoEye', name: 'ZoneTag', permissions: [ ] } ] } ), validate( validation.validateTagParams ), tagController.getCameraList );
15
- zoneTaggingRouter.get( '/cameraListv2', isAllowedSessionHandler, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoEye', name: 'ZoneTag', permissions: [ ] } ] } ), validate( validation.validateTagParams ), tagController.getCameraListv2 );
15
+ zoneTaggingRouter.post( '/cameraListv2', isAllowedSessionHandler, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoEye', name: 'ZoneTag', permissions: [ ] } ] } ), validate( validation.validateTagParams ), tagController.getCameraListv2 );
16
16
  zoneTaggingRouter.post( '/updateCustomTag', isAllowedSessionHandler, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoEye', name: 'ZoneTag', permissions: [ 'isEdit' ] } ] } ), validate( validation.validateUpdateTagParams ), tagController.updateTag );
17
17
  zoneTaggingRouter.post( '/deleteCustomTag', isAllowedSessionHandler, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoEye', name: 'ZoneTag', permissions: [ 'isEdit' ] } ] } ), validate( validation.validateDeleteTagParams ), tagController.deleteTag );
18
18
  zoneTaggingRouter.get( '/getCameraTagging', isAllowedSessionHandler, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoEye', name: 'ZoneTag', permissions: [ ] } ] } ), validate( validation.validateCameraTagParams ), tagController.getCameraTagging );