tango-app-api-client 3.3.2-beta.2 → 3.3.2-beta.3

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.3.2-beta.2",
3
+ "version": "3.3.2-beta.3",
4
4
  "description": "client",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -17,7 +17,6 @@ import { createPaymentAccount } from '../service/paymentAccount.service.js';
17
17
  import { countDocumentsClusters } from '../service/cluster.service.js';
18
18
 
19
19
 
20
-
21
20
  export async function create( req, res ) {
22
21
  try {
23
22
  const url = JSON.parse( process.env.URL );
@@ -80,18 +79,36 @@ export async function create( req, res ) {
80
79
  'auditConfigs.traxQueueName.uniformDetection': `${generatedName}-uniformDetection`,
81
80
  'auditConfigs.traxQueueName.mobileDetection': `${generatedName}-mobileDetection`,
82
81
  'auditConfigs.traxQueueName.cameraAngleChange': `${generatedName}-cameraAngleChange`,
83
-
84
-
85
82
  };
86
83
 
84
+
85
+ if ( product && product.length > 0 ) {
86
+ for ( let data of product ) {
87
+ console.log( data.productName );
88
+ record.featureConfigs = {};
89
+ if ( data.productName === 'tangoTraffic' ) {
90
+ record.featureConfigs.isNewDashboard = true;
91
+ record.featureConfigs.isNewTraffic = true;
92
+ record.featureConfigs.isNewReports = true;
93
+ }
94
+ if ( data.productName === 'tangozone' ) {
95
+ record.featureConfigs.isNewZone = true;
96
+ }
97
+ if ( data.productName === 'tangoTrax' ) {
98
+ record.featureConfigs. isTrax= true;
99
+ }
100
+ }
101
+ }
87
102
  const insertClient = await insert( record );
88
103
 
89
104
  const insertedClientRecord = await findOneClient( { clientId: record.clientId }, {} );
90
105
 
91
106
  const customer = await createCustomer( { name: user.userName, email: user.email, clientId: insertedClientRecord.clientId } );
92
107
 
93
- const virtualAccount = await createVirtualAccount( { receiverTypes: [ 'bank_account' ], description: `Virtual Account for ${insertedClientRecord.clientId}`,
94
- customerId: customer.id, notes: { createdAt: new Date(), createdBy: req.user?.email } } );
108
+ const virtualAccount = await createVirtualAccount( {
109
+ receiverTypes: [ 'bank_account' ], description: `Virtual Account for ${insertedClientRecord.clientId}`,
110
+ customerId: customer.id, notes: { createdAt: new Date(), createdBy: req.user?.email },
111
+ } );
95
112
 
96
113
  const paymentAccount = {
97
114
  clientId: insertedClientRecord.clientId,
@@ -547,7 +564,7 @@ export async function detailedAllClientCount( req, res ) {
547
564
  ];
548
565
  const clientList = await aggregateUserAssignedStore( clientQuery );
549
566
  if ( clientList[0]?.clientId?.length != 0 ) {
550
- Assinedclient= clientList[0]?.clientId;
567
+ Assinedclient = clientList[0]?.clientId;
551
568
  }
552
569
  }
553
570
  const query = [
@@ -621,7 +638,8 @@ export async function detailedAllClientCount( req, res ) {
621
638
  const result = await aggregateClient( query );
622
639
  const activeStores = await findStore( {
623
640
  'clientId': { $in: Assinedclient },
624
- 'status': 'active' }, { storeId: 1 } );
641
+ 'status': 'active',
642
+ }, { storeId: 1 } );
625
643
  let yettoInstallCount = await aggregateTickets( [
626
644
  {
627
645
  $match: {
@@ -642,7 +660,7 @@ export async function detailedAllClientCount( req, res ) {
642
660
  if ( result.length == 0 ) {
643
661
  return res.sendError( 'No Data Found', 204 );
644
662
  }
645
- result[0].activeStoresCount = activeStores.length-yettoInstallCount.length;
663
+ result[0].activeStoresCount = activeStores.length - yettoInstallCount.length;
646
664
  result[0].activeCameraCount = activeCameras;
647
665
  return res.sendSuccess( { result: result } );
648
666
  } catch ( error ) {
@@ -1155,7 +1173,7 @@ export async function updateDocuments( req, res ) {
1155
1173
 
1156
1174
  export async function getAuditConfiguration( req, res ) {
1157
1175
  try {
1158
- const query ={
1176
+ const query = {
1159
1177
  clientId: req.params?.id,
1160
1178
  };
1161
1179
  const fields = {
@@ -1182,14 +1200,14 @@ export async function auditConfiguration( req, res ) {
1182
1200
  try {
1183
1201
  const inputData = req.body;
1184
1202
  const openSearch = JSON.parse( process.env.OPENSEARCH );
1185
- const query ={
1203
+ const query = {
1186
1204
  clientId: req.params?.id,
1187
1205
  };
1188
- const fields ={
1206
+ const fields = {
1189
1207
  auditConfigs: 1, _id: 0,
1190
1208
  };
1191
1209
  const previousClient = await findOneClient( query, fields );
1192
- const record ={
1210
+ const record = {
1193
1211
  'auditConfigs.count': inputData.count,
1194
1212
  'auditConfigs.audit': inputData.audit,
1195
1213
  'auditConfigs.ratio': Number( normalizeNumber( inputData.ratio, 0, 100 ) ),
@@ -1803,10 +1821,12 @@ export async function clientListV1( req, res ) {
1803
1821
  clientId: { $toInt: '$clientId' },
1804
1822
  onboardedStores: 1,
1805
1823
  installedStore: 1,
1806
- activeStores: { $max: [
1807
- { $subtract: [ '$activeStores', '$installedPending' ] },
1808
- 0,
1809
- ] },
1824
+ activeStores: {
1825
+ $max: [
1826
+ { $subtract: [ '$activeStores', '$installedPending' ] },
1827
+ 0,
1828
+ ],
1829
+ },
1810
1830
  InactiveStores: 1,
1811
1831
  ProcessingStatus: 1,
1812
1832
  clientName: 1,
@@ -1848,8 +1868,8 @@ export async function clientListV1( req, res ) {
1848
1868
  return res.sendError( 'No Data Found', 204 );
1849
1869
  }
1850
1870
 
1851
- if ( inputData.sortColumName&&inputData.sortColumName!=''&& req.body.sortBy&&req.body.sortBy!='' ) {
1852
- if ( inputData.sortColumName==='clientName' ) {
1871
+ if ( inputData.sortColumName && inputData.sortColumName != '' && req.body.sortBy && req.body.sortBy != '' ) {
1872
+ if ( inputData.sortColumName === 'clientName' ) {
1853
1873
  clientQuery.push(
1854
1874
  {
1855
1875
  $project: {
@@ -1901,15 +1921,15 @@ export async function clientListV1( req, res ) {
1901
1921
  exportResult.push( {
1902
1922
  'Brand Name': client.clientName,
1903
1923
  'Brand ID': client.clientId,
1904
- 'Onboarded Stores': client.onboardedStores||0,
1924
+ 'Onboarded Stores': client.onboardedStores || 0,
1905
1925
  'Installed Stores': client.installedStore || 0,
1906
- 'Progress Status': client.ProgressBar||0,
1926
+ 'Progress Status': client.ProgressBar || 0,
1907
1927
  'Active Stores': client.activeStores || 0,
1908
1928
  'In-Active Stores': client.InactiveStores || 0,
1909
1929
  'Pending Configuration': client.installedPending || 0,
1910
- 'Payment Plan': client.PaymentPlan == 'free'?'Lifetime Free':client.PaymentPlan,
1930
+ 'Payment Plan': client.PaymentPlan == 'free' ? 'Lifetime Free' : client.PaymentPlan,
1911
1931
  'Subscription Plan': client.subscriptionPlan,
1912
- 'Processing Status': client.ProcessingStatus=='active'?'Activated':client.ProcessingStatus=='deactive'?'Deactivated':client.ProcessingStatus,
1932
+ 'Processing Status': client.ProcessingStatus == 'active' ? 'Activated' : client.ProcessingStatus == 'deactive' ? 'Deactivated' : client.ProcessingStatus,
1913
1933
  } );
1914
1934
  }
1915
1935
  await download( exportResult, res );
@@ -1973,7 +1993,7 @@ export async function detailedClientCount( req, res ) {
1973
1993
  },
1974
1994
  ] );
1975
1995
 
1976
- if ( findCsm&&findCsm.length>0 ) {
1996
+ if ( findCsm && findCsm.length > 0 ) {
1977
1997
  let finduser = await findOneUser( { email: findCsm[0].userEmail }, { userName: 1, email: 1, countryCode: 1, mobileNumber: 1 } );
1978
1998
  result['csm'] = finduser;
1979
1999
  }
@@ -23,5 +23,5 @@ export async function createclusterModel( data ) {
23
23
  return await clusterModel.create( data );
24
24
  };
25
25
  export function countDocumentsClusters( query ) {
26
- return clusterModel.countDocuments( query );
27
- }
26
+ return clusterModel.countDocuments( query );
27
+ }