api.http updated
This commit is contained in:
parent
e1924ed85c
commit
4d205d450a
50
api.http
50
api.http
@ -162,10 +162,10 @@ Content-Type: application/json
|
||||
|
||||
{
|
||||
"p_spid": 2,
|
||||
"p_regionid": 65,
|
||||
"p_regionid": 81,
|
||||
"p_startnumber": 2000,
|
||||
"p_endnumber": 3000,
|
||||
"p_carnettype": "type1"
|
||||
"p_carnettype": "original"
|
||||
}
|
||||
|
||||
###
|
||||
@ -178,7 +178,20 @@ GET http://localhost:3000/oracle/GetCarnetSequence/12
|
||||
|
||||
//GetParamValues
|
||||
|
||||
GET http://localhost:3000/oracle/GetParamValues?id=1&type=original
|
||||
GET http://localhost:3000/oracle/GetParamValues?id=500&type=original
|
||||
|
||||
###
|
||||
|
||||
|
||||
//CreateTableRecord
|
||||
|
||||
POST http://localhost:3000/oracle/CreateTableRecord
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"P_USERID": 6,
|
||||
"P_TABLEFULLDESC": "TypeA desc",
|
||||
}
|
||||
|
||||
###
|
||||
|
||||
@ -188,7 +201,7 @@ POST http://localhost:3000/oracle/CreateParamRecord
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
# "P_SPID": 123,
|
||||
# "P_SPID": 4,
|
||||
"P_PARAMTYPE": "TypeA",
|
||||
"P_PARAMDESC": "Description of the parameter",
|
||||
"P_PARAMVALUE": "Value of the parameter",
|
||||
@ -198,7 +211,7 @@ Content-Type: application/json
|
||||
# "P_ADDLPARAMVALUE4": "Additional Value 4",
|
||||
# "P_ADDLPARAMVALUE5": null,
|
||||
"P_SORTSEQ": 1,
|
||||
"P_USERID": "user123"
|
||||
"P_USERID": "12"
|
||||
}
|
||||
|
||||
###
|
||||
@ -209,16 +222,16 @@ PATCH http://localhost:3000/oracle/UpdateParamRecord
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"P_SPID": 123,
|
||||
"P_PARAMID": 456,
|
||||
"P_PARAMDESC": "Description of the parameter",
|
||||
"P_ADDLPARAMVALUE1": "Additional Value 1",
|
||||
"P_ADDLPARAMVALUE2": "Additional Value 2",
|
||||
"P_SPID": 2,
|
||||
"P_PARAMID": 1,
|
||||
"P_PARAMDESC": "abc",
|
||||
"P_ADDLPARAMVALUE1": "asd",
|
||||
"P_ADDLPARAMVALUE2": "ad",
|
||||
"P_ADDLPARAMVALUE3": null,
|
||||
"P_ADDLPARAMVALUE4": "Additional Value 4",
|
||||
"P_ADDLPARAMVALUE4": "asd",
|
||||
"P_ADDLPARAMVALUE5": null,
|
||||
"P_SORTSEQ": 1,
|
||||
"P_USERID": "user123"
|
||||
"P_USERID": "12"
|
||||
}
|
||||
|
||||
###
|
||||
@ -226,12 +239,25 @@ Content-Type: application/json
|
||||
// InActivateParamRecord
|
||||
|
||||
PATCH http://localhost:3000/oracle/InActivateParamRecord?pid=1&uid=2
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"P_PARAMID":2,
|
||||
"P_USERID":"12"
|
||||
}
|
||||
|
||||
###
|
||||
|
||||
// ReActivateParamRecord
|
||||
|
||||
PATCH http://localhost:3000/oracle/ReActivateParamRecord?pid=1&uid=2
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"P_PARAMID":2,
|
||||
"P_USERID":"12"
|
||||
}
|
||||
|
||||
###
|
||||
|
||||
|
||||
|
||||
97
src/oracle/manageFee.service.ts
Normal file
97
src/oracle/manageFee.service.ts
Normal file
@ -0,0 +1,97 @@
|
||||
import { Injectable } from "@nestjs/common";
|
||||
import { OracleDBService } from "src/db/db.service";
|
||||
import { CreateBasicFeeDTO } from "./oracle.dto";
|
||||
import * as oracledb from 'oracledb';
|
||||
|
||||
@Injectable()
|
||||
export class ManageFeeService {
|
||||
|
||||
constructor(private readonly oracleDBService: OracleDBService) { }
|
||||
|
||||
async CREATEBASICFEE(body:CreateBasicFeeDTO) {
|
||||
|
||||
let connection;
|
||||
try {
|
||||
// Connect to the Oracle database using oracledb
|
||||
connection = await this.oracleDBService.getConnection()
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
`BEGIN
|
||||
MANAGEFEE_SETUP_PKG.CREATEBASICFEE(
|
||||
:P_SPID,
|
||||
:P_STARTCARNETVALUE,
|
||||
:P_ENDCARNETVALUE,
|
||||
:P_EFFDATE,
|
||||
:P_FEES,
|
||||
:P_USERID,
|
||||
:P_CURSOR);
|
||||
END;`,
|
||||
{
|
||||
P_SPID: {
|
||||
val: body.P_SPID,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
P_STARTCARNETVALUE: {
|
||||
val: body.P_STARTCARNETVALUE,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
P_ENDCARNETVALUE: {
|
||||
val: body.P_ENDCARNETVALUE,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
P_EFFDATE: {
|
||||
val: body.P_EFFDATE,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
P_FEES: {
|
||||
val: body.P_FEES,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
P_USERID: {
|
||||
val: body.P_USERID,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
|
||||
P_CURSOR: {
|
||||
type: oracledb.CURSOR,
|
||||
dir: oracledb.BIND_OUT
|
||||
}
|
||||
}, {
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
||||
}
|
||||
);
|
||||
await connection.commit();
|
||||
|
||||
let fres = await result.outBinds.p_cursor.getRows();
|
||||
|
||||
return fres
|
||||
|
||||
} catch (err) {
|
||||
console.error('Error fetching users: ', err);
|
||||
throw new Error('Error fetching users');
|
||||
} finally { }
|
||||
|
||||
}
|
||||
async CREATEBONDRATE() { }
|
||||
async CREATECARGORATE() { }
|
||||
async CREATECFFEE() { }
|
||||
async CREATECSFEE() { }
|
||||
async CREATEEFFEE() { }
|
||||
async CREATEFEECOMM() { }
|
||||
async GETBASICFEERATES() { }
|
||||
async GETBONDRATES() { }
|
||||
async GETCARGORATES() { }
|
||||
async GETCFFEERATES() { }
|
||||
async GETCSFEERATES() { }
|
||||
async GETEFFEERATES() { }
|
||||
async GETFEECOMM() { }
|
||||
async UPDATEBASICFEE() { }
|
||||
async UPDATEBONDRATE() { }
|
||||
async UPDATECARGORATE() { }
|
||||
async UPDATECFFEE() { }
|
||||
async UPDATEEFFEE() { }
|
||||
async UPDATEFEECOMM() { }
|
||||
}
|
||||
@ -203,42 +203,42 @@ export class CreateParamRecordDTO {
|
||||
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
P_SPID?: number;
|
||||
P_SPID?: number;
|
||||
|
||||
@IsString()
|
||||
P_PARAMTYPE: string;
|
||||
P_PARAMTYPE: string;
|
||||
|
||||
@IsString()
|
||||
P_PARAMDESC: string;
|
||||
P_PARAMDESC: string;
|
||||
|
||||
@IsString()
|
||||
P_PARAMVALUE: string;
|
||||
P_PARAMVALUE: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
P_ADDLPARAMVALUE1?: string;
|
||||
P_ADDLPARAMVALUE1?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
P_ADDLPARAMVALUE2?: string;
|
||||
P_ADDLPARAMVALUE2?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
P_ADDLPARAMVALUE3?: string;
|
||||
P_ADDLPARAMVALUE3?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
P_ADDLPARAMVALUE4?: string;
|
||||
P_ADDLPARAMVALUE4?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
P_ADDLPARAMVALUE5?: string;
|
||||
P_ADDLPARAMVALUE5?: string;
|
||||
|
||||
@IsNumber()
|
||||
P_SORTSEQ: number;
|
||||
P_SORTSEQ: number;
|
||||
|
||||
@IsString()
|
||||
P_USERID: string;
|
||||
P_USERID: string;
|
||||
}
|
||||
|
||||
|
||||
@ -276,6 +276,26 @@ export class UpdateParamRecordDTO {
|
||||
@IsNumber()
|
||||
P_SORTSEQ: number;
|
||||
|
||||
@IsString()
|
||||
P_USERID: string;
|
||||
}
|
||||
|
||||
export class CreateBasicFeeDTO {
|
||||
@IsNumber()
|
||||
P_SPID: number;
|
||||
|
||||
@IsNumber()
|
||||
P_STARTCARNETVALUE: number;
|
||||
|
||||
@IsNumber()
|
||||
P_ENDCARNETVALUE: number;
|
||||
|
||||
@IsString()
|
||||
P_EFFDATE: string;
|
||||
|
||||
@IsNumber()
|
||||
P_FEES: number;
|
||||
|
||||
@IsString()
|
||||
P_USERID: string;
|
||||
}
|
||||
@ -3,11 +3,12 @@ import { OracleService } from './oracle.service';
|
||||
import { OracleController } from './oracle.controller';
|
||||
import { DbModule } from 'src/db/db.module';
|
||||
import { ParamTableService } from './paramTable.service';
|
||||
import { ManageFeeService } from './manageFee.service';
|
||||
|
||||
@Module({
|
||||
imports:[DbModule],
|
||||
providers: [OracleService,ParamTableService],
|
||||
providers: [OracleService,ParamTableService,ManageFeeService],
|
||||
controllers: [OracleController],
|
||||
exports:[OracleService,ParamTableService]
|
||||
exports:[OracleService,ParamTableService,ManageFeeService]
|
||||
})
|
||||
export class OracleModule {}
|
||||
|
||||
@ -252,6 +252,8 @@ export class OracleService {
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
||||
}
|
||||
);
|
||||
await connection.commit();
|
||||
|
||||
let fres = await result.outBinds.p_cursor.getRows();
|
||||
|
||||
return fres
|
||||
@ -377,6 +379,9 @@ export class OracleService {
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
||||
}
|
||||
);
|
||||
|
||||
await connection.commit();
|
||||
|
||||
let fres = await result.outBinds.p_cursor.getRows();
|
||||
|
||||
return fres
|
||||
@ -579,6 +584,9 @@ export class OracleService {
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
||||
}
|
||||
);
|
||||
|
||||
await connection.commit();
|
||||
|
||||
let fres = await result.outBinds.p_cursor.getRows();
|
||||
|
||||
return fres
|
||||
@ -699,6 +707,9 @@ export class OracleService {
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
||||
}
|
||||
);
|
||||
|
||||
await connection.commit();
|
||||
|
||||
let fres = await result.outBinds.p_cursor.getRows();
|
||||
|
||||
return fres
|
||||
@ -900,6 +911,9 @@ export class OracleService {
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
||||
}
|
||||
);
|
||||
|
||||
await connection.commit();
|
||||
|
||||
let fres = await result.outBinds.p_cursor.getRows();
|
||||
|
||||
await result.outBinds.p_cursor.close()
|
||||
|
||||
@ -25,7 +25,7 @@ export class ParamTableService {
|
||||
{
|
||||
P_SPID: {
|
||||
val: P_SPID,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NUMBER
|
||||
},
|
||||
P_PARAMTYPE: {
|
||||
val: P_PARAMTYPE,
|
||||
@ -245,7 +245,7 @@ export class ParamTableService {
|
||||
},
|
||||
P_PARAMID: {
|
||||
val: body.P_PARAMID,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_NUMBER
|
||||
},
|
||||
P_PARAMDESC: {
|
||||
val: body.P_PARAMDESC,
|
||||
@ -314,8 +314,7 @@ export class ParamTableService {
|
||||
`BEGIN
|
||||
MANAGEPARAMTABLE_PKG.INACTIVATEPARAMRECORD(
|
||||
:P_PARAMID,
|
||||
:P_USERID,
|
||||
:p_cursor);
|
||||
:P_USERID);
|
||||
END;`,
|
||||
{
|
||||
P_PARAMID: {
|
||||
@ -326,20 +325,11 @@ export class ParamTableService {
|
||||
val: P_USERID,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
|
||||
p_cursor: {
|
||||
type: oracledb.CURSOR,
|
||||
dir: oracledb.BIND_OUT
|
||||
}
|
||||
}, {
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
||||
}
|
||||
}
|
||||
);
|
||||
await connection.commit();
|
||||
|
||||
let fres = await result.outBinds.p_cursor.getRows();
|
||||
|
||||
return fres
|
||||
return "SP Executed Successfully"
|
||||
|
||||
|
||||
} catch (err) {
|
||||
@ -361,8 +351,7 @@ export class ParamTableService {
|
||||
`BEGIN
|
||||
MANAGEPARAMTABLE_PKG.REACTIVATEPARAMRECORD(
|
||||
:P_PARAMID,
|
||||
:P_USERID,
|
||||
:p_cursor);
|
||||
:P_USERID);
|
||||
END;`,
|
||||
{
|
||||
P_PARAMID: {
|
||||
@ -373,20 +362,11 @@ export class ParamTableService {
|
||||
val: P_USERID,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
},
|
||||
|
||||
p_cursor: {
|
||||
type: oracledb.CURSOR,
|
||||
dir: oracledb.BIND_OUT
|
||||
}
|
||||
}, {
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
||||
}
|
||||
},
|
||||
);
|
||||
await connection.commit();
|
||||
|
||||
let fres = await result.outBinds.p_cursor.getRows();
|
||||
|
||||
return fres
|
||||
return "SP Executed Successfully"
|
||||
|
||||
|
||||
} catch (err) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user