tango-app-api-client 3.0.59-dev → 3.0.61-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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-app-api-client",
3
- "version": "3.0.59-dev",
3
+ "version": "3.0.61-dev",
4
4
  "description": "client",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -526,7 +526,18 @@ export async function detailedAllClientCount( req, res ) {
526
526
  },
527
527
  ];
528
528
  const result = await aggregateClient( query );
529
- const activeStores = await findStore( { 'status': 'active', 'edge.firstFile': true }, { storeId: 1 } );
529
+ const activeStores = await findStore( { 'status': 'active' }, { storeId: 1 } );
530
+ let yettoInstallCount = await aggregateTickets( [
531
+ {
532
+ $match: {
533
+ $and: [
534
+ { issueType: 'installation' },
535
+ { 'status': { $ne: 'closed' } },
536
+ ],
537
+ },
538
+ },
539
+ ] );
540
+
530
541
  let storesList = [];
531
542
  for ( let store of activeStores ) {
532
543
  storesList.push( store.storeId );
@@ -535,7 +546,7 @@ export async function detailedAllClientCount( req, res ) {
535
546
  if ( result.length == 0 ) {
536
547
  return res.sendError( 'No Data Found', 204 );
537
548
  }
538
- result[0].activeStoresCount = activeStores.length;
549
+ result[0].activeStoresCount = activeStores.length-yettoInstallCount.length;
539
550
  result[0].activeCameraCount = activeCameras;
540
551
  return res.sendSuccess( { result: result } );
541
552
  } catch ( error ) {
@@ -1695,6 +1706,19 @@ export async function clientListV1( req, res ) {
1695
1706
  clientName: 1,
1696
1707
  subscriptionPlan: 1,
1697
1708
  PaymentPlan: 1,
1709
+ PaymentPlan: {
1710
+ $cond: {
1711
+ if: { $eq: [ '$PaymentPlan', 'unbilled' ] },
1712
+ then: 'paid',
1713
+ else: {
1714
+ $cond: {
1715
+ if: { $eq: [ '$PaymentPlan', 'due' ] },
1716
+ then: 'paid',
1717
+ else: '$PaymentPlan',
1718
+ },
1719
+ },
1720
+ },
1721
+ },
1698
1722
  installedPending: 1,
1699
1723
  installedFailed: 1,
1700
1724
  ProgressBar: {
@@ -1719,32 +1743,44 @@ export async function clientListV1( req, res ) {
1719
1743
  }
1720
1744
 
1721
1745
  if ( inputData.sortColumName&&inputData.sortColumName!=''&& req.body.sortBy&&req.body.sortBy!='' ) {
1722
- clientQuery.push( {
1723
- $sort: { [req.body.sortColumName]: req.body.sortBy },
1724
- },
1725
- );
1746
+ if ( inputData.sortColumName==='clientName' ) {
1747
+ clientQuery.push(
1748
+ {
1749
+ $project: {
1750
+ clientId: 1,
1751
+ onboardedStores: 1,
1752
+ installedStore: 1,
1753
+ activeStores: 1,
1754
+ InactiveStores: 1,
1755
+ ProcessingStatus: 1,
1756
+ clientName: 1,
1757
+ subscriptionPlan: 1,
1758
+ PaymentPlan: 1,
1759
+ PaymentPlan: 1,
1760
+ installedPending: 1,
1761
+ installedFailed: 1,
1762
+ ProgressBar: 1,
1763
+ sortField: {
1764
+ '$toLower': `$${req.body.sortColumName}`,
1765
+ },
1766
+ },
1767
+ },
1768
+ {
1769
+ $sort: { sortField: req.body.sortBy },
1770
+ },
1771
+ );
1772
+ } else {
1773
+ clientQuery.push( {
1774
+ $sort: { [req.body.sortColumName]: req.body.sortBy },
1775
+ } );
1776
+ }
1726
1777
  } else {
1727
1778
  clientQuery.push( {
1728
1779
  $sort: { activeStores: -1 },
1729
1780
  },
1730
1781
  );
1731
1782
  }
1732
- clientQuery.push( {
1733
- $project: {
1734
- clientId: { $toString: '$clientId' },
1735
- onboardedStores: 1,
1736
- installedStore: 1,
1737
- activeStores: 1,
1738
- InactiveStores: 1,
1739
- ProcessingStatus: 1,
1740
- clientName: 1,
1741
- subscriptionPlan: 1,
1742
- PaymentPlan: 1,
1743
- installedPending: 1,
1744
- installedFailed: 1,
1745
- ProgressBar: 1,
1746
- },
1747
- } );
1783
+
1748
1784
  if ( req.body.limit && req.body.offset && !req.body.isExport ) {
1749
1785
  clientQuery.push(
1750
1786
  { $skip: ( req.body.offset - 1 ) * req.body.limit },
@@ -1758,7 +1794,7 @@ export async function clientListV1( req, res ) {
1758
1794
  for ( let client of clientList ) {
1759
1795
  exportResult.push( {
1760
1796
  'Brand Name': client.clientName,
1761
- 'Brand Id': client.clientId,
1797
+ 'Brand ID': client.clientId,
1762
1798
  'Onboarded Stores': client.onboardedStores||0,
1763
1799
  'Installed Stores': client.installedStore || 0,
1764
1800
  'Progress Status': client.ProgressBar||0,
@@ -1767,7 +1803,7 @@ export async function clientListV1( req, res ) {
1767
1803
  'Pending Configuration': client.installedPending || 0,
1768
1804
  'Payment Plan': client.PaymentPlan == 'free'?'Lifetime Free':client.PaymentPlan,
1769
1805
  'Subscription Plan': client.subscriptionPlan,
1770
- 'Processing Status': client.ProcessingStatus=='active'?'Activated':client.ProcessingStatus?'deactive':client.ProcessingStatus,
1806
+ 'Processing Status': client.ProcessingStatus=='active'?'Activated':client.ProcessingStatus=='deactive'?'Deactivated':client.ProcessingStatus,
1771
1807
  } );
1772
1808
  }
1773
1809
  await download( exportResult, res );