tango-app-api-client 3.0.40-dev → 3.0.42-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.40-dev",
3
+ "version": "3.0.42-dev",
4
4
  "description": "client",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -25,8 +25,8 @@
25
25
  "mongodb": "^6.3.0",
26
26
  "nodemon": "^3.0.3",
27
27
  "swagger-ui-express": "^5.0.0",
28
+ "tango-app-api-middleware": "^1.0.72-test",
28
29
  "tango-api-schema": "^2.0.93",
29
- "tango-app-api-middleware": "^3.1.9",
30
30
  "winston": "^3.11.0",
31
31
  "winston-daily-rotate-file": "^5.0.0"
32
32
  },
@@ -486,7 +486,9 @@ export async function updateBrandInfo( req, res ) {
486
486
  eventType: 'update',
487
487
  };
488
488
 
489
- await insertOpenSearchData( 'tango-retail-activity-logs', logObj );
489
+ if ( updateKeys.length ) {
490
+ await insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
491
+ }
490
492
 
491
493
 
492
494
  const updateAck = await brandInfoUpdate( {
@@ -580,7 +582,10 @@ export async function updateBillingDetails( req, res ) {
580
582
  eventType: 'update',
581
583
  };
582
584
 
583
- await insertOpenSearchData( 'tango-retail-activity-logs', logObj );
585
+ if ( updateKeys.length ) {
586
+ await insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
587
+ }
588
+
584
589
 
585
590
  const updateAck = await billingDetailsUpdate( {
586
591
  clientId: req.params?.id, tradeName: req.body?.tradeName, gstNumber: req.body?.gstNumber,
@@ -618,7 +623,10 @@ export async function updateSignatoryDetails( req, res ) {
618
623
  eventType: 'update',
619
624
  };
620
625
 
621
- await insertOpenSearchData( 'tango-retail-activity-logs', logObj );
626
+ if ( updateKeys.length ) {
627
+ await insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
628
+ }
629
+
622
630
  const updateAck = await signatoryDetailsUpdate( {
623
631
  clientId: req.params?.id, name: req.body?.name, email: req.body?.email,
624
632
  number: req.body?.number, designation: req.body?.designation,
@@ -660,7 +668,10 @@ export async function updateTicketConfiguration( req, res ) {
660
668
  changes: updateKeys,
661
669
  eventType: 'update',
662
670
  };
663
- await insertOpenSearchData( 'tango-retail-activity-logs', logObj );
671
+
672
+ if ( updateKeys.length ) {
673
+ await insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
674
+ }
664
675
 
665
676
  if ( updateAck ) {
666
677
  res.sendSuccess( { result: 'Updated Successfully' } );
@@ -745,7 +756,9 @@ export async function updateFeatureConfiguration( req, res ) {
745
756
  changes: updateKeys,
746
757
  eventType: 'update',
747
758
  };
748
- await insertOpenSearchData( 'tango-retail-activity-logs', logObj );
759
+ if ( updateKeys.length ) {
760
+ await insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
761
+ }
749
762
 
750
763
  if ( updateAck ) {
751
764
  res.sendSuccess( { result: 'Updated Successfully' } );
@@ -785,7 +798,10 @@ export async function domainDetailsConfiguration( req, res ) {
785
798
  eventType: 'update',
786
799
  };
787
800
 
788
- await insertOpenSearchData( 'tango-retail-activity-logs', logObj );
801
+ if ( updateKeys.length ) {
802
+ await insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
803
+ }
804
+
789
805
  if ( updateAck ) {
790
806
  res.sendSuccess( { result: 'Updated Successfully' } );
791
807
  }
@@ -895,7 +911,9 @@ export async function updateDocuments( req, res ) {
895
911
  eventType: 'update',
896
912
  };
897
913
 
898
- await insertOpenSearchData( 'tango-retail-activity-logs', logObj );
914
+ if ( updateKeys.length ) {
915
+ await insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
916
+ }
899
917
 
900
918
  if ( updateAck ) {
901
919
  res.sendSuccess( { result: 'Updated Successfully' } );
@@ -959,7 +977,9 @@ export async function auditConfiguration( req, res ) {
959
977
  logObj.changes = [ `Audit config bulk` ];
960
978
  }
961
979
 
962
- await insertOpenSearchData( 'tango-retail-activity-logs', logObj );
980
+ if ( updateKeys.length ) {
981
+ await insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
982
+ }
963
983
 
964
984
  res.sendSuccess( { result: 'Updated Successfully' } );
965
985
  } catch ( error ) {
@@ -1276,8 +1296,13 @@ export async function clientList( req, res ) {
1276
1296
  list.push( {
1277
1297
  'client Name': chunk[i]?.clientName,
1278
1298
  'client Id': chunk[i]?.clientId,
1299
+ 'Installation Stores Count': chunk[i]?.installedStores || 0,
1300
+ 'Onboarded Stores Count': chunk[i]?.totalStores,
1301
+ 'Store Progress': chunk[i]?.installedStores? `${ ( ( chunk[i]?.installedStores/ chunk[i]?.totalStores )* 100 ).toFixed( 0 )}%`: '0%',
1279
1302
  'Active Store': chunk[i]?.activeStoreCount || 0,
1280
1303
  'Active Camera': chunk[i]?.activeCameraCount && chunk[i]?.activeCameraCount != undefined ? chunk[i]?.activeCameraCount : 0,
1304
+ 'Pending Stores': chunk[i]?.pendingStores || 0,
1305
+ 'Failed Stores': chunk[i]?.failedStores || 0,
1281
1306
  'Payment Status': chunk[i]?.paymentStatus,
1282
1307
  'Subs Plan': chunk[i]?.subscriptionType,
1283
1308
  'Status': chunk[i]?.status,
@@ -1349,7 +1374,10 @@ export async function detailedClientCount( req, res ) {
1349
1374
  export async function getActivityLogs( req, res ) {
1350
1375
  try {
1351
1376
  const query = {
1352
- '_source': [ 'userId', 'userName', 'email', 'date', 'logType', 'logSubType', 'changes', 'eventType' ],
1377
+ '_source': [
1378
+ 'userId', 'userName', 'email', 'date', 'logType', 'logSubType',
1379
+ 'changes', 'eventType',
1380
+ ],
1353
1381
  'query': {
1354
1382
  'bool': {
1355
1383
  'must': [
@@ -1363,6 +1391,13 @@ export async function getActivityLogs( req, res ) {
1363
1391
  },
1364
1392
  'from': ( req.body.offset - 1 ) * req.body.limit,
1365
1393
  'size': req.body.limit,
1394
+ 'sort': [
1395
+ {
1396
+ 'date': {
1397
+ 'order': 'desc',
1398
+ },
1399
+ },
1400
+ ],
1366
1401
  };
1367
1402
 
1368
1403
  if ( req.body?.logTypeFilters?.length ) {
@@ -1386,7 +1421,7 @@ export async function getActivityLogs( req, res ) {
1386
1421
  } );
1387
1422
  }
1388
1423
 
1389
- const logs = await getOpenSearchData( 'tango-retail-activity-logs', query );
1424
+ const logs = await getOpenSearchData( appConfig.opensearch.activityLog, query );
1390
1425
 
1391
1426
  const hits = logs?.body?.hits?.hits;
1392
1427
  const totalDocuments = logs?.body?.hits?.total?.value;
@@ -1402,6 +1437,7 @@ export async function getActivityLogs( req, res ) {
1402
1437
  }
1403
1438
  }
1404
1439
 
1440
+
1405
1441
  async function postApi( url, data ) {
1406
1442
  const requestOptions = {
1407
1443
  method: 'POST',