tango-app-api-client 3.0.50-dev → 3.0.51-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
|
@@ -1540,13 +1540,17 @@ export async function clientListV1( req, res ) {
|
|
|
1540
1540
|
subscriptionType: 1,
|
|
1541
1541
|
PaymentPlan: 1,
|
|
1542
1542
|
installed: {
|
|
1543
|
-
$cond: [ { $
|
|
1543
|
+
$cond: [ { $or: [ { $eq: [ '$stores.edge.firstFile', true ] } ] }, 1, 0,
|
|
1544
1544
|
],
|
|
1545
1545
|
},
|
|
1546
1546
|
activeStores: {
|
|
1547
1547
|
$cond: [ { $and: [ { $eq: [ '$stores.status', 'active' ] }, { $eq: [ '$stores.edge.firstFile', true ] } ] }, 1, 0,
|
|
1548
1548
|
],
|
|
1549
1549
|
},
|
|
1550
|
+
InactiveStores: {
|
|
1551
|
+
$cond: [ { $and: [ { $ne: [ '$stores.status', 'active' ] } ] }, 1, 0,
|
|
1552
|
+
],
|
|
1553
|
+
},
|
|
1550
1554
|
},
|
|
1551
1555
|
},
|
|
1552
1556
|
{
|
|
@@ -1556,6 +1560,7 @@ export async function clientListV1( req, res ) {
|
|
|
1556
1560
|
onboardedStores: { $sum: 1 },
|
|
1557
1561
|
installedStore: { $sum: '$installed' },
|
|
1558
1562
|
activeStores: { $sum: '$activeStores' },
|
|
1563
|
+
InactiveStores: { $sum: '$InactiveStores' },
|
|
1559
1564
|
ProcessingStatus: { $first: '$status' },
|
|
1560
1565
|
clientName: { $first: '$clientName' },
|
|
1561
1566
|
subscriptionPlan: { $first: '$subscriptionType' },
|
|
@@ -1601,6 +1606,7 @@ export async function clientListV1( req, res ) {
|
|
|
1601
1606
|
subscriptionPlan: 1,
|
|
1602
1607
|
installedStore: 1,
|
|
1603
1608
|
activeStores: 1,
|
|
1609
|
+
InactiveStores: 1,
|
|
1604
1610
|
installedPending: {
|
|
1605
1611
|
$cond: [ { $and: [ { $ne: [ '$ticket.status', 'closed' ] } ] }, 1, 0 ],
|
|
1606
1612
|
},
|
|
@@ -1616,6 +1622,7 @@ export async function clientListV1( req, res ) {
|
|
|
1616
1622
|
onboardedStores: { $first: '$onboardedStores' },
|
|
1617
1623
|
installedStore: { $first: '$installedStore' },
|
|
1618
1624
|
activeStores: { $first: '$activeStores' },
|
|
1625
|
+
InactiveStores: { $first: '$InactiveStores' },
|
|
1619
1626
|
ProcessingStatus: { $first: '$ProcessingStatus' },
|
|
1620
1627
|
clientName: { $first: '$clientName' },
|
|
1621
1628
|
subscriptionPlan: { $first: '$subscriptionPlan' },
|
|
@@ -1624,6 +1631,33 @@ export async function clientListV1( req, res ) {
|
|
|
1624
1631
|
installedFailed: { $sum: '$installedFailed' },
|
|
1625
1632
|
},
|
|
1626
1633
|
},
|
|
1634
|
+
{
|
|
1635
|
+
$project: {
|
|
1636
|
+
clientId: 1,
|
|
1637
|
+
onboardedStores: 1,
|
|
1638
|
+
installedStore: 1,
|
|
1639
|
+
activeStores: 1,
|
|
1640
|
+
InactiveStores: 1,
|
|
1641
|
+
ProcessingStatus: 1,
|
|
1642
|
+
clientName: 1,
|
|
1643
|
+
subscriptionPlan: 1,
|
|
1644
|
+
PaymentPlan: 1,
|
|
1645
|
+
installedPending: 1,
|
|
1646
|
+
installedFailed: 1,
|
|
1647
|
+
ProgressBar: {
|
|
1648
|
+
$cond: {
|
|
1649
|
+
if: { $eq: [ '$onboardedStores', 0 ] },
|
|
1650
|
+
then: 0,
|
|
1651
|
+
else: {
|
|
1652
|
+
$round: [
|
|
1653
|
+
{ $multiply: [ { $divide: [ '$installedStore', '$onboardedStores' ] }, 100 ] },
|
|
1654
|
+
0,
|
|
1655
|
+
],
|
|
1656
|
+
},
|
|
1657
|
+
},
|
|
1658
|
+
},
|
|
1659
|
+
},
|
|
1660
|
+
},
|
|
1627
1661
|
);
|
|
1628
1662
|
|
|
1629
1663
|
const clientCount = await aggregateClient( clientQuery );
|
|
@@ -1631,11 +1665,16 @@ export async function clientListV1( req, res ) {
|
|
|
1631
1665
|
return res.sendError( 'No Data Found', 204 );
|
|
1632
1666
|
}
|
|
1633
1667
|
|
|
1634
|
-
if ( inputData.sortColumName ) {
|
|
1668
|
+
if ( inputData.sortColumName&&inputData.sortColumName!=''&& req.body.sortBy&&req.body.sortBy!='' ) {
|
|
1635
1669
|
clientQuery.push( {
|
|
1636
1670
|
$sort: { [req.body.sortColumName]: req.body.sortBy },
|
|
1637
1671
|
},
|
|
1638
1672
|
);
|
|
1673
|
+
} else {
|
|
1674
|
+
clientQuery.push( {
|
|
1675
|
+
$sort: { activeStores: -1 },
|
|
1676
|
+
},
|
|
1677
|
+
);
|
|
1639
1678
|
}
|
|
1640
1679
|
if ( req.body.limit && req.body.offset && !req.body.isExport ) {
|
|
1641
1680
|
clientQuery.push(
|
|
@@ -1649,17 +1688,16 @@ export async function clientListV1( req, res ) {
|
|
|
1649
1688
|
const exportResult = [];
|
|
1650
1689
|
for ( let client of clientList ) {
|
|
1651
1690
|
exportResult.push( {
|
|
1652
|
-
'
|
|
1653
|
-
'
|
|
1654
|
-
'
|
|
1655
|
-
'
|
|
1656
|
-
'
|
|
1657
|
-
'
|
|
1658
|
-
'
|
|
1659
|
-
'
|
|
1660
|
-
'
|
|
1661
|
-
'
|
|
1662
|
-
'ProcessingStatus': client.ProcessingStatus,
|
|
1691
|
+
'Brand Name': client.clientName,
|
|
1692
|
+
'Brand Id': client.clientId,
|
|
1693
|
+
'Installed Number of Store': client.installedStore || 0,
|
|
1694
|
+
'Active Stores': client.activeStores || 0,
|
|
1695
|
+
'InActive Stores': client.activeStores || 0,
|
|
1696
|
+
'Progress Bar': ProgressBar||0,
|
|
1697
|
+
'Pending Install': client.installedPending || 0,
|
|
1698
|
+
'Payment Plan': client.PaymentPlan,
|
|
1699
|
+
'Subscription Plan': client.subscriptionPlan,
|
|
1700
|
+
'Processing Status': client.ProcessingStatus,
|
|
1663
1701
|
} );
|
|
1664
1702
|
}
|
|
1665
1703
|
await download( exportResult, res );
|