mssql pt mod
This commit is contained in:
parent
51f9bd6043
commit
d0c175800e
@ -10,6 +10,8 @@ import {
|
||||
UpdateParamRecordDTO,
|
||||
} from '../../oracle/param-table/param-table.dto';
|
||||
import { Connection } from 'mssql';
|
||||
import { InternalServerException } from 'src/exceptions/internalServerError.exception';
|
||||
import { BadRequestException } from 'src/exceptions/badRequest.exception';
|
||||
|
||||
@Injectable()
|
||||
export class ParamTableService {
|
||||
@ -22,7 +24,7 @@ export class ParamTableService {
|
||||
};
|
||||
|
||||
console.log(finalBody);
|
||||
|
||||
|
||||
|
||||
let connection: Connection;
|
||||
try {
|
||||
@ -31,10 +33,10 @@ export class ParamTableService {
|
||||
request.input('P_SPID', mssql.Int, finalBody.P_SPID);
|
||||
request.input('P_PARAMTYPE', mssql.VarChar(100), finalBody.P_PARAMTYPE);
|
||||
const result = await request.execute('carnetsys.GETPARAMVALUES');
|
||||
return { data: result.recordset };
|
||||
return result.recordset;
|
||||
} catch (error) {
|
||||
return { error: error.message };
|
||||
}
|
||||
throw new InternalServerException();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -46,10 +48,16 @@ export class ParamTableService {
|
||||
request.input('P_USERID', mssql.VarChar(100), body.P_USERID);
|
||||
request.input('P_TABLEFULLDESC', mssql.NVarChar, body.P_TABLEFULLDESC);
|
||||
const result = await request.execute('carnetsys.CREATETABLERECORD');
|
||||
return { data: result.recordset };
|
||||
// return { data: result.recordset };
|
||||
if (result['recordset'][0].ERRORMSG) {
|
||||
throw new BadRequestException(result[0].ERRORMSG);
|
||||
}
|
||||
else {
|
||||
return { statusCode: 201, message: "Created Successfully" }
|
||||
}
|
||||
} catch (error) {
|
||||
return { error: error.message };
|
||||
}
|
||||
throw new InternalServerException();
|
||||
}
|
||||
}
|
||||
|
||||
async CREATEPARAMRECORD(body: CreateParamRecordDTO) {
|
||||
@ -69,10 +77,17 @@ export class ParamTableService {
|
||||
request.input('P_SORTSEQ', mssql.Int, body.P_SORTSEQ);
|
||||
request.input('P_USERID', mssql.VarChar(100), body.P_USERID);
|
||||
const result = await request.execute('carnetsys.CREATEPARAMRECORD');
|
||||
return { data: result.recordset };
|
||||
// return { data: result.recordset };
|
||||
if (result['recordset'][0].ERRORMSG) {
|
||||
throw new BadRequestException(result[0].ERRORMSG);
|
||||
}
|
||||
else {
|
||||
return { statusCode: 201, message: "Created Successfully" }
|
||||
}
|
||||
} catch (error) {
|
||||
return { error: error.message };
|
||||
}
|
||||
// return { error: error.message };
|
||||
throw new InternalServerException()
|
||||
}
|
||||
}
|
||||
|
||||
async UPDATEPARAMRECORD(body: UpdateParamRecordDTO) {
|
||||
@ -91,10 +106,16 @@ export class ParamTableService {
|
||||
request.input('P_SORTSEQ', mssql.Int, body.P_SORTSEQ);
|
||||
request.input('P_USERID', mssql.VarChar(100), body.P_USERID);
|
||||
const result = await request.execute('carnetsys.UPDATEPARAMRECORD');
|
||||
return { data: result.recordset };
|
||||
// return { data: result.recordset };
|
||||
if (result['recordset'][0].ERRORMSG) {
|
||||
throw new BadRequestException(result[0].ERRORMSG);
|
||||
}
|
||||
else {
|
||||
return { statusCode: 200, message: "Updated Successfully" }
|
||||
}
|
||||
} catch (error) {
|
||||
return { error: error.message };
|
||||
}
|
||||
throw new InternalServerException();
|
||||
}
|
||||
}
|
||||
|
||||
async INACTIVATEPARAMRECORD(body: ActivateOrInactivateParamRecordDTO) {
|
||||
@ -106,10 +127,16 @@ export class ParamTableService {
|
||||
request.input('P_PARAMID', mssql.Int, body.P_PARAMID);
|
||||
request.input('P_USERID', mssql.VarChar(100), body.P_USERID);
|
||||
const result = await request.execute('carnetsys.INACTIVATEPARAMRECORD');
|
||||
return { data: result.recordset };
|
||||
// return { data: result.recordset };
|
||||
if (result['recordset'][0].ERRORMSG) {
|
||||
throw new BadRequestException(result[0].ERRORMSG);
|
||||
}
|
||||
else {
|
||||
return { statusCode: 200, message: result['recordset'][0].message }
|
||||
}
|
||||
} catch (error) {
|
||||
return { error: error.message };
|
||||
}
|
||||
throw new InternalServerException();
|
||||
}
|
||||
}
|
||||
|
||||
async REACTIVATEPARAMRECORD(body: ActivateOrInactivateParamRecordDTO) {
|
||||
@ -120,9 +147,15 @@ export class ParamTableService {
|
||||
request.input('P_PARAMID', mssql.Int, body.P_PARAMID);
|
||||
request.input('P_USERID', mssql.VarChar(100), body.P_USERID);
|
||||
const result = await request.execute('carnetsys.REACTIVATEPARAMRECORD');
|
||||
return { data: result.recordset };
|
||||
// return { data: result.recordset };
|
||||
if (result['recordset'][0].ERRORMSG) {
|
||||
throw new BadRequestException(result[0].ERRORMSG);
|
||||
}
|
||||
else {
|
||||
return { statusCode: 200, message: result['recordset'][0].message }
|
||||
}
|
||||
} catch (error) {
|
||||
return { error: error.message };
|
||||
}
|
||||
throw new InternalServerException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user