tango-app-api-store-zone 3.0.10-dev → 3.0.11-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
|
@@ -13,7 +13,7 @@ export const addCustomTag = async ( req, res ) => {
|
|
|
13
13
|
storeId: inputData.storeId,
|
|
14
14
|
tagName: inputData.tagName,
|
|
15
15
|
};
|
|
16
|
-
await taggingService.deleteMany( { clientId: inputData.clientId, tagName: inputData.tagName, isDeleted: true } );
|
|
16
|
+
await taggingService.deleteMany( { clientId: inputData.clientId, storeId: inputData.storeId, tagName: inputData.tagName, isDeleted: true } );
|
|
17
17
|
await taggingService.create( data );
|
|
18
18
|
}
|
|
19
19
|
logger.info( 'Tag Created Successfully' );
|
|
@@ -43,16 +43,17 @@ export const customTagList = async ( req, res ) => {
|
|
|
43
43
|
customTagList.push( ...defaultZone );
|
|
44
44
|
let tagInfo = await taggingService.find( { clientId: req.query.clientId }, { tagName: 1 } );
|
|
45
45
|
let deletedTag = await taggingService.find( { clientId: req.query.clientId, isDeleted: true }, { storeId: 1, tagName: 1 } );
|
|
46
|
+
tagInfo = [ ...new Set( tagInfo.map( ( item ) => item.tagName ) ) ];
|
|
46
47
|
deletedTag.forEach( ( item ) => {
|
|
47
|
-
let findTag = tagInfo.findIndex( ( tag ) => tag
|
|
48
|
+
let findTag = tagInfo.findIndex( ( tag ) => tag == item.tagName && item.storeId == req.query.storeId );
|
|
48
49
|
if ( findTag != -1 ) {
|
|
49
50
|
tagInfo.splice( findTag, 1 );
|
|
50
51
|
}
|
|
51
52
|
} );
|
|
52
53
|
if ( tagInfo.length ) {
|
|
53
54
|
tagInfo.forEach( ( item ) => {
|
|
54
|
-
if ( !customTagList.includes( item
|
|
55
|
-
customTagList.push( item
|
|
55
|
+
if ( !customTagList.includes( item ) ) {
|
|
56
|
+
customTagList.push( item );
|
|
56
57
|
}
|
|
57
58
|
} );
|
|
58
59
|
}
|
|
@@ -201,7 +202,7 @@ export const getCameraList = async ( req, res ) => {
|
|
|
201
202
|
baseImg: '',
|
|
202
203
|
tagImg: '',
|
|
203
204
|
};
|
|
204
|
-
let taggingDetails = await taggingService.find( { cameraId: camera._id, streamName: camera.streamName, clientId: req.query.clientId }, { tagName: 1, coordinates: 1 } );
|
|
205
|
+
let taggingDetails = await taggingService.find( { cameraId: camera._id, streamName: camera.streamName, clientId: req.query.clientId, isDeleted: false }, { tagName: 1, coordinates: 1 } );
|
|
205
206
|
if ( taggingDetails.length ) {
|
|
206
207
|
tagList = taggingDetails.map( ( item ) => {
|
|
207
208
|
if ( item.coordinates.length ) {
|
|
@@ -261,8 +262,8 @@ export const updateTag = async ( req, res ) => {
|
|
|
261
262
|
if ( !taggingDetails ) {
|
|
262
263
|
return res.sendError( 'no data found', 204 );
|
|
263
264
|
}
|
|
264
|
-
let tagUpdate = await taggingService.updateMany( { clientId: req.body.clientId, tagName: req.body.existTag
|
|
265
|
-
await taggingService.deleteMany( { clientId: req.body.clientId, tagName: req.body.
|
|
265
|
+
let tagUpdate = await taggingService.updateMany( { clientId: req.body.clientId, tagName: req.body.existTag }, { tagName: req.body.tagName } );
|
|
266
|
+
// await taggingService.deleteMany( { clientId: req.body.clientId, tagName: req.body.existTag, isDeleted: true } );
|
|
266
267
|
if ( tagUpdate.modifiedCount ) {
|
|
267
268
|
logger.info( 'Custom Tag Updated Successfully' );
|
|
268
269
|
return res.sendSuccess( 'Custom Tag Updated Successfully' );
|
|
@@ -296,7 +297,7 @@ export const updateTag = async ( req, res ) => {
|
|
|
296
297
|
|
|
297
298
|
export const deleteTag = async ( req, res ) => {
|
|
298
299
|
try {
|
|
299
|
-
let taggingDetails = await taggingService.find( { clientId: req.body.clientId, tagName: req.body.tagName
|
|
300
|
+
let taggingDetails = await taggingService.find( { clientId: req.body.clientId, tagName: req.body.tagName }, { storeId: 1 } );
|
|
300
301
|
if ( !taggingDetails.length ) {
|
|
301
302
|
return res.sendError( 'no data found', 204 );
|
|
302
303
|
}
|
|
@@ -362,7 +363,7 @@ export const getCameraTagging = async ( req, res ) => {
|
|
|
362
363
|
return res.sendError( 'no data found', 204 );
|
|
363
364
|
}
|
|
364
365
|
if ( camDetails ) {
|
|
365
|
-
query = { clientId: req.query.clientId, cameraId: camDetails._id, streamName: camDetails.streamName, storeId: req.query.storeId };
|
|
366
|
+
query = { clientId: req.query.clientId, cameraId: camDetails._id, streamName: camDetails.streamName, storeId: req.query.storeId, isDeleted: false };
|
|
366
367
|
if ( req.query?.tagName != 'undefined' && req.query?.tagName != '' ) {
|
|
367
368
|
query.tagName = req.query.tagName;
|
|
368
369
|
}
|
|
@@ -425,7 +426,7 @@ async function getCamTaggingDetails( req, res ) {
|
|
|
425
426
|
}
|
|
426
427
|
let result = [];
|
|
427
428
|
for ( let camera of camDetails ) {
|
|
428
|
-
let taggingDetails = await taggingService.find( { cameraId: camera._id, streamName: camera.streamName, storeId: req.body.storeId, clientId: camera.clientId } );
|
|
429
|
+
let taggingDetails = await taggingService.find( { cameraId: camera._id, streamName: camera.streamName, storeId: req.body.storeId, clientId: camera.clientId, isDeleted: false } );
|
|
429
430
|
let zoneList = [];
|
|
430
431
|
if ( taggingDetails.length ) {
|
|
431
432
|
taggingDetails.forEach( ( zone ) => {
|