transmit application and INACTIVATEPARAMRECORD typo fix and added getAllParamValues
This commit is contained in:
parent
5cebcef300
commit
9f2d7f058f
@ -147,7 +147,7 @@ export class CarnetApplicationService {
|
|||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
`BEGIN
|
`BEGIN
|
||||||
CARNETAPPLICATION_PKG.TransmitApplicationtoProcess(
|
CARNETAPPLICATION_PKG.TransmitApplicationtoProcess(
|
||||||
:P_SPID, :P_USERID, :P_HEADERID :P_CURSOR
|
:P_SPID, :P_USERID, :P_HEADERID, :P_CURSOR
|
||||||
);
|
);
|
||||||
END;`,
|
END;`,
|
||||||
{
|
{
|
||||||
|
|||||||
@ -36,6 +36,23 @@ export class ParamTableController {
|
|||||||
return this.paramTableService.GETPARAMVALUES(body);
|
return this.paramTableService.GETPARAMVALUES(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Get('/GetAllParamValues')
|
||||||
|
@ApiQuery({
|
||||||
|
name: 'P_SPID',
|
||||||
|
required: false,
|
||||||
|
type: Number,
|
||||||
|
description: 'The ID of the parameter',
|
||||||
|
})
|
||||||
|
@ApiQuery({
|
||||||
|
name: 'P_PARAMTYPE',
|
||||||
|
required: false,
|
||||||
|
type: String,
|
||||||
|
description: 'The type of the parameter',
|
||||||
|
})
|
||||||
|
getAllParamValues(@Query() body: getParamValuesDTO) {
|
||||||
|
return this.paramTableService.GETALLPARAMVALUES(body);
|
||||||
|
}
|
||||||
|
|
||||||
@Get('GetCountriesAndMessages')
|
@Get('GetCountriesAndMessages')
|
||||||
@Roles('ca', 'sa', 'ua')
|
@Roles('ca', 'sa', 'ua')
|
||||||
GET_COUNTRIES_AND_MESSAGES() {
|
GET_COUNTRIES_AND_MESSAGES() {
|
||||||
|
|||||||
@ -63,6 +63,52 @@ export class ParamTableService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async GETALLPARAMVALUES(body: getParamValuesDTO) {
|
||||||
|
const finalBody = {
|
||||||
|
P_SPID: body.P_SPID === 0 ? body.P_SPID : body.P_SPID ? body.P_SPID : null,
|
||||||
|
P_PARAMTYPE: body.P_PARAMTYPE ? body.P_PARAMTYPE : null,
|
||||||
|
};
|
||||||
|
|
||||||
|
let connection;
|
||||||
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
|
|
||||||
|
const result = await connection.execute(
|
||||||
|
`BEGIN
|
||||||
|
MANAGEPARAMTABLE_PKG.GetAllParamValues(:P_SPID,:P_PARAMTYPE,:P_CURSOR);
|
||||||
|
END;`,
|
||||||
|
{
|
||||||
|
P_SPID: { val: finalBody.P_SPID, type: oracledb.DB_TYPE_NUMBER },
|
||||||
|
P_PARAMTYPE: { val: finalBody.P_PARAMTYPE, type: oracledb.DB_TYPE_NVARCHAR },
|
||||||
|
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.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// const fres: any = await fetchCursor(outBinds.P_CURSOR, ParamTableService.name);
|
||||||
|
|
||||||
|
// if (fres.length > 0 && fres[0].ERRORMESG) {
|
||||||
|
// this.logger.warn(fres[0].ERRORMESG);
|
||||||
|
// throw new BadRequestException(fres[0].ERRORMESG)
|
||||||
|
// }
|
||||||
|
|
||||||
|
return await fetchCursor(outBinds.P_CURSOR, ParamTableService.name);
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
handleError(error, ParamTableService.name)
|
||||||
|
} finally {
|
||||||
|
await closeOracleDbConnection(connection, ParamTableService.name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async GET_COUNTRIES_AND_MESSAGES() {
|
async GET_COUNTRIES_AND_MESSAGES() {
|
||||||
let connection;
|
let connection;
|
||||||
try {
|
try {
|
||||||
@ -254,7 +300,7 @@ export class ParamTableService {
|
|||||||
|
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
`BEGIN
|
`BEGIN
|
||||||
MANAGEPARAMTABLE_PKG.REACTIVATEPARAMRECORD(:P_PARAMID,:P_USERID);
|
MANAGEPARAMTABLE_PKG.INACTIVATEPARAMRECORD(:P_PARAMID,:P_USERID);
|
||||||
END;`,
|
END;`,
|
||||||
{
|
{
|
||||||
P_PARAMID: { val: body.P_PARAMID, type: oracledb.DB_TYPE_NUMBER },
|
P_PARAMID: { val: body.P_PARAMID, type: oracledb.DB_TYPE_NUMBER },
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user