tango-app-api-store-zone 3.3.1-beta.7 → 3.3.1-beta.9

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/.eslintrc.cjs CHANGED
@@ -36,7 +36,7 @@ module.exports = {
36
36
  'no-unused-vars': 'error',
37
37
  'new-cap': [ 'error', { 'newIsCap': true, 'capIsNew': false } ],
38
38
  'prefer-const': 'off',
39
- 'no-console': 'error',
39
+ // 'no-console': 'error',
40
40
  },
41
41
  };
42
42
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-app-api-store-zone",
3
- "version": "3.3.1-beta.7",
3
+ "version": "3.3.1-beta.9",
4
4
  "description": "zone",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -17,11 +17,11 @@
17
17
  "dotenv": "^16.4.5",
18
18
  "express": "^4.19.2",
19
19
  "handlebars": "^4.7.8",
20
- "joi-to-swagger": "^6.2.0",
20
+ "joi": "^17.12.1",
21
21
  "mongodb": "^6.5.0",
22
22
  "nodemon": "^3.1.0",
23
23
  "swagger-ui-express": "^5.0.0",
24
- "tango-api-schema": "^2.1.58",
24
+ "tango-api-schema": "^2.3.23",
25
25
  "tango-app-api-middleware": "^3.1.43-alpha.6",
26
26
  "winston": "^3.13.0",
27
27
  "winston-daily-rotate-file": "^5.0.0"
@@ -5,6 +5,8 @@ import * as storeService from '../services/store.service.js';
5
5
  import * as clientService from '../services/client.service.js';
6
6
  import * as externalService from '../services/external.service.js';
7
7
  import { signedUrl, listFileByPath, fileUpload, insertOpenSearchData } from 'tango-app-api-middleware';
8
+ import * as processedchecklistconfigService from '../services/processedchecklistconfig.services.js';
9
+
8
10
  import axios from 'axios';
