tango-app-api-client 3.0.51-dev → 3.0.51-test

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-client",
3
- "version": "3.0.51-dev",
3
+ "version": "3.0.51-test",
4
4
  "description": "client",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1540,17 +1540,13 @@ export async function clientListV1( req, res ) {
1540
1540
  subscriptionType: 1,
1541
1541
  PaymentPlan: 1,
1542
1542
  installed: {
1543
- $cond: [ { $or: [ { $eq: [ '$stores.edge.firstFile', true ] } ] }, 1, 0,
1543
+ $cond: [ { $and: [ { $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
- },
1554
1550
  },
1555
1551
  },
1556
1552
  {
@@ -1560,7 +1556,6 @@ export async function clientListV1( req, res ) {
1560
1556
  onboardedStores: { $sum: 1 },
1561
1557
  installedStore: { $sum: '$installed' },
1562
1558
  activeStores: { $sum: '$activeStores' },
1563
- InactiveStores: { $sum: '$InactiveStores' },
1564
1559
  ProcessingStatus: { $first: '$status' },
1565
1560
  clientName: { $first: '$clientName' },
1566
1561
  subscriptionPlan: { $first: '$subscriptionType' },
@@ -1606,7 +1601,6 @@ export async function clientListV1( req, res ) {
1606
1601
  subscriptionPlan: 1,
1607
1602
  installedStore: 1,
1608
1603
  activeStores: 1,
1609
- InactiveStores: 1,
1610
1604
  installedPending: {
1611
1605
  $cond: [ { $and: [ { $ne: [ '$ticket.status', 'closed' ] } ] }, 1, 0 ],
1612
1606
  },
@@ -1622,7 +1616,6 @@ export async function clientListV1( req, res ) {
1622
1616
  onboardedStores: { $first: '$onboardedStores' },
1623
1617
  installedStore: { $first: '$installedStore' },
1624
1618
  activeStores: { $first: '$activeStores' },
1625
- InactiveStores: { $first: '$InactiveStores' },
1626
1619
  ProcessingStatus: { $first: '$ProcessingStatus' },
1627
1620
  clientName: { $first: '$clientName' },
1628
1621
  subscriptionPlan: { $first: '$subscriptionPlan' },
@@ -1631,33 +1624,6 @@ export async function clientListV1( req, res ) {
1631
1624
  installedFailed: { $sum: '$installedFailed' },
1632
1625
  },
1633
1626
  },
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
- },
1661
1627
  );
1662
1628
 
1663
1629
  const clientCount = await aggregateClient( clientQuery );
@@ -1665,16 +1631,11 @@ export async function clientListV1( req, res ) {
1665
1631
  return res.sendError( 'No Data Found', 204 );
1666
1632
  }
1667
1633
 
1668
- if ( inputData.sortColumName&&inputData.sortColumName!=''&& req.body.sortBy&&req.body.sortBy!='' ) {
1634
+ if ( inputData.sortColumName ) {
1669
1635
  clientQuery.push( {
1670
1636
  $sort: { [req.body.sortColumName]: req.body.sortBy },
1671
1637
  },
1672
1638
  );
1673
- } else {
1674
- clientQuery.push( {
1675
- $sort: { activeStores: -1 },
1676
- },
1677
- );
1678
1639
  }
1679
1640
  if ( req.body.limit && req.body.offset && !req.body.isExport ) {
1680
1641
  clientQuery.push(
@@ -1688,16 +1649,17 @@ export async function clientListV1( req, res ) {
1688
1649
  const exportResult = [];
1689
1650
  for ( let client of clientList ) {
1690
1651
  exportResult.push( {
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,
1652
+ 'client Name': client.clientName,
1653
+ 'client Id': client.clientId,
1654
+ 'Installation Stores Count': client.installedStore || 0,
1655
+ 'Onboarded Stores Count': client.onboardedStores,
1656
+ 'Store Progress': client.onboardedStores ? `${Math.round( ( client.onboardedStores / client.installedStore ) * 100 )}%` : '0%',
1657
+ 'Active Store': client.activeStores || 0,
1658
+ 'installedPending Stores': client.installedPending || 0,
1659
+ 'installedFailed Stores': client.installedFailed || 0,
1660
+ 'PaymentPlan': client.PaymentPlan,
1661
+ 'subscriptionPlan': client.subscriptionPlan,
1662
+ 'ProcessingStatus': client.ProcessingStatus,
1701
1663
  } );
1702
1664
  }
1703
1665
  await download( exportResult, res );