api modified

This commit is contained in:
Kallesh B S 2025-03-20 11:38:38 +05:30
parent 7683afab7a
commit b263dc2d09

View File

@ -92,7 +92,7 @@ export class HomePageDataService {
p_region_cur: { p_region_cur: {
type: oracledb.CURSOR, type: oracledb.CURSOR,
dir: oracledb.BIND_OUT dir: oracledb.BIND_OUT
}, }
}, },
{ {
outFormat: oracledb.OUT_FORMAT_OBJECT outFormat: oracledb.OUT_FORMAT_OBJECT
@ -246,7 +246,7 @@ export class HomePageDataService {
throw new Error('No cursor returned from the stored procedure'); throw new Error('No cursor returned from the stored procedure');
} }
return { let tableData = {
p_basic_details, p_basic_details,
p_contacts, p_contacts,
p_sequence, p_sequence,
@ -260,6 +260,28 @@ export class HomePageDataService {
p_region, 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) { } catch (err) {
console.error('Error fetching users: ', err); console.error('Error fetching users: ', err);
throw new Error('Error fetching users'); throw new Error('Error fetching users');