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
|
@@ -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
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
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
|
-
|
|
523
|
-
|
|
524
|
-
zone: '$tagName',
|
|
526
|
+
{
|
|
527
|
+
$group: {
|
|
528
|
+
_id: '$tagName', // group by tagName → unique values
|
|
529
|
+
},
|
|
525
530
|
},
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
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
|
-
|
|
531
|
-
|
|
532
|
-
|
|
540
|
+
if ( !zoneList.length ) {
|
|
541
|
+
return res.sendError( 'no data found', 204 );
|
|
542
|
+
}
|
|
533
543
|
|
|
534
|
-
|
|
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 );
|