modified api

This commit is contained in:
Kallesh B S 2025-04-30 12:57:29 +05:30
parent 98f70b9784
commit d66dccd637
3 changed files with 8 additions and 3 deletions

View File

@ -1,4 +1,4 @@
GET http://localhost:3000/oracle/GetPreparerByClientid?p_spid=as&p_clientid=8
GET http://localhost:3000/mssql/GetParamValues?P_PARAMTYPE=000&P_SPID=asdf
###

View File

@ -17,10 +17,13 @@ export class ParamTableService {
async GETPARAMVALUES(body: getParamValuesDTO) {
const finalBody = {
P_SPID: body.P_SPID ? body.P_SPID : null,
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,
};
console.log(finalBody);
let connection: Connection;
try {
connection = await this.mssqlDBService.getConnection();
@ -60,6 +63,7 @@ export class ParamTableService {
async CREATEPARAMRECORD(body: CreateParamRecordDTO) {
let connection: Connection;
try {
connection = await this.mssqlDBService.getConnection();
const request = new Request(connection);
request.input('P_SPID', mssql.Int, body.P_SPID);
request.input('P_PARAMTYPE', mssql.VarChar(255), body.P_PARAMTYPE);
@ -86,6 +90,7 @@ export class ParamTableService {
async UPDATEPARAMRECORD(body: UpdateParamRecordDTO) {
let connection: Connection;
try {
connection = await this.mssqlDBService.getConnection();
const request = new Request(connection);
request.input('P_SPID', mssql.Int, body.P_SPID);
request.input('P_PARAMID', mssql.Int, body.P_PARAMID);

View File

@ -122,9 +122,9 @@ export class UpdateParamRecordDTO {
}
export class getParamValuesDTO {
@Min(0, { message: 'Property P_SPID must be at least 0' })
@IsInt({ message: 'Property P_SPID must be a whole number' })
@IsNumber({}, { message: 'Property P_SPID must be a number' })
@Min(0, { message: 'Property P_SPID must be at least 0' })
@Transform(({ value }) => Number(value))
@IsOptional()
P_SPID?: number;