9
11
  export const addCustomTag = async ( req, res ) => {
10
12
  try {
@@ -16,6 +18,7 @@ export const addCustomTag = async ( req, res ) => {
16
18
  storeId: inputData.storeId,
17
19
  tagName: inputData.tagName,
18
20
  rgbColor: inputData.rgbColor,
21
+ productName: inputData.productName,
19
22
  rgbBorderColor: inputData.rgbBorderColor,
20
23
  };
21
24
  await taggingService.deleteMany( { clientId: inputData.clientId, storeId: inputData.storeId, tagName: inputData.tagName, isDeleted: true } );
@@ -165,6 +168,181 @@ export const customTagList = async ( req, res ) => {
165
168
  return res.sendError( e, 500 );
166
169
  }
167
170
  };
171
+ export const customTagListv2 = async ( req, res ) => {
172
+ try {
173
+ // Step 1: Base tag list
174
+ let customTagList = [
175
+ { tagName: 'Front', productName: 'tangoTraffic' },
176
+ { tagName: 'Back', productName: 'tangoTraffic' },
177
+ { tagName: 'Tracker-in', productName: 'tangoTraker' },
178
+ { tagName: 'Tracker-out', productName: 'tangoTraker' },
179
+ ];
180
+
181
+ // Step 2: Fetch store & client details in parallel
182
+ const [ storeDetails, clientDetails ] = await Promise.all( [
183
+ storeService.findOne(
184
+ { storeId: req.query.storeId },
185
+ { product: 1 },
186
+ ),
187
+ clientService.findOne(
188
+ { clientId: req.query.clientId },
189
+ { featureConfigs: 1 },
190
+ ),
191
+ ] );
192
+
193
+ // Step 3: Add conditional tags
194
+ if ( clientDetails?.featureConfigs?.isExcludedArea ) {
195
+ customTagList.push( { tagName: 'Excluded Area', productName: 'tangoTraffic' } );
196
+ }
197
+ if ( clientDetails?.featureConfigs?.isPasserByData ) {
198
+ customTagList.push( { tagName: 'Passer By', productName: 'tangoTraffic' } );
199
+ }
200
+ if ( storeDetails?.product?.includes( 'tangoZone' ) ) {
201
+ customTagList.push(
202
+ { tagName: 'Entry/Exit', productName: 'tangoZone' },
203
+ { tagName: 'Billing', productName: 'tangoZone' },
204
+ );
205
+ }
206
+ if ( req.query.selectedProduct && req.query.selectedProduct != '' ) {
207
+ customTagList = customTagList.filter( ( ele ) => ele.productName === req.query.selectedProduct );
208
+ }
209
+ // Step 4: Fetch existing tags
210
+ const tagInfo = await taggingService.find(
211
+ { clientId: req.query.clientId, productName: req.query.selectedProduct },
212
+ { tagName: 1, rgbColor: 1, rgbBorderColor: 1, productName: 1 },
213
+ );
214
+
215
+ // Merge all tags
216
+ const mergedTags = [ ...customTagList, ...tagInfo ];
217
+
218
+ // Step 5: Build unique tag list
219
+ const uniqueTags = [ ...new Map( mergedTags.map( ( tag ) => [ tag.tagName, tag ] ) ).values() ];
220
+
221
+ // Step 6: Query counts per tag
222
+ const tagNames = uniqueTags.map( ( t ) => t.tagName );
223
+
224
+ const taggingDetails = await taggingService.aggregate( [
225
+ {
226
+ $match: {
227
+ productName: req.query.selectedProduct,
228
+ clientId: req.query.clientId,
229
+ storeId: req.query.storeId,
230
+ coordinates: { $exists: true, $ne: [] },
231
+ tagName: { $in: tagNames },
232
+ },
233
+ },
234
+ { $group: { _id: '$tagName', count: { $sum: 1 } } },
235
+ ] );
236
+
237
+ const countMap = new Map( taggingDetails.map( ( t ) => [ t._id, t.count ] ) );
238
+
239
+ // Step 7: Tag colors config (instead of many ifs)
240
+ const tagColors = {
241
+ 'Front': { rgbColor: 'rgba(89, 80, 5, 0.5)', rgbBorderColor: 'rgb(99, 90, 15)' },
242
+ 'Back': { rgbColor: 'rgba(94, 60, 107, 0.5)', rgbBorderColor: 'rgb(104, 70, 117)' },
243
+ 'Excluded Area': { rgbColor: 'rgba(186, 60, 214, 0.5)', rgbBorderColor: 'rgb(196, 70, 224)' },
244
+ 'Passer By': { rgbColor: 'rgba(81, 153, 247, 0.5)', rgbBorderColor: 'rgb(91, 163, 257)' },
245
+ 'Entry/Exit': { rgbColor: 'rgba(224, 43, 170, 0.5)', rgbBorderColor: 'rgb(234, 53, 180)' },
246
+ 'Billing': { rgbColor: 'rgba(193, 214, 114, 0.5)', rgbBorderColor: 'rgb(203, 224, 124)' },
247
+ 'Tracker-in': { rgbColor: 'rgba(123, 95, 105, 0.5)', rgbBorderColor: 'rgb(133, 105, 115)' },
248
+ 'Tracker-out': { rgbColor: 'rgba(12, 195, 111, 0.5)', rgbBorderColor: 'rgb(22, 205, 125)' },
249
+ };
250
+
251
+ // Step 8: Final processing
252
+ const finalTags = uniqueTags.map( ( tag ) => ( {
253
+ tagName: tag.tagName,
254
+ productName: tag.productName,
255
+ count: countMap.get( tag.tagName ) || 0,
256
+ rgbColor: tag.rgbColor || tagColors[tag.tagName]?.rgbColor,
257
+ rgbBorderColor: tag.rgbBorderColor || tagColors[tag.tagName]?.rgbBorderColor,
258
+ } ) );
259
+
260
+
261
+ // Step 9: Sort by count (desc)
262
+ finalTags.sort( ( a, b ) => b.count - a.count );
263
+ if ( req.query.selectedProduct && req.query.selectedProduct === 'tangoTrax' ) {
264
+ let Query = [ {
265
+ $match: {
266
+ client_id: req.query.clientId,
267
+ checkListType: { $ne: 'custom' },
268
+ },
269
+ }, {
270
+ $group: {
271
+ _id: '$sourceCheckList_id',
272
+ sourceCheckList_id: { $last: '$sourceCheckList_id' },
273
+ tagName: { $last: '$checkListName' },
274
+ },
275
+ },
276
+ {
277
+ $lookup: {
278
+ from: 'cameras',
279
+ let: { checkListName: '$tagName' },
280
+ pipeline: [
281
+ {
282
+ $match: {
283
+ $expr: {
284
+ $anyElementTrue: {
285
+ $map: {
286
+ input: { $ifNull: [ '$taggedChecklist', [] ] }, // ✅ default to empty array
287
+ as: 'tc',
288
+ in: { $eq: [ '$$tc.checkListName', '$$checkListName' ] },
289
+ },
290
+ },
291
+ },
292
+ },
293
+ },
294
+ {
295
+ $project: {
296
+ storeId: 1,
297
+ },
298
+ },
299
+ ], as: 'cameraList',
300
+ },
301
+ },
302
+
303
+ {
304
+ $project: {
305
+ tagName: 1,
306
+ type: 'checklist',
307
+ count: { $size: '$cameraList' },
308
+ },
309
+ },
310
+ {
311
+ $sort: {
312
+ count: -1,
313
+ },
314
+ },
315
+
316
+ ];
317
+ let getChecklistData = await processedchecklistconfigService.aggregate( Query );
318
+ if ( finalTags&&finalTags.length>0 ) {
319
+ let merged = getChecklistData.map( ( item ) => {
320
+ let match = finalTags.find( ( a ) => a.tagName === item.tagName );
321
+ if ( match ) {
322
+ return { ...item, ...match, count: item.count + match.count }; // add counts
323
+ }
324
+ return item;
325
+ } );
326
+
327
+ // also include any arr1 items not in arr2
328
+ finalTags.forEach( ( a ) => {
329
+ if ( !merged.find( ( m ) => m.tagName === a.tagName ) ) {
330
+ merged.push( a );
331
+ }
332
+ } );
333
+ merged.sort( ( a, b ) => b.count - a.count );
334
+ return res.sendSuccess( merged );
335
+ } else {
336
+ return res.sendSuccess( getChecklistData );
337
+ }
338
+ } else {
339
+ return res.sendSuccess( finalTags );
340
+ }
341
+ } catch ( e ) {
342
+ logger.error( { error: e, function: 'customTagList' } );
343
+ return res.sendError( e, 500 );
344
+ }
345
+ };
168
346
 
169
347
  export const tagging = async ( req, res ) => {
170
348
  try {
@@ -224,12 +402,12 @@ export const tagging = async ( req, res ) => {
224
402
  ...taggingDetails.toObject(),
225
403
  },
226
404
  oldData: {
227
- TagName: taggingDetails.tagName,
228
- StreamName: taggingDetails.streamName,
405
+ tagName: taggingDetails.tagName,
406
+ streamName: taggingDetails.streamName,
229
407
  },
230
408
  newData: {
231
- TagName: taggingDetails.tagName,
232
- StreamName: taggingDetails.streamName,
409
+ tagName: taggingDetails.tagName,
410
+ streamName: taggingDetails.streamName,
233
411
  },
234
412
  showTo: [ 'tango', 'client' ],
235
413
  };
@@ -239,6 +417,8 @@ export const tagging = async ( req, res ) => {
239
417
  insertOpenSearchData( JSON.parse( process.env.OPENSEARCH )?.activityLog, logObj );
240
418
  taggingDetails.cameraId = InputData.cameraId;
241
419
  taggingDetails.streamName = InputData.streamName;
420
+ taggingDetails.checkListName = InputData.checkListName;
421
+ taggingDetails.productName = InputData.productName;
242
422
  // if ( req.body?.redoPoint ) {
243
423
  // taggingDetails.coordinates = InputData.coordinates[0];
244
424
  // taggingDetails.save();
@@ -271,7 +451,7 @@ export const tagging = async ( req, res ) => {
271
451
  let externalDetails = await externalService.findOne( { storeId: InputData.storeId, zoneName: InputData.tagName, clientId: InputData.clientId } );
272
452
 
273
453
  if ( !externalDetails ) {
274
- let data ={
454
+ let data = {
275
455
  'storeId': InputData.storeId,
276
456
  'clientId': InputData.clientId,
277
457
  'productName': 'tangoZone',
@@ -335,11 +515,13 @@ export const getCameraList = async ( req, res ) => {
335
515
  if ( !cameraDetails.length ) {
336
516
  return res.sendError( 'no data found', 204 );
337
517
  }
338
- const folderPath = { file_path: `${req.query.storeId}/zone_base_images/`,
518
+ const folderPath = {
519
+ file_path: `${req.query.storeId}/zone_base_images/`,
339
520
  Bucket: JSON.parse( process.env.BUCKET ).zoneBaseImage, MaxKeys: 1000,
340
521
  };
341
522
  let fileList = await listFileByPath( folderPath );
342
- const TaggedfolderPath = { file_path: `${req.query.storeId}/zone_tagged_image/`,
523
+ const TaggedfolderPath = {
524
+ file_path: `${req.query.storeId}/zone_tagged_image/`,
343
525
  Bucket: JSON.parse( process.env.BUCKET ).zoneTaggingImage, MaxKeys: 1000,
344
526
  };
345
527
  let tagFileList = await listFileByPath( TaggedfolderPath );
@@ -365,7 +547,7 @@ export const getCameraList = async ( req, res ) => {
365
547
  tagFileList.data.forEach( ( item ) => {
366
548
  if ( item.Key.length > 1 ) {
367
549
  let splitStream = item.Key.split( '/' );
368
- let getStream = splitStream[splitStream.length -1].split( '.' );
550
+ let getStream = splitStream[splitStream.length - 1].split( '.' );
369
551
 
370
552
  if ( getStream && getStream[0] == `${req.query.storeId}_${camera.streamName}` ) {
371
553
  tagPath = item.Key;
@@ -376,21 +558,23 @@ export const getCameraList = async ( req, res ) => {
376
558
  if ( fileList?.data.length ) {
377
559
  fileList.data.forEach( ( ele ) => {
378
560
  let splitStream = ele.Key.split( '/' );
379
- let getStream = splitStream[splitStream.length -1].split( '.' );
561
+ let getStream = splitStream[splitStream.length - 1].split( '.' );
380
562
  if ( getStream && getStream[0] == `${req.query.storeId}_${camera.streamName}` ) {
381
563
  imgPath = ele.Key;
382
564
  }
383
565
  } );
384
566
  }
385
567
  if ( tagPath ) {
386
- const params = { file_path: tagPath,
568
+ const params = {
569
+ file_path: tagPath,
387
570
  Bucket: JSON.parse( process.env.BUCKET ).zoneTaggingImage,
388
571
  };
389
572
  const cameraTagImage = await signedUrl( params );
390
573
  camera.tagImg = cameraTagImage;
391
574
  }
392
575
  if ( imgPath ) {
393
- const baseParams = { file_path: imgPath,
576
+ const baseParams = {
577
+ file_path: imgPath,
394
578
  Bucket: JSON.parse( process.env.BUCKET ).zoneBaseImage,
395
579
  };
396
580
  const cameraBaseImage = await signedUrl( baseParams );
@@ -406,6 +590,87 @@ export const getCameraList = async ( req, res ) => {
406
590
  return res.sendError( e, 500 );
407
591
  }
408
592
  };
593
+ export const getCameraListv2 = async ( req, res ) => {
594
+ 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
+ if ( !cameraDetails.length ) {
597
+ return res.sendError( 'no data found', 204 );
598
+ }
599
+ const folderPath = {
600
+ file_path: `${req.query.storeId}/zone_base_images/`,
601
+ Bucket: JSON.parse( process.env.BUCKET ).zoneBaseImage, MaxKeys: 1000,
602
+ };
603
+ let fileList = await listFileByPath( folderPath );
604
+ const TaggedfolderPath = {
605
+ file_path: `${req.query.storeId}/zone_tagged_image/`,
606
+ Bucket: JSON.parse( process.env.BUCKET ).zoneTaggingImage, MaxKeys: 1000,
607
+ };
608
+ let tagFileList = await listFileByPath( TaggedfolderPath );
609
+ for ( let [ index, camera ] of cameraDetails.entries() ) {
610
+ let tagList = [];
611
+ let tagPath;
612
+ let imgPath;
613
+ camera = {
614
+ ...camera._doc,
615
+ baseImg: '',
616
+ tagImg: '',
617
+ };
618
+ let taggingDetails = await taggingService.find( { cameraId: camera._id, streamName: camera.streamName, clientId: req.query.clientId, isDeleted: false }, { tagName: 1, coordinates: 1 } );
619
+ if ( taggingDetails.length ) {
620
+ tagList = taggingDetails.filter( ( item ) => item.coordinates.length ).map( ( item ) => {
621
+ if ( item.coordinates.length ) {
622
+ return { tagName: item.tagName, color: item.coordinates[0].color };
623
+ }
624
+ } );
625
+ }
626
+
627
+ if ( tagFileList.data.length ) {
628
+ tagFileList.data.forEach( ( item ) => {
629
+ if ( item.Key.length > 1 ) {
630
+ let splitStream = item.Key.split( '/' );
631
+ let getStream = splitStream[splitStream.length - 1].split( '.' );
632
+
633
+ if ( getStream && getStream[0] == `${req.query.storeId}_${camera.streamName}` ) {
634
+ tagPath = item.Key;
635
+ }
636
+ }
637
+ } );
638
+ }
639
+ if ( fileList?.data.length ) {
640
+ fileList.data.forEach( ( ele ) => {
641
+ let splitStream = ele.Key.split( '/' );
642
+ let getStream = splitStream[splitStream.length - 1].split( '.' );
643
+ if ( getStream && getStream[0] == `${req.query.storeId}_${camera.streamName}` ) {
644
+ imgPath = ele.Key;
645
+ }
646
+ } );
647
+ }
648
+ if ( tagPath ) {
649
+ const params = {
650
+ file_path: tagPath,
651
+ Bucket: JSON.parse( process.env.BUCKET ).zoneTaggingImage,
652
+ };
653
+ const cameraTagImage = await signedUrl( params );
654
+ camera.tagImg = cameraTagImage;
655
+ }
656
+ if ( imgPath ) {
657
+ const baseParams = {
658
+ file_path: imgPath,
659
+ Bucket: JSON.parse( process.env.BUCKET ).zoneBaseImage,
660
+ };
661
+ const cameraBaseImage = await signedUrl( baseParams );
662
+ camera.baseImg = cameraBaseImage;
663
+ }
664
+ camera.tagging = tagList;
665
+ cameraDetails[index] = camera;
666
+ }
667
+ cameraDetails.sort( ( a, b ) => a.tagging?.length > b.tagging?.length ? -1 : 1 );
668
+ return res.sendSuccess( cameraDetails );
669
+ } catch ( e ) {
670
+ logger.error( { error: e, function: 'getCameraListv2' } );
671
+ return res.sendError( e, 500 );
672
+ }
673
+ };
409
674
 
410
675
  export const updateTag = async ( req, res ) => {
411
676
  try {
@@ -452,10 +717,10 @@ export const updateTag = async ( req, res ) => {
452
717
  tagName: req.body.tagName,
453
718
  },
454
719
  oldData: {
455
- TagName: req.body.existTag,
720
+ tagName: req.body.existTag,
456
721
  },
457
722
  newData: {
458
- TagName: req.body.tagName,
723
+ tagName: req.body.tagName,
459
724
  },
460
725
  showTo: [ 'tango', 'client' ],
461
726
  };
@@ -716,6 +981,28 @@ export const updateOldData = async ( req, res ) => {
716
981
  return res.sendError( e, 500 );
717
982
  }
718
983
  };
984
+ export async function updateCamera( req, res ) {
985
+ try {
986
+ let findoneCheckList = await processedchecklistconfigService.findOne( {
987
+ client_id: req.body.clientId, checkListName: req.body.selectedZone,
988
+ } );
989
+
990
+ let updateData = {
991
+ checkListName: req.body.selectedZone,
992
+ sourceCheckList_id: findoneCheckList?.sourceCheckList_id,
993
+ };
994
+ if ( req.body.type === 'tagCamera' ) {
995
+ await cameraService.updateOne( { _id: req.body._id }, { $push: { taggedChecklist: updateData } } );
996
+ } else {
997
+ await cameraService.updateOne( { _id: req.body._id }, { $pull: { taggedChecklist: updateData } } );
998
+ }
999
+
1000
+ res.sendSuccess( 'updated Sucessfully' );
1001
+ } catch ( e ) {
1002
+ logger.error( { error: e, function: 'updateOldData' } );
1003
+ return res.sendError( e, 500 );
1004
+ }
1005
+ };
719
1006
 
720
1007
  export const deletezoneTagging = async ( req, res ) => {
721
1008
  let data = req.body;
@@ -754,81 +1041,3 @@ async function updateJsonFile( req, res ) {
754
1041
  }
755
1042
  }
756
1043
  };
757
-
758
- export const getCameraStreamList = async ( req, res ) => {
759
- try {
760
- let cameraDetails = await cameraService.find( { clientId: req.body.clientId, storeId: req.body.storeId, streamName: req.body.streamName }, { cameraNumber: 1, streamName: 1, isActivated: 1, isUp: 1, cameraName: 1 } );
761
- if ( !cameraDetails.length ) {
762
- return res.sendError( 'no data found', 204 );
763
- }
764
- const folderPath = { file_path: `${req.body.storeId}/zone_base_images/`,
765
- Bucket: JSON.parse( process.env.BUCKET ).zoneBaseImage, MaxKeys: 1000,
766
- };
767
- let fileList = await listFileByPath( folderPath );
768
- const TaggedfolderPath = { file_path: `${req.body.storeId}/zone_tagged_image/`,
769
- Bucket: JSON.parse( process.env.BUCKET ).zoneTaggingImage, MaxKeys: 1000,
770
- };
771
- let tagFileList = await listFileByPath( TaggedfolderPath );
772
- for ( let [ index, camera ] of cameraDetails.entries() ) {
773
- let tagList = [];
774
- let tagPath;
775
- let imgPath;
776
- camera = {
777
- ...camera._doc,
778
- baseImg: '',
779
- tagImg: '',
780
- };
781
- let taggingDetails = await taggingService.find( { cameraId: camera._id, streamName: camera.streamName, clientId: req.body.clientId, isDeleted: false }, { tagName: 1, coordinates: 1 } );
782
- if ( taggingDetails.length ) {
783
- tagList = taggingDetails.filter( ( item ) => item.coordinates.length ).map( ( item ) => {
784
- if ( item.coordinates.length ) {
785
- return { tagName: item.tagName, color: item.coordinates[0].color };
786
- }
787
- } );
788
- }
789
-
790
- if ( tagFileList.data.length ) {
791
- tagFileList.data.forEach( ( item ) => {
792
- if ( item.Key.length > 1 ) {
793
- let splitStream = item.Key.split( '/' );
794
- let getStream = splitStream[splitStream.length -1].split( '.' );
795
-
796
- if ( getStream && getStream[0] == `${req.body.storeId}_${camera.streamName}` ) {
797
- tagPath = item.Key;
798
- }
799
- }
800
- } );
801
- }
802
- if ( fileList?.data.length ) {
803
- fileList.data.forEach( ( ele ) => {
804
- let splitStream = ele.Key.split( '/' );
805
- let getStream = splitStream[splitStream.length -1].split( '.' );
806
- if ( getStream && getStream[0] == `${req.body.storeId}_${camera.streamName}` ) {
807
- imgPath = ele.Key;
808
- }
809
- } );
810
- }
811
- if ( tagPath ) {
812
- const params = { file_path: tagPath,
813
- Bucket: JSON.parse( process.env.BUCKET ).zoneTaggingImage,
814
- };
815
- const cameraTagImage = await signedUrl( params );
816
- camera.tagImg = cameraTagImage;
817
- }
818
- if ( imgPath ) {
819
- const baseParams = { file_path: imgPath,
820
- Bucket: JSON.parse( process.env.BUCKET ).zoneBaseImage,
821
- };
822
- const cameraBaseImage = await signedUrl( baseParams );
823
- camera.baseImg = cameraBaseImage;
824
- }
825
- camera.tagging = tagList;
826
- cameraDetails[index] = camera;
827
- }
828
- cameraDetails.sort( ( a, b ) => a.tagging?.length > b.tagging?.length ? -1 : 1 );
829
- return res.sendSuccess( cameraDetails );
830
- } catch ( e ) {
831
- logger.error( { error: e, function: 'getCameraList' } );
832
- return res.sendError( e, 500 );
833
- }
834
- };
@@ -4,6 +4,7 @@ export const addTagSchema = joi.object( {
4
4
  clientId: joi.string().required(),
5
5
  tagName: joi.string().required(),
6
6
  storeId: joi.string().required(),
7
+ productName: joi.string().required(),
7
8
  rgbColor: joi.string().required(),
8
9
  rgbBorderColor: joi.string().required(),
9
10
  } );
@@ -52,6 +53,8 @@ export const validateTaggingSchema = joi.object( {
52
53
  streamName: joi.string().required(),
53
54
  redoPoint: joi.boolean().optional(),
54
55
  redraw: joi.boolean().optional(),
56
+ productName: joi.string().required(),
57
+ checkListName: joi.string().optional(),
55
58
  } );
56
59
 
57
60
  export const validateTaggingParams = {
@@ -97,13 +100,3 @@ export const updateCoordinatesSchema= joi.object( {
97
100
  export const updateCoordinatesParams = {
98
101
  body: updateCoordinatesSchema,
99
102
  };
100
-
101
- export const getStreamSchema= joi.object( {
102
- storeId: joi.string().required(),
103
- clientId: joi.string().required(),
104
- streamName: joi.string().required(),
105
- } );
106
-
107
- export const getStreamParams = {
108
- body: getStreamSchema,
109
- };
@@ -9,15 +9,17 @@ export const zoneTaggingRouter = express.Router();
9
9
 
10
10
  zoneTaggingRouter.post( '/addCustomTag', isAllowedSessionHandler, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoEye', name: 'ZoneTag', permissions: [ 'isAdd' ] } ] } ), validate( validation.validateAddTagParams ), tagController.addCustomTag );
11
11
  zoneTaggingRouter.get( '/customTagList', isAllowedSessionHandler, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoEye', name: 'ZoneTag', permissions: [ ] } ] } ), validate( validation.validateTagParams ), tagController.customTagList );
12
+ zoneTaggingRouter.get( '/customTagListv2', isAllowedSessionHandler, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoEye', name: 'ZoneTag', permissions: [ ] } ] } ), tagController.customTagListv2 );
12
13
  zoneTaggingRouter.post( '/tagging', isAllowedSessionHandler, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoEye', name: 'ZoneTag', permissions: [ 'isEdit' ] } ] } ), validate( validation.validateTaggingParams ), tagController.tagging );
13
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 );
14
16
  zoneTaggingRouter.post( '/updateCustomTag', isAllowedSessionHandler, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoEye', name: 'ZoneTag', permissions: [ 'isEdit' ] } ] } ), validate( validation.validateUpdateTagParams ), tagController.updateTag );
15
17
  zoneTaggingRouter.post( '/deleteCustomTag', isAllowedSessionHandler, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoEye', name: 'ZoneTag', permissions: [ 'isEdit' ] } ] } ), validate( validation.validateDeleteTagParams ), tagController.deleteTag );
16
18
  zoneTaggingRouter.get( '/getCameraTagging', isAllowedSessionHandler, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoEye', name: 'ZoneTag', permissions: [ ] } ] } ), validate( validation.validateCameraTagParams ), tagController.getCameraTagging );
17
19
  zoneTaggingRouter.get( '/getZoneTagging', isAllowedSessionHandler, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoEye', name: 'ZoneTag', permissions: [ ] } ] } ), validate( validation.validateZonetagParams ), tagController.getZoneList );
18
20
  zoneTaggingRouter.post( '/updatezoneTagging', isAllowedSessionHandler, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoEye', name: 'ZoneTag', permissions: [ 'isEdit' ] } ] } ), validate( validation.validateCamZonetagParams ), tagController.updatezoneTagging );
19
21
  zoneTaggingRouter.post( '/deleteZoneTag', isAllowedSessionHandler, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoEye', name: 'ZoneTag', permissions: [ 'isEdit' ] } ] } ), validate( validation.updateCoordinatesParams ), tagController.deletezoneTagging );
20
- zoneTaggingRouter.post( '/getStreamDetails', isAllowedSessionHandler, validate( validation.getStreamParams ), tagController.getCameraStreamList );
22
+ zoneTaggingRouter.post( '/updateCamera', isAllowedSessionHandler, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoEye', name: 'ZoneTag', permissions: [ 'isEdit' ] } ] } ), tagController.updateCamera );
21
23
 
22
24
  zoneTaggingRouter.get( '/updateOldZone', tagController.updateOldData );
23
25
 
@@ -0,0 +1,35 @@
1
+ import model from 'tango-api-schema';
2
+
3
+ export const find = ( query = {}, record = {} ) => {
4
+ return model.processedchecklistconfigModel.find( query, record );
5
+ };
6
+
7
+ export const findOne = ( query = {}, record = {} ) => {
8
+ return model.processedchecklistconfigModel.findOne( query, record ).sort( { updatedAt: -1 } );
9
+ };
10
+
11
+ export const updateOne = ( query = {}, record = {} ) => {
12
+ return model.processedchecklistconfigModel.updateOne( query, { $set: record }, { upsert: true } );
13
+ };
14
+
15
+ export const updateMany = ( query = {}, record = {} ) => {
16
+ return model.processedchecklistconfigModel.updateMany( query, { $set: record } );
17
+ };
18
+
19
+ export const deleteMany = ( query = {} ) => {
20
+ return model.processedchecklistconfigModel.deleteMany( query );
21
+ };
22
+
23
+ export const aggregate = ( query = [] ) => {
24
+ return model.processedchecklistconfigModel.aggregate( query );
25
+ };
26
+
27
+ export const getClientCount = ( query = {} ) => {
28
+ return model.processedchecklistconfigModel.count( query );
29
+ };
30
+
31
+ export const insert = ( document={} ) => {
32
+ return model.processedchecklistconfigModel.create( document );
33
+ };
34
+
35
+