tango-app-api-trax 3.7.4-airtelv2-3 → 3.7.4-airtelv2-4

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-trax",
3
- "version": "3.7.4-airtelv2-3",
3
+ "version": "3.7.4-airtelv2-4",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -512,26 +512,58 @@ export const userlist = async ( req, res ) => {
512
512
 
513
513
  export const zoneList = async ( req, res ) => {
514
514
  try {
515
- let query = [
516
- {
517
- $match: {
518
- clientId: req.query.clientId,
515
+ let inputBody = req.query;
516
+
517
+ if ( inputBody.checkListName && inputBody.checkListName == 'Outside Business Hours Queue Tracking' ) {
518
+ let query = [
519
+ {
520
+ $match: {
521
+ clientId: inputBody.clientId,
522
+ productName: 'tangoTrax',
523
+ checkListName: inputBody.checkListName,
524
+ },
519
525
  },
520
- },
521
- {
522
- $project: {
523
- _id: 0,
524
- zone: '$tagName',
526
+ {
527
+ $group: {
528
+ _id: '$tagName', // group by tagName → unique values
529
+ },
525
530
  },
526
- },
527
- ];
528
- let zoneList = await tagService.aggregate( query );
531
+ {
532
+ $project: {
533
+ _id: 0,
534
+ zone: '$_id', // rename _id → tagName
535
+ },
536
+ },
537
+ ];
538
+ let zoneList = await tagService.aggregate( query );
529
539
 
530
- if ( !zoneList.length ) {
531
- return res.sendError( 'no data found', 204 );
532
- }
540
+ if ( !zoneList.length ) {
541
+ return res.sendError( 'no data found', 204 );
542
+ }
533
543
 
534
- return res.sendSuccess( zoneList );
544
+ return res.sendSuccess( zoneList );
545
+ } else {
546
+ let query = [
547
+ {
548
+ $match: {
549
+ clientId: req.query.clientId,
550
+ },
551
+ },
552
+ {
553
+ $project: {
554
+ _id: 0,
555
+ zone: '$tagName',
556
+ },
557
+ },
558
+ ];
559
+ let zoneList = await tagService.aggregate( query );
560
+
561
+ if ( !zoneList.length ) {
562
+ return res.sendError( 'no data found', 204 );
563
+ }
564
+
565
+ return res.sendSuccess( zoneList );
566
+ }
535
567
  } catch ( e ) {
536
568
  logger.error( 'zonelist =>', e );
537
569
  return res.sendError( e, 500 );