tango-app-api-store-zone 3.3.1-beta.16 → 3.3.1-beta.18
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,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tango-app-api-store-zone",
|
|
3
|
-
"version": "3.3.1-beta.
|
|
3
|
+
"version": "3.3.1-beta.18",
|
|
4
4
|
"description": "zone",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"start": "nodemon --exec \"eslint --fix . && node
|
|
8
|
+
"start": "nodemon --exec \"eslint --fix . && node app.js\""
|
|
9
9
|
},
|
|
10
10
|
"engines": {
|
|
11
11
|
"node": ">=18.10.0"
|
|
@@ -179,7 +179,7 @@ export const customTagListv2 = async ( req, res ) => {
|
|
|
179
179
|
];
|
|
180
180
|
|
|
181
181
|
// Step 2: Fetch store & client details in parallel
|
|
182
|
-
const [ storeDetails, clientDetails ] = await Promise.all( [
|
|
182
|
+
const [ storeDetails, clientDetails, camList ] = await Promise.all( [
|
|
183
183
|
storeService.findOne(
|
|
184
184
|
{ storeId: req.query.storeId },
|
|
185
185
|
{ product: 1 },
|
|
@@ -188,7 +188,12 @@ export const customTagListv2 = async ( req, res ) => {
|
|
|
188
188
|
{ clientId: req.query.clientId },
|
|
189
189
|
{ featureConfigs: 1 },
|
|
190
190
|
),
|
|
191
|
+
cameraService.find(
|
|
192
|
+
{ storeId: req.query.storeId, isActivated: true, isUp: true },
|
|
193
|
+
{ streamName: 1 },
|
|
194
|
+
),
|
|
191
195
|
] );
|
|
196
|
+
console.log( req.query.clientId, camList.length );
|
|
192
197
|
|
|
193
198
|
// Step 3: Add conditional tags
|
|
194
199
|
if ( clientDetails?.featureConfigs?.isExcludedArea ) {
|
|
@@ -220,7 +225,8 @@ export const customTagListv2 = async ( req, res ) => {
|
|
|
220
225
|
|
|
221
226
|
// Step 6: Query counts per tag
|
|
222
227
|
const tagNames = uniqueTags.map( ( t ) => t.tagName );
|
|
223
|
-
|
|
228
|
+
let activeCam = camList.map( ( data ) => data.streamName );
|
|
229
|
+
console.log( '🚀 ~ customTagListv2 ~ activeCam:', activeCam );
|
|
224
230
|
const taggingDetails = await taggingService.aggregate( [
|
|
225
231
|
{
|
|
226
232
|
$match: {
|
|
@@ -229,6 +235,7 @@ export const customTagListv2 = async ( req, res ) => {
|
|
|
229
235
|
storeId: req.query.storeId,
|
|
230
236
|
coordinates: { $exists: true, $ne: [] },
|
|
231
237
|
tagName: { $in: tagNames },
|
|
238
|
+
streamName: { $in: activeCam },
|
|
232
239
|
},
|
|
233
240
|
},
|
|
234
241
|
{ $group: { _id: '$tagName', count: { $sum: 1 } } },
|
|
@@ -762,7 +769,12 @@ export const deleteTag = async ( req, res ) => {
|
|
|
762
769
|
if ( !taggingDetails.length ) {
|
|
763
770
|
return res.sendError( 'no data found', 204 );
|
|
764
771
|
}
|
|
765
|
-
|
|
772
|
+
|
|
773
|
+
let tagNameDetails = await taggingService.findOne( { clientId: req.body.clientId, tagName: req.body.tagName, $expr: { $ne: [ { $size: '$coordinates' }, 0 ] } } );
|
|
774
|
+
if ( tagNameDetails ) {
|
|
775
|
+
return res.sendError( 'This zone tag is already mapped to other stores.', 400 );
|
|
776
|
+
}
|
|
777
|
+
// let enableDelete = false;
|
|
766
778
|
// if ( req.user.permission ) {
|
|
767
779
|
// let permissions = req.user.permission;
|
|
768
780
|
// permissions.forEach( ( permission ) => {
|