From b263dc2d094e58fa37f0657f39c9b0c1d9bcb323 Mon Sep 17 00:00:00 2001 From: Kallesh B S Date: Thu, 20 Mar 2025 11:38:38 +0530 Subject: [PATCH] api modified --- src/oracle/homePageData.service.ts | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/oracle/homePageData.service.ts b/src/oracle/homePageData.service.ts index f2a7340..5aa7203 100644 --- a/src/oracle/homePageData.service.ts +++ b/src/oracle/homePageData.service.ts @@ -92,7 +92,7 @@ export class HomePageDataService { p_region_cur: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT - }, + } }, { outFormat: oracledb.OUT_FORMAT_OBJECT @@ -246,7 +246,7 @@ export class HomePageDataService { throw new Error('No cursor returned from the stored procedure'); } - return { + let tableData = { p_basic_details, p_contacts, p_sequence, @@ -260,6 +260,28 @@ export class HomePageDataService { p_region, }; + let output = {} + + for (const key in tableData) { + // console.log(key); + + output[key] = tableData[key].map(obj => { + const newObj = { ...obj }; + for (const innerKey in obj) { + if (key === 'p_fees_comm') { + if (innerKey.includes(' ')) { // Check if the key has a space + const newKey = innerKey.replace(/ /g, '_').toUpperCase(); // Replace spaces and convert to uppercase + newObj[newKey] = obj[innerKey]; // Add the new key + delete newObj[innerKey]; // Remove the old key + } + } + } + return newObj; + }); + } + + return output; + } catch (err) { console.error('Error fetching users: ', err); throw new Error('Error fetching users');