tango-app-api-client 3.1.16 → 3.1.17

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.1.16",
3
+ "version": "3.1.17",
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 ) {
@@ -1732,32 +1743,44 @@ export async function clientListV1( req, res ) {
1732
1743
  }
1733
1744
 
1734
1745
  if ( inputData.sortColumName&&inputData.sortColumName!=''&& req.body.sortBy&&req.body.sortBy!='' ) {
1735
- clientQuery.push( {
1736
- $sort: { [req.body.sortColumName]: req.body.sortBy },
1737
- },
1738
- );
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
+ }
1739
1777
  } else {
1740
1778
  clientQuery.push( {
1741
1779
  $sort: { activeStores: -1 },
1742
1780
  },
1743
1781
  );
1744
1782
  }
1745
- clientQuery.push( {
1746
- $project: {
1747
- clientId: { $toString: '$clientId' },
1748
- onboardedStores: 1,
1749
- installedStore: 1,
1750
- activeStores: 1,
1751
- InactiveStores: 1,
1752
- ProcessingStatus: 1,
1753
- clientName: 1,
1754
- subscriptionPlan: 1,
1755
- PaymentPlan: 1,
1756
- installedPending: 1,
1757
- installedFailed: 1,
1758
- ProgressBar: 1,
1759
- },
1760
- } );
1783
+
1761
1784
  if ( req.body.limit && req.body.offset && !req.body.isExport ) {
1762
1785
  clientQuery.push(
1763
1786
  { $skip: ( req.body.offset - 1 ) * req.body.limit },