updated all api for date 24-02-2025
This commit is contained in:
parent
b00aac38a3
commit
e900a8c7be
@ -79,7 +79,7 @@ export class OracleSpService {
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_name: {
|
||||
val: 'indu1',
|
||||
val: "",
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_cursor: {
|
||||
@ -141,8 +141,23 @@ export class OracleSpService {
|
||||
}
|
||||
}
|
||||
|
||||
async insertNewServiceProider(){
|
||||
|
||||
async insertNewServiceProider(
|
||||
p_name: String,
|
||||
p_lookupcode: String,
|
||||
p_address1: String,
|
||||
p_address2: String,
|
||||
p_city: String,
|
||||
p_state: String,
|
||||
p_zip: String,
|
||||
p_country: String,
|
||||
p_issuingregion: String,
|
||||
p_replacementregion: String,
|
||||
p_bondsurety: String,
|
||||
p_cargopolicyno: String,
|
||||
p_cargosurety: String,
|
||||
p_user_id: String,
|
||||
) {
|
||||
|
||||
let connection;
|
||||
try {
|
||||
// Connect to the Oracle database using oracledb
|
||||
@ -153,17 +168,81 @@ export class OracleSpService {
|
||||
|
||||
const result = await connection.execute(
|
||||
`BEGIN
|
||||
sp1(:a,:b,:res);
|
||||
USCIB_Managed_Pkg.InsertNewSP(
|
||||
:p_name,
|
||||
:p_lookupcode,
|
||||
:p_address1,
|
||||
:p_address2,
|
||||
:p_city,
|
||||
:p_state,
|
||||
:p_zip,
|
||||
:p_country,
|
||||
:p_issuingregion,
|
||||
:p_replacementregion,
|
||||
:p_bondsurety,
|
||||
:p_cargopolicyno,
|
||||
:p_cargosurety,
|
||||
:p_user_id,
|
||||
:p_cursor);
|
||||
END;`, {
|
||||
a: {
|
||||
val: "03",
|
||||
p_name: {
|
||||
val: p_name,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
b: {
|
||||
val: 'indu1',
|
||||
p_lookupcode: {
|
||||
val: p_lookupcode,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
res: {
|
||||
p_address1: {
|
||||
val: p_address1,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_address2: {
|
||||
val: p_address2,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_city: {
|
||||
val: p_city,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_state: {
|
||||
val: p_state,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_zip: {
|
||||
val: p_zip,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_country: {
|
||||
val: p_country,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_issuingregion: {
|
||||
val: p_issuingregion,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_replacementregion: {
|
||||
val: p_replacementregion,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_bondsurety: {
|
||||
val: p_bondsurety,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_cargopolicyno: {
|
||||
val: p_cargopolicyno,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_cargosurety: {
|
||||
val: p_cargosurety,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_user_id: {
|
||||
val: p_user_id,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
|
||||
p_cursor: {
|
||||
type: oracledb.CURSOR,
|
||||
dir: oracledb.BIND_OUT
|
||||
}
|
||||
@ -180,18 +259,641 @@ export class OracleSpService {
|
||||
throw new Error('Error fetching users');
|
||||
} finally {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async updateServiceProider(
|
||||
p_spid: Number,
|
||||
p_name: String,
|
||||
p_lookupcode: String,
|
||||
p_address1: String,
|
||||
p_address2: String,
|
||||
p_city: String,
|
||||
p_state: String,
|
||||
p_zip: String,
|
||||
p_country: String,
|
||||
p_issuingregion: String,
|
||||
p_replacementregion: String,
|
||||
p_bondsurety: String,
|
||||
p_cargopolicyno: String,
|
||||
p_cargosurety: String,
|
||||
p_user_id: String
|
||||
) {
|
||||
|
||||
let connection;
|
||||
try {
|
||||
// Connect to the Oracle database using oracledb
|
||||
connection = await this.dbService.getDataSource()
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
`BEGIN
|
||||
USCIB_Managed_Pkg.UpdateSP(
|
||||
:p_spid,
|
||||
:p_name,
|
||||
:p_lookupcode,
|
||||
:p_address1,
|
||||
:p_address2,
|
||||
:p_city,
|
||||
:p_state,
|
||||
:p_zip,
|
||||
:p_country,
|
||||
:p_issuingregion,
|
||||
:p_replacementregion,
|
||||
:p_bondsurety,
|
||||
:p_cargopolicyno,
|
||||
:p_cargosurety,
|
||||
:p_user_id,
|
||||
:p_cursor);
|
||||
END;`, {
|
||||
p_spid: {
|
||||
val: p_spid,
|
||||
type: oracledb.DB_TYPE_NUMBER
|
||||
},
|
||||
p_name: {
|
||||
val: p_name,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_lookupcode: {
|
||||
val: p_lookupcode,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_address1: {
|
||||
val: p_address1,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_address2: {
|
||||
val: p_address2,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_city: {
|
||||
val: p_city,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_state: {
|
||||
val: p_state,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_zip: {
|
||||
val: p_zip,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_country: {
|
||||
val: p_country,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_issuingregion: {
|
||||
val: p_issuingregion,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_replacementregion: {
|
||||
val: p_replacementregion,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_bondsurety: {
|
||||
val: p_bondsurety,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_cargopolicyno: {
|
||||
val: p_cargopolicyno,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_cargosurety: {
|
||||
val: p_cargosurety,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_user_id: {
|
||||
val: p_user_id,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_cursor: {
|
||||
type: oracledb.CURSOR,
|
||||
dir: oracledb.BIND_OUT
|
||||
}
|
||||
}, {
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
||||
}
|
||||
);
|
||||
let fres = await result.outBinds.p_cursor.getRows();
|
||||
|
||||
return fres
|
||||
|
||||
} catch (err) {
|
||||
console.error('Error fetching users: ', err);
|
||||
throw new Error('Error fetching users');
|
||||
} finally {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async getAllServiceproviders() {
|
||||
|
||||
let connection;
|
||||
let rows = [];
|
||||
try {
|
||||
// Connect to the Oracle database using oracledb
|
||||
connection = await this.dbService.getDataSource()
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
`BEGIN
|
||||
USCIB_Managed_Pkg.GetAllSPs(:p_cursor);
|
||||
END;`,
|
||||
{
|
||||
p_cursor: {
|
||||
type: oracledb.CURSOR,
|
||||
dir: oracledb.BIND_OUT
|
||||
}
|
||||
},
|
||||
{
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
||||
}
|
||||
);
|
||||
|
||||
if (result.outBinds && result.outBinds.p_cursor) {
|
||||
const cursor = result.outBinds.p_cursor; // The OUT cursor
|
||||
let rowsBatch;
|
||||
|
||||
do {
|
||||
rowsBatch = await cursor.getRows(100); // Fetch 100 rows at a time
|
||||
rows = rows.concat(rowsBatch); // Append fetched rows to the main array
|
||||
} while (rowsBatch.length > 0);
|
||||
|
||||
console.log('Rows fetched:', rows);
|
||||
|
||||
// Close the cursor after you're done
|
||||
await cursor.close();
|
||||
} else {
|
||||
throw new Error('No cursor returned from the stored procedure');
|
||||
}
|
||||
|
||||
return rows;
|
||||
|
||||
} catch (err) {
|
||||
console.error('Error fetching users: ', err);
|
||||
throw new Error('Error fetching users');
|
||||
} finally {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async getSelectedServiceprovider(p_spid: Number) {
|
||||
|
||||
let connection;
|
||||
let rows = [];
|
||||
try {
|
||||
// Connect to the Oracle database using oracledb
|
||||
connection = await this.dbService.getDataSource()
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
`BEGIN
|
||||
USCIB_Managed_Pkg.GetSPbySPID(:p_spid,:p_cursor);
|
||||
END;`,
|
||||
{
|
||||
p_spid: {
|
||||
val: p_spid,
|
||||
type: oracledb.DB_TYPE_NUMBER,
|
||||
},
|
||||
p_cursor: {
|
||||
type: oracledb.CURSOR,
|
||||
dir: oracledb.BIND_OUT
|
||||
}
|
||||
},
|
||||
{
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
||||
}
|
||||
);
|
||||
|
||||
if (result.outBinds && result.outBinds.p_cursor) {
|
||||
const cursor = result.outBinds.p_cursor; // The OUT cursor
|
||||
let rowsBatch;
|
||||
|
||||
do {
|
||||
rowsBatch = await cursor.getRows(100); // Fetch 100 rows at a time
|
||||
rows = rows.concat(rowsBatch); // Append fetched rows to the main array
|
||||
} while (rowsBatch.length > 0);
|
||||
|
||||
console.log('Rows fetched:', rows);
|
||||
|
||||
// Close the cursor after you're done
|
||||
await cursor.close();
|
||||
} else {
|
||||
throw new Error('No cursor returned from the stored procedure');
|
||||
}
|
||||
|
||||
return rows;
|
||||
|
||||
} catch (err) {
|
||||
console.error('Error fetching users: ', err);
|
||||
throw new Error('Error fetching users');
|
||||
} finally {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async insertSPContacts(
|
||||
p_spid: Number,
|
||||
p_firstname: String,
|
||||
p_lastname: String,
|
||||
p_title: String,
|
||||
p_phoneno: String,
|
||||
p_mobileno: String,
|
||||
p_faxno: String,
|
||||
p_emailaddress: String,
|
||||
p_user_id: String
|
||||
) {
|
||||
|
||||
let connection;
|
||||
try {
|
||||
// Connect to the Oracle database using oracledb
|
||||
connection = await this.dbService.getDataSource()
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
`BEGIN
|
||||
USCIB_Managed_Pkg.InsertSPContacts(
|
||||
:p_spid,
|
||||
:p_firstname,
|
||||
:p_lastname,
|
||||
:p_title,
|
||||
:p_phoneno,
|
||||
:p_mobileno,
|
||||
:p_faxno,
|
||||
:p_emailaddress,
|
||||
:p_user_id,
|
||||
:p_cursor);
|
||||
END;`, {
|
||||
p_spid: {
|
||||
val: p_spid,
|
||||
type: oracledb.DB_TYPE_NUMBER
|
||||
},
|
||||
p_firstname: {
|
||||
val: p_firstname,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_lastname: {
|
||||
val: p_lastname,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_title: {
|
||||
val: p_title,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_phoneno: {
|
||||
val: p_phoneno,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_mobileno: {
|
||||
val: p_mobileno,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_faxno: {
|
||||
val: p_faxno,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_emailaddress: {
|
||||
val: p_emailaddress,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_user_id: {
|
||||
val: p_user_id,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_cursor: {
|
||||
type: oracledb.CURSOR,
|
||||
dir: oracledb.BIND_OUT
|
||||
}
|
||||
}, {
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
||||
}
|
||||
);
|
||||
let fres = await result.outBinds.p_cursor.getRows();
|
||||
|
||||
return fres
|
||||
|
||||
} catch (err) {
|
||||
console.error('Error fetching users: ', err);
|
||||
throw new Error('Error fetching users');
|
||||
} finally {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async updateSPContacts(
|
||||
p_spcontactid: Number,
|
||||
p_firstname: String,
|
||||
p_lastname: String,
|
||||
p_title: String,
|
||||
p_phoneno: String,
|
||||
p_mobileno: String,
|
||||
p_faxno: String,
|
||||
p_emailaddress: String,
|
||||
p_user_id: String,
|
||||
) {
|
||||
|
||||
let connection;
|
||||
try {
|
||||
// Connect to the Oracle database using oracledb
|
||||
connection = await this.dbService.getDataSource()
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
`BEGIN
|
||||
USCIB_Managed_Pkg.UpdateSPContacts(
|
||||
:p_spcontactid,
|
||||
:p_firstname,
|
||||
:p_lastname,
|
||||
:p_title,
|
||||
:p_phoneno,
|
||||
:p_mobileno,
|
||||
:p_faxno,
|
||||
:p_emailaddress,
|
||||
:p_user_id,
|
||||
:p_cursor);
|
||||
END;`, {
|
||||
p_spcontactid: {
|
||||
val: p_spcontactid,
|
||||
type: oracledb.DB_TYPE_NUMBER
|
||||
},
|
||||
p_firstname: {
|
||||
val: p_firstname,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_lastname: {
|
||||
val: p_lastname,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_title: {
|
||||
val: p_title,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_phoneno: {
|
||||
val: p_phoneno,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_mobileno: {
|
||||
val: p_mobileno,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_faxno: {
|
||||
val: p_faxno,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_emailaddress: {
|
||||
val: p_emailaddress,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_user_id: {
|
||||
val: p_user_id,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
p_cursor: {
|
||||
type: oracledb.CURSOR,
|
||||
dir: oracledb.BIND_OUT
|
||||
}
|
||||
}, {
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
||||
}
|
||||
);
|
||||
let fres = await result.outBinds.p_cursor.getRows();
|
||||
|
||||
return fres
|
||||
|
||||
} catch (err) {
|
||||
console.error('Error fetching users: ', err);
|
||||
throw new Error('Error fetching users');
|
||||
} finally {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async getSPcontacts(p_SPid: Number) {
|
||||
let connection;
|
||||
let rows = [];
|
||||
try {
|
||||
// Connect to the Oracle database using oracledb
|
||||
connection = await this.dbService.getDataSource()
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
`BEGIN
|
||||
USCIB_Managed_Pkg.GetSPAllContacts( p_SPid,:p_cursor);
|
||||
END;`,
|
||||
{
|
||||
p_SPid: {
|
||||
val: p_SPid,
|
||||
type: oracledb.DB_TYPE_NUMBER
|
||||
},
|
||||
p_cursor: {
|
||||
type: oracledb.CURSOR,
|
||||
dir: oracledb.BIND_OUT
|
||||
}
|
||||
},
|
||||
{
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
||||
}
|
||||
);
|
||||
|
||||
if (result.outBinds && result.outBinds.p_cursor) {
|
||||
const cursor = result.outBinds.p_cursor; // The OUT cursor
|
||||
let rowsBatch;
|
||||
|
||||
do {
|
||||
rowsBatch = await cursor.getRows(100); // Fetch 100 rows at a time
|
||||
rows = rows.concat(rowsBatch); // Append fetched rows to the main array
|
||||
} while (rowsBatch.length > 0);
|
||||
|
||||
console.log('Rows fetched:', rows);
|
||||
|
||||
// Close the cursor after you're done
|
||||
await cursor.close();
|
||||
} else {
|
||||
throw new Error('No cursor returned from the stored procedure');
|
||||
}
|
||||
|
||||
return rows;
|
||||
|
||||
} catch (err) {
|
||||
console.error('Error fetching users: ', err);
|
||||
throw new Error('Error fetching users');
|
||||
} finally {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
async setSPDefaultcontact(p_spcontactid: Number) {
|
||||
let connection;
|
||||
let rows = [];
|
||||
try {
|
||||
// Connect to the Oracle database using oracledb
|
||||
connection = await this.dbService.getDataSource()
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
`BEGIN
|
||||
USCIB_Managed_Pkg.SetDefaultContact(:p_spcontactid);
|
||||
END;`,
|
||||
{
|
||||
p_cursor: {
|
||||
val: p_spcontactid,
|
||||
type: oracledb.DB_TYPE_NUMBER,
|
||||
}
|
||||
},
|
||||
// {
|
||||
// outFormat: oracledb.OUT_FORMAT_OBJECT
|
||||
// }
|
||||
);
|
||||
|
||||
// if (result.outBinds && result.outBinds.p_cursor) {
|
||||
// const cursor = result.outBinds.p_cursor; // The OUT cursor
|
||||
// let rowsBatch;
|
||||
|
||||
// do {
|
||||
// rowsBatch = await cursor.getRows(100); // Fetch 100 rows at a time
|
||||
// rows = rows.concat(rowsBatch); // Append fetched rows to the main array
|
||||
// } while (rowsBatch.length > 0);
|
||||
|
||||
// console.log('Rows fetched:', rows);
|
||||
|
||||
// // Close the cursor after you're done
|
||||
// await cursor.close();
|
||||
// } else {
|
||||
// throw new Error('No cursor returned from the stored procedure');
|
||||
// }
|
||||
|
||||
return 'rows';
|
||||
|
||||
} catch (err) {
|
||||
console.error('Error fetching users: ', err);
|
||||
throw new Error('Error fetching users');
|
||||
} finally {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
async inactivateSPContact(p_spcontactid: Number) {
|
||||
let connection;
|
||||
let rows = [];
|
||||
try {
|
||||
// Connect to the Oracle database using oracledb
|
||||
connection = await this.dbService.getDataSource()
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
`BEGIN
|
||||
USCIB_Managed_Pkg.InActivateSPContacts(:p_spcontactid);
|
||||
END;`,
|
||||
{
|
||||
p_cursor: {
|
||||
val: p_spcontactid,
|
||||
type: oracledb.DB_TYPE_NUMBER,
|
||||
}
|
||||
},
|
||||
// {
|
||||
// outFormat: oracledb.OUT_FORMAT_OBJECT
|
||||
// }
|
||||
);
|
||||
|
||||
// if (result.outBinds && result.outBinds.p_cursor) {
|
||||
// const cursor = result.outBinds.p_cursor; // The OUT cursor
|
||||
// let rowsBatch;
|
||||
|
||||
// do {
|
||||
// rowsBatch = await cursor.getRows(100); // Fetch 100 rows at a time
|
||||
// rows = rows.concat(rowsBatch); // Append fetched rows to the main array
|
||||
// } while (rowsBatch.length > 0);
|
||||
|
||||
// console.log('Rows fetched:', rows);
|
||||
|
||||
// // Close the cursor after you're done
|
||||
// await cursor.close();
|
||||
// } else {
|
||||
// throw new Error('No cursor returned from the stored procedure');
|
||||
// }
|
||||
|
||||
return 'rows';
|
||||
|
||||
} catch (err) {
|
||||
console.error('Error fetching users: ', err);
|
||||
throw new Error('Error fetching users');
|
||||
} finally {
|
||||
}
|
||||
}
|
||||
|
||||
async getSPDefaultcontact(p_SPid: Number) {
|
||||
|
||||
let connection;
|
||||
let rows = [];
|
||||
try {
|
||||
// Connect to the Oracle database using oracledb
|
||||
connection = await this.dbService.getDataSource()
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
`BEGIN
|
||||
USCIB_Managed_Pkg.GetSPDefaultContacts( p_SPid,:p_cursor);
|
||||
END;`,
|
||||
{
|
||||
p_SPid: {
|
||||
val: p_SPid,
|
||||
type: oracledb.DB_TYPE_NUMBER
|
||||
},
|
||||
p_cursor: {
|
||||
type: oracledb.CURSOR,
|
||||
dir: oracledb.BIND_OUT
|
||||
}
|
||||
},
|
||||
{
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
||||
}
|
||||
);
|
||||
|
||||
if (result.outBinds && result.outBinds.p_cursor) {
|
||||
const cursor = result.outBinds.p_cursor; // The OUT cursor
|
||||
let rowsBatch;
|
||||
|
||||
do {
|
||||
rowsBatch = await cursor.getRows(100); // Fetch 100 rows at a time
|
||||
rows = rows.concat(rowsBatch); // Append fetched rows to the main array
|
||||
} while (rowsBatch.length > 0);
|
||||
|
||||
console.log('Rows fetched:', rows);
|
||||
|
||||
// Close the cursor after you're done
|
||||
await cursor.close();
|
||||
} else {
|
||||
throw new Error('No cursor returned from the stored procedure');
|
||||
}
|
||||
|
||||
return rows;
|
||||
|
||||
} catch (err) {
|
||||
console.error('Error fetching users: ', err);
|
||||
throw new Error('Error fetching users');
|
||||
} finally {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async updateServiceProider(){
|
||||
|
||||
}
|
||||
async getAllServiceproviders(){}
|
||||
async getSelectedServiceprovider(){}
|
||||
async insertSPContacts(){}
|
||||
async updateSPContacts(){}
|
||||
async getSPcontacts(){}
|
||||
async setSPDefaultcontact(){}
|
||||
async inactivateSPContact(){}
|
||||
async getSPDefaultcontact(){}
|
||||
}
|
||||
|
||||
@ -1,25 +0,0 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { INestApplication } from '@nestjs/common';
|
||||
import * as request from 'supertest';
|
||||
import { App } from 'supertest/types';
|
||||
import { AppModule } from './../src/app.module';
|
||||
|
||||
describe('AppController (e2e)', () => {
|
||||
let app: INestApplication<App>;
|
||||
|
||||
beforeEach(async () => {
|
||||
const moduleFixture: TestingModule = await Test.createTestingModule({
|
||||
imports: [AppModule],
|
||||
}).compile();
|
||||
|
||||
app = moduleFixture.createNestApplication();
|
||||
await app.init();
|
||||
});
|
||||
|
||||
it('/ (GET)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.get('/')
|
||||
.expect(200)
|
||||
.expect('Hello World!');
|
||||
});
|
||||
});
|
||||
@ -1,9 +0,0 @@
|
||||
{
|
||||
"moduleFileExtensions": ["js", "json", "ts"],
|
||||
"rootDir": ".",
|
||||
"testEnvironment": "node",
|
||||
"testRegex": ".e2e-spec.ts$",
|
||||
"transform": {
|
||||
"^.+\\.(t|j)s$": "ts-jest"
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user