Compare commits

...

1 Commits

Author SHA1 Message Date
Kallesh B S
e9eb086f9e added new GET_COUNTRIES_AND_MESSAGES API in param 2025-07-21 20:33:19 +05:30
2 changed files with 37 additions and 0 deletions

View File

@ -36,6 +36,11 @@ export class ParamTableController {
return this.paramTableService.GETPARAMVALUES(body);
}
@Get('GetCountriesAndMessages')
GET_COUNTRIES_AND_MESSAGES() {
return this.GET_COUNTRIES_AND_MESSAGES();
}
@Post('/CreateTableRecord')
createTableRecord(@Body() body: CreateTableRecordDTO) {
return this.paramTableService.CREATETABLERECORD(body);

View File

@ -63,6 +63,38 @@ export class ParamTableService {
}
}
async GET_COUNTRIES_AND_MESSAGES() {
let connection;
try {
connection = await this.oracleDBService.getConnection();
const result = await connection.execute(
`BEGIN
MANAGEPARAMTABLE_PKG.GetCountriesAndMessages(:P_CURSOR);
END;`,
{
P_CURSOR: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT }
},
{ outFormat: oracledb.OUT_FORMAT_OBJECT }
);
await connection.commit();
const outBinds = result.outBinds;
if (!outBinds?.P_CURSOR) {
this.logger.error('One or more expected cursors are missing from stored procedure output.');
throw new InternalServerException("Incomplete data received from the database.");
}
return await fetchCursor(outBinds.P_CURSOR, ParamTableService.name);
} catch (error) {
handleError(error, ParamTableService.name)
} finally {
await closeOracleDbConnection(connection, ParamTableService.name)
}
}
async CREATETABLERECORD(body: CreateTableRecordDTO) {
let connection;