tango-app-api-client 3.0.41-dev → 3.0.43-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.
|
|
3
|
+
"version": "3.0.43-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-api-
|
|
29
|
-
"tango-
|
|
28
|
+
"tango-app-api-middleware": "^1.0.72-test",
|
|
29
|
+
"tango-api-schema": "^2.0.103",
|
|
30
30
|
"winston": "^3.11.0",
|
|
31
31
|
"winston-daily-rotate-file": "^5.0.0"
|
|
32
32
|
},
|
|
@@ -180,6 +180,41 @@ export async function create( req, res ) {
|
|
|
180
180
|
|
|
181
181
|
await postApi( `${appConfig.url.oldapidomain}/oldDefaultRoleInsert`, oldDefaultRolesInsertData );
|
|
182
182
|
|
|
183
|
+
const logObj = {
|
|
184
|
+
clientId: insertedClientRecord.clientId,
|
|
185
|
+
userName: req.user?.userName,
|
|
186
|
+
email: req.user?.email,
|
|
187
|
+
date: new Date(),
|
|
188
|
+
logType: 'brandDetails',
|
|
189
|
+
logSubType: 'brandApproval',
|
|
190
|
+
changes: [ insertedClientRecord.clientName ],
|
|
191
|
+
eventType: 'approve',
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
await insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
|
|
195
|
+
|
|
196
|
+
for ( let index = 0; index < leadRecord?.planDetails?.product?.length; index++ ) {
|
|
197
|
+
const logObj = {
|
|
198
|
+
userName: req.user?.userName,
|
|
199
|
+
email: req.user?.email,
|
|
200
|
+
clientId: insertedClientRecord.clientId,
|
|
201
|
+
clientNotification: false,
|
|
202
|
+
adminNotification: true,
|
|
203
|
+
logSubType: 'startTrial',
|
|
204
|
+
description: 'Subscription - Your 14 Days free trial has been started',
|
|
205
|
+
title: 'Subscription',
|
|
206
|
+
alertCta: [],
|
|
207
|
+
markasRead: false,
|
|
208
|
+
logType: 'subscription',
|
|
209
|
+
showPushNotification: true,
|
|
210
|
+
date: new Date(),
|
|
211
|
+
changes: [ `${convertTitleCase( leadRecord?.planDetails?.product[index] )} trial started` ],
|
|
212
|
+
eventType: '',
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
await insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
|
|
216
|
+
}
|
|
217
|
+
|
|
183
218
|
|
|
184
219
|
if ( insertClient ) {
|
|
185
220
|
const userRecord = {
|
|
@@ -200,6 +235,13 @@ export async function create( req, res ) {
|
|
|
200
235
|
}
|
|
201
236
|
}
|
|
202
237
|
|
|
238
|
+
function convertTitleCase( data ) {
|
|
239
|
+
let [ firstWord, secondWord ] = data.replace( /([a-z])([A-Z])/g, '$1 $2' ).split( ' ' );
|
|
240
|
+
firstWord = firstWord.charAt( 0 ).toUpperCase() + firstWord.slice( 1 );
|
|
241
|
+
data = firstWord + ' ' + secondWord;
|
|
242
|
+
return data;
|
|
243
|
+
}
|
|
244
|
+
|
|
203
245
|
export const sendEmail = ( data ) => {
|
|
204
246
|
try {
|
|
205
247
|
const attachments = null;
|
|
@@ -486,7 +528,9 @@ export async function updateBrandInfo( req, res ) {
|
|
|
486
528
|
eventType: 'update',
|
|
487
529
|
};
|
|
488
530
|
|
|
489
|
-
|
|
531
|
+
if ( updateKeys.length ) {
|
|
532
|
+
await insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
|
|
533
|
+
}
|
|
490
534
|
|
|
491
535
|
|
|
492
536
|
const updateAck = await brandInfoUpdate( {
|
|
@@ -580,7 +624,10 @@ export async function updateBillingDetails( req, res ) {
|
|
|
580
624
|
eventType: 'update',
|
|
581
625
|
};
|
|
582
626
|
|
|
583
|
-
|
|
627
|
+
if ( updateKeys.length ) {
|
|
628
|
+
await insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
|
|
629
|
+
}
|
|
630
|
+
|
|
584
631
|
|
|
585
632
|
const updateAck = await billingDetailsUpdate( {
|
|
586
633
|
clientId: req.params?.id, tradeName: req.body?.tradeName, gstNumber: req.body?.gstNumber,
|
|
@@ -618,7 +665,10 @@ export async function updateSignatoryDetails( req, res ) {
|
|
|
618
665
|
eventType: 'update',
|
|
619
666
|
};
|
|
620
667
|
|
|
621
|
-
|
|
668
|
+
if ( updateKeys.length ) {
|
|
669
|
+
await insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
|
|
670
|
+
}
|
|
671
|
+
|
|
622
672
|
const updateAck = await signatoryDetailsUpdate( {
|
|
623
673
|
clientId: req.params?.id, name: req.body?.name, email: req.body?.email,
|
|
624
674
|
number: req.body?.number, designation: req.body?.designation,
|
|
@@ -660,7 +710,10 @@ export async function updateTicketConfiguration( req, res ) {
|
|
|
660
710
|
changes: updateKeys,
|
|
661
711
|
eventType: 'update',
|
|
662
712
|
};
|
|
663
|
-
|
|
713
|
+
|
|
714
|
+
if ( updateKeys.length ) {
|
|
715
|
+
await insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
|
|
716
|
+
}
|
|
664
717
|
|
|
665
718
|
if ( updateAck ) {
|
|
666
719
|
res.sendSuccess( { result: 'Updated Successfully' } );
|
|
@@ -745,7 +798,9 @@ export async function updateFeatureConfiguration( req, res ) {
|
|
|
745
798
|
changes: updateKeys,
|
|
746
799
|
eventType: 'update',
|
|
747
800
|
};
|
|
748
|
-
|
|
801
|
+
if ( updateKeys.length ) {
|
|
802
|
+
await insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
|
|
803
|
+
}
|
|
749
804
|
|
|
750
805
|
if ( updateAck ) {
|
|
751
806
|
res.sendSuccess( { result: 'Updated Successfully' } );
|
|
@@ -785,7 +840,10 @@ export async function domainDetailsConfiguration( req, res ) {
|
|
|
785
840
|
eventType: 'update',
|
|
786
841
|
};
|
|
787
842
|
|
|
788
|
-
|
|
843
|
+
if ( updateKeys.length ) {
|
|
844
|
+
await insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
|
|
845
|
+
}
|
|
846
|
+
|
|
789
847
|
if ( updateAck ) {
|
|
790
848
|
res.sendSuccess( { result: 'Updated Successfully' } );
|
|
791
849
|
}
|
|
@@ -895,7 +953,9 @@ export async function updateDocuments( req, res ) {
|
|
|
895
953
|
eventType: 'update',
|
|
896
954
|
};
|
|
897
955
|
|
|
898
|
-
|
|
956
|
+
if ( updateKeys.length ) {
|
|
957
|
+
await insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
|
|
958
|
+
}
|
|
899
959
|
|
|
900
960
|
if ( updateAck ) {
|
|
901
961
|
res.sendSuccess( { result: 'Updated Successfully' } );
|
|
@@ -959,7 +1019,9 @@ export async function auditConfiguration( req, res ) {
|
|
|
959
1019
|
logObj.changes = [ `Audit config bulk` ];
|
|
960
1020
|
}
|
|
961
1021
|
|
|
962
|
-
|
|
1022
|
+
if ( updateKeys.length ) {
|
|
1023
|
+
await insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
|
|
1024
|
+
}
|
|
963
1025
|
|
|
964
1026
|
res.sendSuccess( { result: 'Updated Successfully' } );
|
|
965
1027
|
} catch ( error ) {
|
|
@@ -1354,7 +1416,10 @@ export async function detailedClientCount( req, res ) {
|
|
|
1354
1416
|
export async function getActivityLogs( req, res ) {
|
|
1355
1417
|
try {
|
|
1356
1418
|
const query = {
|
|
1357
|
-
'_source': [
|
|
1419
|
+
'_source': [
|
|
1420
|
+
'userId', 'userName', 'email', 'date', 'logType', 'logSubType',
|
|
1421
|
+
'changes', 'eventType',
|
|
1422
|
+
],
|
|
1358
1423
|
'query': {
|
|
1359
1424
|
'bool': {
|
|
1360
1425
|
'must': [
|
|
@@ -1368,6 +1433,13 @@ export async function getActivityLogs( req, res ) {
|
|
|
1368
1433
|
},
|
|
1369
1434
|
'from': ( req.body.offset - 1 ) * req.body.limit,
|
|
1370
1435
|
'size': req.body.limit,
|
|
1436
|
+
'sort': [
|
|
1437
|
+
{
|
|
1438
|
+
'date': {
|
|
1439
|
+
'order': 'desc',
|
|
1440
|
+
},
|
|
1441
|
+
},
|
|
1442
|
+
],
|
|
1371
1443
|
};
|
|
1372
1444
|
|
|
1373
1445
|
if ( req.body?.logTypeFilters?.length ) {
|
|
@@ -1391,7 +1463,7 @@ export async function getActivityLogs( req, res ) {
|
|
|
1391
1463
|
} );
|
|
1392
1464
|
}
|
|
1393
1465
|
|
|
1394
|
-
const logs = await getOpenSearchData(
|
|
1466
|
+
const logs = await getOpenSearchData( appConfig.opensearch.activityLog, query );
|
|
1395
1467
|
|
|
1396
1468
|
const hits = logs?.body?.hits?.hits;
|
|
1397
1469
|
const totalDocuments = logs?.body?.hits?.total?.value;
|
|
@@ -1407,6 +1479,7 @@ export async function getActivityLogs( req, res ) {
|
|
|
1407
1479
|
}
|
|
1408
1480
|
}
|
|
1409
1481
|
|
|
1482
|
+
|
|
1410
1483
|
async function postApi( url, data ) {
|
|
1411
1484
|
const requestOptions = {
|
|
1412
1485
|
method: 'POST',
|