Skip to content

Commit

Permalink
RA-26080 remove properties
Browse files Browse the repository at this point in the history
  • Loading branch information
nareshkharola123 committed Oct 27, 2020
1 parent 23b289e commit 64bc0c3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
2 changes: 0 additions & 2 deletions newReindexAuditLogs.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ async function callBulkAPI(elindex) {
async function bulkIndexAuditLogs(rideId, auditLogs, rideRange) {
const elindex = [];
auditLogs.forEach((value) => {
utils.filterObject(value, 'legToFlatFeeMapping ');
utils.filterObject(value, 'changed_legs');

elindex.push({
index: {
Expand Down
25 changes: 23 additions & 2 deletions newUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ const createIndex = async function createIndex(indexName, fromIndex) {
}
});

filterObject(properties, 'legToFlatFeeMapping');
filterObject(properties, 'changed_legs');
removeProperty(properties);

await elasticClient.indices.putMapping({
index: indexName, type: 'doc', body: { properties, dynamic: false },
Expand Down Expand Up @@ -127,6 +126,8 @@ const createLogstashIndex = async function createLogstashIndex(indexName, fromIn
});
}
});

removeProperty(properties);
await elasticClient.indices.putMapping({
index: indexName, type: 'doc', body: { properties, dynamic: false },
});
Expand All @@ -153,6 +154,26 @@ function filterObject(obj, key) {
filterObject(obj[i], key);
}
}

}


function removeProperty(obj){
if(obj?.meta?.data?.vendor_lists?.latest_flat_rate?.legToFlatFeeMapping){
delete obj.meta.data.vendor_lists.latest_flat_rate.legToFlatFeeMapping
}

if(obj?.meta?.data?.orderUpdateDiff?.changed_legs){
delete obj.meta.data.orderUpdateDiff.changed_legs
}

if(obj?.meta?.billingWriteBack?.legs?.fare_breakdown){
delete obj.meta.billingWriteBack.legs.fare_breakdown
}

if(obj?.receipt?.fare_breakdown){
delete obj.receipt.fare_breakdown
}
}

module.exports = {createIndex, createLogstashIndex, filterObject};

0 comments on commit 64bc0c3

Please sign in to comment.