mssql pt mod
This commit is contained in:
parent
51f9bd6043
commit
d0c175800e
@ -10,6 +10,8 @@ import {
|
|||||||
UpdateParamRecordDTO,
|
UpdateParamRecordDTO,
|
||||||
} from '../../oracle/param-table/param-table.dto';
|
} from '../../oracle/param-table/param-table.dto';
|
||||||
import { Connection } from 'mssql';
|
import { Connection } from 'mssql';
|
||||||
|
import { InternalServerException } from 'src/exceptions/internalServerError.exception';
|
||||||
|
import { BadRequestException } from 'src/exceptions/badRequest.exception';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ParamTableService {
|
export class ParamTableService {
|
||||||
@ -31,9 +33,9 @@ export class ParamTableService {
|
|||||||
request.input('P_SPID', mssql.Int, finalBody.P_SPID);
|
request.input('P_SPID', mssql.Int, finalBody.P_SPID);
|
||||||
request.input('P_PARAMTYPE', mssql.VarChar(100), finalBody.P_PARAMTYPE);
|
request.input('P_PARAMTYPE', mssql.VarChar(100), finalBody.P_PARAMTYPE);
|
||||||
const result = await request.execute('carnetsys.GETPARAMVALUES');
|
const result = await request.execute('carnetsys.GETPARAMVALUES');
|
||||||
return { data: result.recordset };
|
return result.recordset;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return { error: error.message };
|
throw new InternalServerException();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -46,9 +48,15 @@ export class ParamTableService {
|
|||||||
request.input('P_USERID', mssql.VarChar(100), body.P_USERID);
|
request.input('P_USERID', mssql.VarChar(100), body.P_USERID);
|
||||||
request.input('P_TABLEFULLDESC', mssql.NVarChar, body.P_TABLEFULLDESC);
|
request.input('P_TABLEFULLDESC', mssql.NVarChar, body.P_TABLEFULLDESC);
|
||||||
const result = await request.execute('carnetsys.CREATETABLERECORD');
|
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) {
|
} catch (error) {
|
||||||
return { error: error.message };
|
throw new InternalServerException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,9 +77,16 @@ export class ParamTableService {
|
|||||||
request.input('P_SORTSEQ', mssql.Int, body.P_SORTSEQ);
|
request.input('P_SORTSEQ', mssql.Int, body.P_SORTSEQ);
|
||||||
request.input('P_USERID', mssql.VarChar(100), body.P_USERID);
|
request.input('P_USERID', mssql.VarChar(100), body.P_USERID);
|
||||||
const result = await request.execute('carnetsys.CREATEPARAMRECORD');
|
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) {
|
} catch (error) {
|
||||||
return { error: error.message };
|
// return { error: error.message };
|
||||||
|
throw new InternalServerException()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,9 +106,15 @@ export class ParamTableService {
|
|||||||
request.input('P_SORTSEQ', mssql.Int, body.P_SORTSEQ);
|
request.input('P_SORTSEQ', mssql.Int, body.P_SORTSEQ);
|
||||||
request.input('P_USERID', mssql.VarChar(100), body.P_USERID);
|
request.input('P_USERID', mssql.VarChar(100), body.P_USERID);
|
||||||
const result = await request.execute('carnetsys.UPDATEPARAMRECORD');
|
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) {
|
} catch (error) {
|
||||||
return { error: error.message };
|
throw new InternalServerException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,9 +127,15 @@ export class ParamTableService {
|
|||||||
request.input('P_PARAMID', mssql.Int, body.P_PARAMID);
|
request.input('P_PARAMID', mssql.Int, body.P_PARAMID);
|
||||||
request.input('P_USERID', mssql.VarChar(100), body.P_USERID);
|
request.input('P_USERID', mssql.VarChar(100), body.P_USERID);
|
||||||
const result = await request.execute('carnetsys.INACTIVATEPARAMRECORD');
|
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) {
|
} catch (error) {
|
||||||
return { error: error.message };
|
throw new InternalServerException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,9 +147,15 @@ export class ParamTableService {
|
|||||||
request.input('P_PARAMID', mssql.Int, body.P_PARAMID);
|
request.input('P_PARAMID', mssql.Int, body.P_PARAMID);
|
||||||
request.input('P_USERID', mssql.VarChar(100), body.P_USERID);
|
request.input('P_USERID', mssql.VarChar(100), body.P_USERID);
|
||||||
const result = await request.execute('carnetsys.REACTIVATEPARAMRECORD');
|
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) {
|
} catch (error) {
|
||||||
return { error: error.message };
|
throw new InternalServerException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user