tango-app-api-client 3.4.0-beta.0 → 3.4.0-beta.2
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
|
@@ -2655,7 +2655,9 @@ export async function getActivityLogs( req, res ) {
|
|
|
2655
2655
|
if ( ( ( hit?._source?.eventType ).match( /update/ ) || ( hit?._source?.eventType ).match( /edit/ ) )&& hit?._source?.previous ) {
|
|
2656
2656
|
const previous = hit?._source?.oldData;
|
|
2657
2657
|
const current=hit?._source?.newData;
|
|
2658
|
-
|
|
2658
|
+
if ( previous && current ) {
|
|
2659
|
+
respo = findDifferences( previous, current );
|
|
2660
|
+
}
|
|
2659
2661
|
hit._source.updatedValue = respo;
|
|
2660
2662
|
temp.push( hit?._source );
|
|
2661
2663
|
// hit._source.changes =logSubType === 'ticketConfig'? Object.keys( respo ).map( ( item ) => item ) : hit._source.changes;
|
|
@@ -2674,16 +2676,25 @@ export async function getActivityLogs( req, res ) {
|
|
|
2674
2676
|
}
|
|
2675
2677
|
}
|
|
2676
2678
|
|
|
2677
|
-
function findDifferences(
|
|
2678
|
-
|
|
2679
|
+
function findDifferences( oldData, newData ) {
|
|
2680
|
+
logger.info( { oldData: oldData, newData: newData } );
|
|
2681
|
+
const allKeys = new Set( [ ...Object.keys( oldData ), ...Object.keys( newData ) ] );
|
|
2682
|
+
const diff = {};
|
|
2683
|
+
|
|
2684
|
+
allKeys.forEach( ( key ) => {
|
|
2685
|
+
const previous = key in oldData ? oldData[key] : null;
|
|
2686
|
+
const current = key in newData ? newData[key] : null;
|
|
2679
2687
|
|
|
2680
|
-
|
|
2681
|
-
if (
|
|
2682
|
-
|
|
2688
|
+
// Only include fields that are added or updated (where previous !== current)
|
|
2689
|
+
if ( previous !== current ) {
|
|
2690
|
+
diff[splitCamelCase( key )] = {
|
|
2691
|
+
previous,
|
|
2692
|
+
current,
|
|
2693
|
+
};
|
|
2683
2694
|
}
|
|
2684
|
-
}
|
|
2695
|
+
} );
|
|
2685
2696
|
|
|
2686
|
-
return
|
|
2697
|
+
return diff;
|
|
2687
2698
|
}
|
|
2688
2699
|
|
|
2689
2700
|
function splitCamelCase( text ) {
|