tango-app-api-client 3.4.0-beta.4 → 3.4.0-beta.5
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.4.0-beta.
|
|
3
|
+
"version": "3.4.0-beta.5",
|
|
4
4
|
"description": "client",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"license": "ISC",
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"aws-sdk": "^2.1560.0",
|
|
17
|
+
"cors": "^2.8.5",
|
|
17
18
|
"dotenv": "^16.4.4",
|
|
18
19
|
"express": "^4.18.2",
|
|
19
20
|
"express-fileupload": "^1.4.3",
|
|
@@ -1281,23 +1281,23 @@ export async function domainDetailsConfiguration( req, res ) {
|
|
|
1281
1281
|
|
|
1282
1282
|
|
|
1283
1283
|
// Map and rename keys from previous client info for UI display and logging
|
|
1284
|
-
const oldData = {
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1284
|
+
// const oldData = {
|
|
1285
|
+
// DomainName: getPreData?.domainConfig?.ssoLogin?.domainName,
|
|
1286
|
+
// IsEnable: getPreData?.domainConfig?.ssoLogin?.isEnable ==true ? 'Enable': 'Disable',
|
|
1287
|
+
// IPWhitelist: getPreData?.domainConfig?.ipWhitelisting?.enableWhitelisting ==true ? 'Enable': 'Disable',
|
|
1288
|
+
// WhitelistedIps: ( getPreData?.domainConfig?.ipWhitelisting?.allowedIps )?.join( ', ' ),
|
|
1289
|
+
// TwoFactorAuthentication: getPreData?.domainConfig?.enableOtp ==true ? 'Enable': 'Disable',
|
|
1290
1290
|
|
|
1291
|
-
};
|
|
1291
|
+
// };
|
|
1292
1292
|
|
|
1293
1293
|
// Map and rename keys from current client info for UI display and logging
|
|
1294
|
-
const newData ={
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
};
|
|
1294
|
+
// const newData ={
|
|
1295
|
+
// DomainName: getPostData?.domainConfig?.ssoLogin?.domainName,
|
|
1296
|
+
// IsEnable: getPostData?.domainConfig?.ssoLogin?.isEnable ==true ? 'Enable': 'Disable',
|
|
1297
|
+
// IPWhitelist: getPostData?.domainConfig?.ipWhitelisting?.enableWhitelisting ==true ? 'Enable': 'Disable',
|
|
1298
|
+
// WhitelistedIps: ( getPostData?.domainConfig?.ipWhitelisting?.allowedIps ).join( ', ' ),
|
|
1299
|
+
// TwoFactorAuthentication: getPostData?.domainConfig?.enableOtp ==true ? 'Enable': 'Disable',
|
|
1300
|
+
// };
|
|
1301
1301
|
|
|
1302
1302
|
|
|
1303
1303
|
// Prepare activity log object with all relevant details for OpenSearch logging
|
|
@@ -1313,8 +1313,8 @@ export async function domainDetailsConfiguration( req, res ) {
|
|
|
1313
1313
|
showTo: [ 'client', 'tango' ], // Visibility of the log (who can see this log)
|
|
1314
1314
|
previous: getPreData, // Previous (old) client information before update based on DB keys (for internal reference and comparison).
|
|
1315
1315
|
current: getPostData, // Current (new) client information after update based on DB keys (for internal reference and comparison).
|
|
1316
|
-
oldData: oldData, // Previous (old) client information before update (used for showing detailed changes in the UI).
|
|
1317
|
-
newData: newData, // Current (new) client information after update (used for showing detailed changes in the UI).
|
|
1316
|
+
// oldData: oldData, // Previous (old) client information before update (used for showing detailed changes in the UI).
|
|
1317
|
+
// newData: newData, // Current (new) client information after update (used for showing detailed changes in the UI).
|
|
1318
1318
|
};
|
|
1319
1319
|
|
|
1320
1320
|
// Insert activity log into OpenSearch if there are fields that were updated
|
|
@@ -2276,7 +2276,7 @@ export async function detailedClientCount( req, res ) {
|
|
|
2276
2276
|
}
|
|
2277
2277
|
}
|
|
2278
2278
|
|
|
2279
|
-
export async function
|
|
2279
|
+
export async function getActivityLogs( req, res ) {
|
|
2280
2280
|
try {
|
|
2281
2281
|
const inputData = req.body;
|
|
2282
2282
|
const openSearch = JSON.parse( process.env.OPENSEARCH );
|
|
@@ -2285,8 +2285,7 @@ export async function getActivityLogs1( req, res ) {
|
|
|
2285
2285
|
$match: {
|
|
2286
2286
|
$and: [
|
|
2287
2287
|
{
|
|
2288
|
-
clientId: { $in: inputData },
|
|
2289
|
-
},
|
|
2288
|
+
clientId: { $in: [ inputData?.clientId ] } },
|
|
2290
2289
|
],
|
|
2291
2290
|
},
|
|
2292
2291
|
},
|
|
@@ -2310,31 +2309,17 @@ export async function getActivityLogs1( req, res ) {
|
|
|
2310
2309
|
const query = {
|
|
2311
2310
|
'_source': [
|
|
2312
2311
|
'userId', 'userName', 'email', 'date', 'logType', 'logSubType',
|
|
2313
|
-
'changes', 'eventType', 'previous', 'current',
|
|
2312
|
+
'changes', 'eventType', 'previous', 'current', 'oldData', 'newData',
|
|
2314
2313
|
],
|
|
2315
2314
|
'query': {
|
|
2316
2315
|
'bool': {
|
|
2317
|
-
|
|
2318
|
-
// {
|
|
2319
|
-
// 'terms': {
|
|
2320
|
-
// 'clientId.keyword': [ req.body.clientId ],
|
|
2321
|
-
// },
|
|
2322
|
-
// },
|
|
2323
|
-
// ],
|
|
2324
|
-
|
|
2325
|
-
'should': [
|
|
2326
|
-
{
|
|
2327
|
-
'terms': {
|
|
2328
|
-
'clientId.keyword': [ inputData.clientId ],
|
|
2329
|
-
},
|
|
2330
|
-
},
|
|
2316
|
+
'must': [
|
|
2331
2317
|
{
|
|
2332
2318
|
'terms': {
|
|
2333
|
-
'
|
|
2319
|
+
'clientId.keyword': [ req.body.clientId ],
|
|
2334
2320
|
},
|
|
2335
2321
|
},
|
|
2336
2322
|
],
|
|
2337
|
-
'minimum_should_match': 1, // Ensures at least one condition must match
|
|
2338
2323
|
},
|
|
2339
2324
|
},
|
|
2340
2325
|
'from': ( req.body.offset - 1 ) * req.body.limit,
|
|
@@ -2388,12 +2373,16 @@ export async function getActivityLogs1( req, res ) {
|
|
|
2388
2373
|
let respo ={};
|
|
2389
2374
|
hit._source.logSubType = hit._source.logSubType === 'documentUpload'? 'documentsUpload': hit._source.logSubType === 'domainDetails'? 'securityFeatures': hit?._source?.logSubType;
|
|
2390
2375
|
if ( ( ( hit?._source?.eventType ).match( /update/ ) || ( hit?._source?.eventType ).match( /edit/ ) )&& hit?._source?.previous ) {
|
|
2391
|
-
const previous = hit?._source?.previous;
|
|
2392
|
-
const current=hit?._source?.current;
|
|
2376
|
+
const previous = hit?._source?.logType == 'cameras'?hit?._source?.oldData: hit?._source?.previous;
|
|
2377
|
+
const current=hit?._source?.logType == 'cameras'? hit?._source?.newData:hit?._source?.current;
|
|
2393
2378
|
const logType =hit?._source?.logType;
|
|
2394
|
-
|
|
2395
2379
|
const logSubType =hit?._source?.logSubType;
|
|
2396
|
-
|
|
2380
|
+
if ( previous && current && hit?._source?.logType == 'cameras' ) {
|
|
2381
|
+
respo = findDifferences( previous, current );
|
|
2382
|
+
} else {
|
|
2383
|
+
respo = findDifferences1( previous, current, logType, logSubType );
|
|
2384
|
+
}
|
|
2385
|
+
|
|
2397
2386
|
hit._source.updatedValue = respo;
|
|
2398
2387
|
temp.push( hit?._source );
|
|
2399
2388
|
hit._source.changes =logSubType === 'ticketConfig'? Object.keys( respo ).map( ( item ) => item ) : hit._source.changes;
|
|
@@ -2547,7 +2536,7 @@ function getUserFriendlyKey( keyPath, mapping ) {
|
|
|
2547
2536
|
return typeof value === 'string' ? value : keyPath; // Return mapped value or original key
|
|
2548
2537
|
}
|
|
2549
2538
|
|
|
2550
|
-
export async function
|
|
2539
|
+
export async function getActivityLogs1( req, res ) {
|
|
2551
2540
|
try {
|
|
2552
2541
|
const inputData = req.body;
|
|
2553
2542
|
const openSearch = JSON.parse( process.env.OPENSEARCH );
|