modularized the code
This commit is contained in:
parent
e658df4926
commit
2f1fca47c8
@ -2,7 +2,6 @@ import { Module } from '@nestjs/common';
|
|||||||
import { DbModule } from './db/db.module';
|
import { DbModule } from './db/db.module';
|
||||||
import { OracleModule } from './oracle/oracle.module';
|
import { OracleModule } from './oracle/oracle.module';
|
||||||
import { AuthModule } from './auth/auth.module';
|
import { AuthModule } from './auth/auth.module';
|
||||||
import { CustomPipeModule } from './custom-pipe/custom-pipe.module';
|
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [ AuthModule, DbModule, OracleModule],
|
imports: [ AuthModule, DbModule, OracleModule],
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import { AuthService } from './auth.service';
|
|||||||
import { ApiTags } from '@nestjs/swagger';
|
import { ApiTags } from '@nestjs/swagger';
|
||||||
import { AuthLoginDTO } from './auth.dto';
|
import { AuthLoginDTO } from './auth.dto';
|
||||||
|
|
||||||
@Controller('auth')
|
@Controller()
|
||||||
export class AuthController {
|
export class AuthController {
|
||||||
|
|
||||||
constructor(private readonly authService:AuthService){}
|
constructor(private readonly authService:AuthService){}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { Injectable } from '@nestjs/common';
|
import { BadRequestException, Injectable } from '@nestjs/common';
|
||||||
import { OracleDBService } from 'src/db/db.service';
|
import { OracleDBService } from 'src/db/db.service';
|
||||||
import { AuthLoginDTO } from './auth.dto';
|
import { AuthLoginDTO } from './auth.dto';
|
||||||
import * as oracledb from 'oracledb'
|
import * as oracledb from 'oracledb'
|
||||||
@ -42,80 +42,19 @@ export class AuthService {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (result.outBinds && result.outBinds.p_login_cursor) {
|
if (result.outBinds && result.outBinds.p_login_cursor) {
|
||||||
const cursor = result.outBinds.p_login_cursor; // The OUT cursor
|
const cursor = result.outBinds.p_login_cursor;
|
||||||
let rowsBatch;
|
let rowsBatch;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
rowsBatch = await cursor.getRows(100); // Fetch 100 rows at a time
|
rowsBatch = await cursor.getRows(100);
|
||||||
rows = rows.concat(rowsBatch); // Append fetched rows to the main array
|
rows = rows.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
console.log('Rows fetched:', rows);
|
|
||||||
|
|
||||||
// Close the cursor after you're done
|
|
||||||
await cursor.close();
|
await cursor.close();
|
||||||
} else {
|
} else {
|
||||||
throw new Error('No cursor returned from the stored procedure');
|
return new BadRequestException({Error:"Error executing request try after some time!"});
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (result.outBinds && result.outBinds.p_carnet_count_cur) {
|
|
||||||
// const cursor = result.outBinds.p_carnet_count_cur; // The OUT cursor
|
|
||||||
// let rowsBatch;
|
|
||||||
|
|
||||||
// do {
|
|
||||||
// rowsBatch = await cursor.getRows(100); // Fetch 100 rows at a time
|
|
||||||
// crows = crows.concat(rowsBatch); // Append fetched rows to the main array
|
|
||||||
// } while (rowsBatch.length > 0);
|
|
||||||
|
|
||||||
// console.log('Rows fetched:', crows);
|
|
||||||
|
|
||||||
// // Close the cursor after you're done
|
|
||||||
// await cursor.close();
|
|
||||||
// } else {
|
|
||||||
// throw new Error('No cursor returned from the stored procedure');
|
|
||||||
// }
|
|
||||||
|
|
||||||
// crows = crows.map(obj => {
|
|
||||||
// // Create a new object to hold the modified keys
|
|
||||||
// let newObj = {};
|
|
||||||
|
|
||||||
// // Iterate over the keys of the current object
|
|
||||||
// for (let key in obj) {
|
|
||||||
// // Replace spaces with underscores in the key
|
|
||||||
// let newKey = key.replace(/ /g, "_");
|
|
||||||
// newObj[newKey] = obj[key];
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return newObj;
|
|
||||||
// });
|
|
||||||
|
|
||||||
// crows = crows.reduce((acc, curr) => {
|
|
||||||
// // Find if the current item already exists in the accumulator
|
|
||||||
// let existing = acc.find(item => item["Service_Provider_Name"] === curr["Service_Provider_Name"] && item.SPID === curr.SPID);
|
|
||||||
|
|
||||||
// if (existing) {
|
|
||||||
// // If it exists, push the current "cs" and "c c" values into the arrays
|
|
||||||
// existing.CARNETSTATUS.push(curr.CARNETSTATUS);
|
|
||||||
// existing["Carnet_Count"].push(curr["Carnet_Count"]);
|
|
||||||
// } else {
|
|
||||||
// // If it doesn't exist, create a new entry
|
|
||||||
// acc.push({
|
|
||||||
// "Service_Provider_Name": curr["Service_Provider_Name"],
|
|
||||||
// SPID: curr.SPID,
|
|
||||||
// CARNETSTATUS: [curr.CARNETSTATUS],
|
|
||||||
// "Carnet_Count": [curr["Carnet_Count"]]
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return acc;
|
|
||||||
// }, []);
|
|
||||||
|
|
||||||
// if(!crows[0].SPID){
|
|
||||||
// return {error:"Invalid username or password"}
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return {rows,chartResult:crows};
|
|
||||||
|
|
||||||
if(rows[0]["ERRORMESG"]){
|
if(rows[0]["ERRORMESG"]){
|
||||||
return {error:"Invalid username or password!"}
|
return {error:"Invalid username or password!"}
|
||||||
}
|
}
|
||||||
@ -123,7 +62,6 @@ export class AuthService {
|
|||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching users: ', err.message);
|
console.error('Error fetching users: ', err.message);
|
||||||
// throw new Error('Error fetching users');
|
|
||||||
return {error:"Invalid username or password"}
|
return {error:"Invalid username or password"}
|
||||||
} finally { }
|
} finally { }
|
||||||
|
|
||||||
|
|||||||
@ -1,11 +0,0 @@
|
|||||||
|
|
||||||
import { ArgumentMetadata, Injectable, PipeTransform, BadRequestException } from '@nestjs/common';
|
|
||||||
|
|
||||||
@Injectable()
|
|
||||||
export class CustomParseIntPipe implements PipeTransform {
|
|
||||||
transform(value: any, metadata: ArgumentMetadata) {
|
|
||||||
const parsedValue = parseInt(value, 10);
|
|
||||||
|
|
||||||
return parsedValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
import { Module } from '@nestjs/common';
|
|
||||||
import { CustomParseIntPipe } from './custom-parseInt-pipe.service';
|
|
||||||
|
|
||||||
@Module({
|
|
||||||
imports:[],
|
|
||||||
providers: [CustomParseIntPipe],
|
|
||||||
exports:[CustomParseIntPipe]
|
|
||||||
})
|
|
||||||
export class CustomPipeModule {}
|
|
||||||
@ -35,19 +35,6 @@ export class HomePageController {
|
|||||||
return this.homePageService.GetCarnetSummaryData(id);
|
return this.homePageService.GetCarnetSummaryData(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('HomePage - Oracle')
|
|
||||||
@Post('/oracle/SaveCarnetApplication')
|
|
||||||
SaveCarnetApplication(@Body() body: SaveCarnetApplicationDTO) {
|
|
||||||
return this.homePageService.SaveCarnetApplication(body);
|
|
||||||
// return body;
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiTags('HomePage - Oracle')
|
|
||||||
@Post('/oracle/TransmitApplicationtoProcess')
|
|
||||||
TransmitApplicationtoProcess(@Body() body: TransmitApplicationtoProcessDTO) {
|
|
||||||
return this.homePageService.TransmitApplicationtoProcess(body);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiTags('HomePage - Oracle')
|
@ApiTags('HomePage - Oracle')
|
||||||
@Get('/oracle/GetCarnetDetailsbyCarnetStatus/:p_spid/:p_userid/:p_CarnetStatus')
|
@Get('/oracle/GetCarnetDetailsbyCarnetStatus/:p_spid/:p_userid/:p_CarnetStatus')
|
||||||
GetCarnetDetailsbyCarnetStatus(
|
GetCarnetDetailsbyCarnetStatus(
|
||||||
@ -74,4 +61,18 @@ export class HomePageController {
|
|||||||
return new BadRequestException({ message: 'Validation faileda', error: err.message })
|
return new BadRequestException({ message: 'Validation faileda', error: err.message })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiTags('HomePage - Oracle')
|
||||||
|
@Post('/oracle/SaveCarnetApplication')
|
||||||
|
SaveCarnetApplication(@Body() body: SaveCarnetApplicationDTO) {
|
||||||
|
return this.homePageService.SaveCarnetApplication(body);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiTags('HomePage - Oracle')
|
||||||
|
@Post('/oracle/TransmitApplicationtoProcess')
|
||||||
|
TransmitApplicationtoProcess(@Body() body: TransmitApplicationtoProcessDTO) {
|
||||||
|
return this.homePageService.TransmitApplicationtoProcess(body);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -290,7 +290,7 @@ export class HomePageService {
|
|||||||
return output;
|
return output;
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching users: ', err);
|
|
||||||
return { error: err.message }
|
return { error: err.message }
|
||||||
} finally { }
|
} finally { }
|
||||||
}
|
}
|
||||||
@ -378,7 +378,7 @@ export class HomePageService {
|
|||||||
return rows;
|
return rows;
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching users: ', err);
|
|
||||||
return { error: err.message }
|
return { error: err.message }
|
||||||
} finally { }
|
} finally { }
|
||||||
|
|
||||||
@ -667,7 +667,7 @@ export class HomePageService {
|
|||||||
return rows;
|
return rows;
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching users: ', err);
|
|
||||||
return { error: err.message }
|
return { error: err.message }
|
||||||
} finally { }
|
} finally { }
|
||||||
}
|
}
|
||||||
@ -735,7 +735,7 @@ export class HomePageService {
|
|||||||
// return fres
|
// return fres
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching users: ', err);
|
|
||||||
return { error: err.message }
|
return { error: err.message }
|
||||||
} finally { }
|
} finally { }
|
||||||
|
|
||||||
@ -797,7 +797,7 @@ export class HomePageService {
|
|||||||
return rows;
|
return rows;
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching users: ', err);
|
|
||||||
return { error: err.message }
|
return { error: err.message }
|
||||||
} finally { }
|
} finally { }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { Body, Controller, Get, Post, Put, Query } from '@nestjs/common';
|
import { Body, Controller, Get, Post, Put, Query } from '@nestjs/common';
|
||||||
import { ManageClientsService } from './manage-clients.service';
|
import { ManageClientsService } from './manage-clients.service';
|
||||||
import { CreateAdditionalClientContactsDTO, CreateAdditionalClientLocationsDTO, CreateClientDataDTO, GetPreparerByClientidDTO, GetPreparersDTO, UpdateClientContactsDTO, UpdateClientDTO, UpdateClientLocationsDTO } from './manage-clients.dto';
|
import { CreateAdditionalClientContactsDTO, CreateAdditionalClientLocationsDTO, CreateClientDataDTO, GetPreparerByClientidContactsByClientidLocByClientidDTO, GetPreparersDTO, UpdateClientContactsDTO, UpdateClientDTO, UpdateClientLocationsDTO } from './manage-clients.dto';
|
||||||
import { ApiTags } from '@nestjs/swagger';
|
import { ApiTags } from '@nestjs/swagger';
|
||||||
|
|
||||||
@Controller('oracle')
|
@Controller('oracle')
|
||||||
@ -52,15 +52,19 @@ export class ManageClientsController {
|
|||||||
|
|
||||||
@ApiTags('Manage Clients - Oracle')
|
@ApiTags('Manage Clients - Oracle')
|
||||||
@Get('GetPreparerByClientid')
|
@Get('GetPreparerByClientid')
|
||||||
GetPreparerByClientid(@Query() body:GetPreparerByClientidDTO){
|
GetPreparerByClientid(@Query() body:GetPreparerByClientidContactsByClientidLocByClientidDTO){
|
||||||
return this.manageClientsService.GetPreparerByClientid(body);
|
return this.manageClientsService.GetPreparerByClientid(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
GetPreparerContactsByClientid(){
|
@ApiTags('Manage Clients - Oracle')
|
||||||
|
@Get('GetPreparerContactsByClientid')
|
||||||
|
GetPreparerContactsByClientid(@Query() body:GetPreparerByClientidContactsByClientidLocByClientidDTO){
|
||||||
|
return body;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetPreparerLocByClientid(){
|
@ApiTags('Manage Clients - Oracle')
|
||||||
|
@Get('GetPreparerLocByClientid')
|
||||||
|
GetPreparerLocByClientid(@Query() body:GetPreparerByClientidContactsByClientidLocByClientidDTO){
|
||||||
|
return body;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -468,7 +468,7 @@ export class CreateAdditionalClientLocationsDTO {
|
|||||||
p_userid: string;
|
p_userid: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetPreparerByClientidDTO {
|
export class GetPreparerByClientidContactsByClientidLocByClientidDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Transform(({ value }) => Number(value))
|
@Transform(({ value }) => Number(value))
|
||||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { OracleDBService } from 'src/db/db.service';
|
import { OracleDBService } from 'src/db/db.service';
|
||||||
import { CreateAdditionalClientContactsDTO, CreateAdditionalClientLocationsDTO, CreateClientDataDTO, GetPreparerByClientidDTO, GetPreparersDTO, p_clientlocaddresstableDTO, UpdateClientContactsDTO, UpdateClientDTO, UpdateClientLocationsDTO } from './manage-clients.dto';
|
import { CreateAdditionalClientContactsDTO, CreateAdditionalClientLocationsDTO, CreateClientDataDTO, GetPreparerByClientidContactsByClientidLocByClientidDTO, GetPreparersDTO, p_clientlocaddresstableDTO, UpdateClientContactsDTO, UpdateClientDTO, UpdateClientLocationsDTO } from './manage-clients.dto';
|
||||||
import { p_contactstableDTO } from '../manage-holders/manage-holders.dto';
|
import { p_contactstableDTO } from '../manage-holders/manage-holders.dto';
|
||||||
import * as oracledb from 'oracledb'
|
import * as oracledb from 'oracledb'
|
||||||
|
|
||||||
@ -268,7 +268,7 @@ export class ManageClientsService {
|
|||||||
|
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching users: ', err);
|
|
||||||
return { error: err.message }
|
return { error: err.message }
|
||||||
} finally { }
|
} finally { }
|
||||||
|
|
||||||
@ -405,7 +405,7 @@ export class ManageClientsService {
|
|||||||
return { p_cursor: p_cursor_rows };
|
return { p_cursor: p_cursor_rows };
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching users: ', err);
|
|
||||||
return { error: err.message }
|
return { error: err.message }
|
||||||
} finally { }
|
} finally { }
|
||||||
}
|
}
|
||||||
@ -541,7 +541,7 @@ export class ManageClientsService {
|
|||||||
return { P_cursor: P_cursor_rows };
|
return { P_cursor: P_cursor_rows };
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching users: ', err);
|
|
||||||
return { error: err.message }
|
return { error: err.message }
|
||||||
} finally { }
|
} finally { }
|
||||||
|
|
||||||
@ -672,7 +672,7 @@ export class ManageClientsService {
|
|||||||
return { p_cursor: p_cursor_rows };
|
return { p_cursor: p_cursor_rows };
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching users: ', err);
|
|
||||||
return { error: err.message }
|
return { error: err.message }
|
||||||
} finally { }
|
} finally { }
|
||||||
}
|
}
|
||||||
@ -806,7 +806,7 @@ export class ManageClientsService {
|
|||||||
|
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching users: ', err);
|
|
||||||
return { error: err.message }
|
return { error: err.message }
|
||||||
} finally { }
|
} finally { }
|
||||||
}
|
}
|
||||||
@ -935,7 +935,7 @@ export class ManageClientsService {
|
|||||||
|
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching users: ', err);
|
|
||||||
return { error: err.message }
|
return { error: err.message }
|
||||||
} finally { }
|
} finally { }
|
||||||
}
|
}
|
||||||
@ -1051,12 +1051,12 @@ export class ManageClientsService {
|
|||||||
return { p_maincursor: p_maincursor_rows, p_contactscursor: p_contactscursor_rows, p_locationcursor: p_locationcursor_rows };
|
return { p_maincursor: p_maincursor_rows, p_contactscursor: p_contactscursor_rows, p_locationcursor: p_locationcursor_rows };
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching users: ', err);
|
|
||||||
return { error: err.message }
|
return { error: err.message }
|
||||||
} finally { }
|
} finally { }
|
||||||
}
|
}
|
||||||
|
|
||||||
GetPreparerByClientid = async (body: GetPreparerByClientidDTO) => {
|
GetPreparerByClientid = async (body: GetPreparerByClientidContactsByClientidLocByClientidDTO) => {
|
||||||
|
|
||||||
let connection;
|
let connection;
|
||||||
let p_cursor_rows = [];
|
let p_cursor_rows = [];
|
||||||
@ -1110,17 +1110,125 @@ export class ManageClientsService {
|
|||||||
return { p_cursor: p_cursor_rows };
|
return { p_cursor: p_cursor_rows };
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching users: ', err);
|
|
||||||
return { error: err.message }
|
return { error: err.message }
|
||||||
} finally { }
|
} finally { }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GetPreparerContactsByClientid = async () => {
|
GetPreparerContactsByClientid = async (body: GetPreparerByClientidContactsByClientidLocByClientidDTO) => {
|
||||||
|
let connection;
|
||||||
|
let p_cursor_rows = [];
|
||||||
|
|
||||||
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection()
|
||||||
|
if (!connection) {
|
||||||
|
throw new Error('No DB Connected')
|
||||||
}
|
}
|
||||||
|
|
||||||
GetPreparerLocByClientid = async () => {
|
const result = await connection.execute(
|
||||||
|
`BEGIN
|
||||||
|
MANAGEPREPARER_PKG.GetPreparerContactsByClientid(
|
||||||
|
:p_spid,
|
||||||
|
:p_clientid,
|
||||||
|
:p_cursor
|
||||||
|
);
|
||||||
|
END;`,
|
||||||
|
{
|
||||||
|
p_spid: {
|
||||||
|
val: body.p_spid,
|
||||||
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
|
},
|
||||||
|
p_clientid: {
|
||||||
|
val: body.p_clientid,
|
||||||
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
|
},
|
||||||
|
p_cursor: {
|
||||||
|
type: oracledb.CURSOR,
|
||||||
|
dir: oracledb.BIND_OUT
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
outFormat: oracledb.OUT_FORMAT_OBJECT
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (result.outBinds && result.outBinds.p_cursor) {
|
||||||
|
const cursor = result.outBinds.p_cursor;
|
||||||
|
let rowsBatch;
|
||||||
|
|
||||||
|
do {
|
||||||
|
rowsBatch = await cursor.getRows(100);
|
||||||
|
p_cursor_rows = p_cursor_rows.concat(rowsBatch);
|
||||||
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
|
await cursor.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
return { p_cursor: p_cursor_rows };
|
||||||
|
|
||||||
|
} catch (err) {
|
||||||
|
|
||||||
|
return { error: err.message }
|
||||||
|
} finally { }
|
||||||
|
}
|
||||||
|
|
||||||
|
GetPreparerLocByClientid = async (body: GetPreparerByClientidContactsByClientidLocByClientidDTO) => {
|
||||||
|
let connection;
|
||||||
|
let p_cursor_rows = [];
|
||||||
|
|
||||||
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection()
|
||||||
|
if (!connection) {
|
||||||
|
throw new Error('No DB Connected')
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = await connection.execute(
|
||||||
|
`BEGIN
|
||||||
|
MANAGEPREPARER_PKG.GetPreparerLocByClientid(
|
||||||
|
:p_spid,
|
||||||
|
:p_clientid,
|
||||||
|
:p_cursor
|
||||||
|
);
|
||||||
|
END;`,
|
||||||
|
{
|
||||||
|
p_spid: {
|
||||||
|
val: body.p_spid,
|
||||||
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
|
},
|
||||||
|
p_clientid: {
|
||||||
|
val: body.p_clientid,
|
||||||
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
|
},
|
||||||
|
p_cursor: {
|
||||||
|
type: oracledb.CURSOR,
|
||||||
|
dir: oracledb.BIND_OUT
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
outFormat: oracledb.OUT_FORMAT_OBJECT
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (result.outBinds && result.outBinds.p_cursor) {
|
||||||
|
const cursor = result.outBinds.p_cursor;
|
||||||
|
let rowsBatch;
|
||||||
|
|
||||||
|
do {
|
||||||
|
rowsBatch = await cursor.getRows(100);
|
||||||
|
p_cursor_rows = p_cursor_rows.concat(rowsBatch);
|
||||||
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
|
await cursor.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
return { p_cursor: p_cursor_rows };
|
||||||
|
|
||||||
|
} catch (err) {
|
||||||
|
|
||||||
|
return { error: err.message }
|
||||||
|
} finally { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,152 @@
|
|||||||
import { Controller } from '@nestjs/common';
|
import { Body, Controller, Get, Param, ParseIntPipe, Patch, Post, Query } from '@nestjs/common';
|
||||||
|
import { ManageFeeService } from './manage-fee.service';
|
||||||
|
import { ApiTags } from '@nestjs/swagger';
|
||||||
|
import {
|
||||||
|
CreateBasicFeeDTO,
|
||||||
|
CreateBondRateDTO,
|
||||||
|
CreateCargoRateDTO,
|
||||||
|
CreateCfFeeDTO,
|
||||||
|
CreateCsFeeDTO,
|
||||||
|
CreateEfFeeDTO,
|
||||||
|
CreateFeeCommDTO,
|
||||||
|
GetFeeGeneralDTO,
|
||||||
|
UpdateBasicFeeDTO,
|
||||||
|
UpdateBondRateDTO,
|
||||||
|
UpdateCargoRateDTO,
|
||||||
|
UpdateCfFeeDTO,
|
||||||
|
UpdateCsFeeDTO,
|
||||||
|
UpdateEfFeeDTO,
|
||||||
|
UpdateFeeCommBodyDTO
|
||||||
|
} from './manage-fee.dto';
|
||||||
|
|
||||||
@Controller('manage-fee')
|
@Controller('manage-fee')
|
||||||
export class ManageFeeController {}
|
export class ManageFeeController {
|
||||||
|
constructor(private readonly manageFeeService: ManageFeeService) { }
|
||||||
|
|
||||||
|
|
||||||
|
@ApiTags('Manage Fee - Oracle')
|
||||||
|
@Get('/GetBasicFeeRates')
|
||||||
|
GetBasicFeeRates(@Query() body: GetFeeGeneralDTO) {
|
||||||
|
return this.manageFeeService.GETBASICFEERATES(body)
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiTags('Manage Fee - Oracle')
|
||||||
|
@Get('/GetBondRates')
|
||||||
|
GetBondRates(@Query() body: GetFeeGeneralDTO) {
|
||||||
|
return this.manageFeeService.GETBONDRATES(body)
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiTags('Manage Fee - Oracle')
|
||||||
|
@Get('/GetCargoRates')
|
||||||
|
GetCargoRates(@Query() body: GetFeeGeneralDTO) {
|
||||||
|
return this.manageFeeService.GETCARGORATES(body)
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiTags('Manage Fee - Oracle')
|
||||||
|
@Get('/GetCfFeeRates')
|
||||||
|
GetCfFeeRates(@Query() body: GetFeeGeneralDTO) {
|
||||||
|
return this.manageFeeService.GETCFFEERATES(body)
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiTags('Manage Fee - Oracle')
|
||||||
|
@Get('/GetCsFeeRates')
|
||||||
|
GetCsFeeRates(@Query() body: GetFeeGeneralDTO) {
|
||||||
|
return this.manageFeeService.GETCSFEERATES(body)
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiTags('Manage Fee - Oracle')
|
||||||
|
@Get('/GetEfFeeRates')
|
||||||
|
GetEfFeeRates(@Query() body: GetFeeGeneralDTO) {
|
||||||
|
return this.manageFeeService.GETEFFEERATES(body)
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiTags('Manage Fee - Oracle')
|
||||||
|
@Get('/GetFeeComm')
|
||||||
|
GetFeeComm(@Query() body: GetFeeGeneralDTO) {
|
||||||
|
return this.manageFeeService.GETFEECOMM(body)
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiTags('Manage Fee - Oracle')
|
||||||
|
@Post('/CreateBasicFee')
|
||||||
|
CreateBasicFee(@Body() body: CreateBasicFeeDTO) {
|
||||||
|
return this.manageFeeService.CREATEBASICFEE(body)
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiTags('Manage Fee - Oracle')
|
||||||
|
@Post('/CreateBondRate')
|
||||||
|
CreateBondRate(@Body() body: CreateBondRateDTO) {
|
||||||
|
return this.manageFeeService.CREATEBONDRATE(body)
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiTags('Manage Fee - Oracle')
|
||||||
|
@Post('/CreateCargoRate')
|
||||||
|
CreateCargoRate(@Body() body: CreateCargoRateDTO) {
|
||||||
|
return this.manageFeeService.CREATECARGORATE(body)
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiTags('Manage Fee - Oracle')
|
||||||
|
@Post('/CreateCfFee')
|
||||||
|
CreateCfFee(@Body() body: CreateCfFeeDTO) {
|
||||||
|
return this.manageFeeService.CREATECFFEE(body)
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiTags('Manage Fee - Oracle')
|
||||||
|
@Post('/CreateCsFee')
|
||||||
|
CreateCsFee(@Body() body: CreateCsFeeDTO) {
|
||||||
|
return this.manageFeeService.CREATECSFEE(body)
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiTags('Manage Fee - Oracle')
|
||||||
|
@Post('/CreateEfFee')
|
||||||
|
CreateEeFee(@Body() body: CreateEfFeeDTO) {
|
||||||
|
return this.manageFeeService.CREATEEFFEE(body)
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiTags('Manage Fee - Oracle')
|
||||||
|
@Post('/CreateFeeComm')
|
||||||
|
CreateFeeComm(@Body() body: CreateFeeCommDTO) {
|
||||||
|
return this.manageFeeService.CREATEFEECOMM(body)
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiTags('Manage Fee - Oracle')
|
||||||
|
@Patch('/UpdateBasicFee')
|
||||||
|
UpdateBasicFee(@Body() body: UpdateBasicFeeDTO) {
|
||||||
|
return this.manageFeeService.UPDATEBASICFEE(body)
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiTags('Manage Fee - Oracle')
|
||||||
|
@Patch('/UpdateBondRate')
|
||||||
|
UpdateBondRate(@Body() body: UpdateBondRateDTO) {
|
||||||
|
return this.manageFeeService.UPDATEBONDRATE(body)
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiTags('Manage Fee - Oracle')
|
||||||
|
@Patch('/UpdateCargoRate')
|
||||||
|
UpdateCargoRate(@Body() body: UpdateCargoRateDTO) {
|
||||||
|
return this.manageFeeService.UPDATECARGORATE(body)
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiTags('Manage Fee - Oracle')
|
||||||
|
@Patch('/UpdateCfFee')
|
||||||
|
UpdateCfFee(@Body() body: UpdateCfFeeDTO) {
|
||||||
|
return this.manageFeeService.UPDATECFFEE(body)
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiTags('Manage Fee - Oracle')
|
||||||
|
@Patch('/UpdateCsFee')
|
||||||
|
UpdateCsFee(@Body() body: UpdateCsFeeDTO) {
|
||||||
|
return this.manageFeeService.UPDATECSFEE(body)
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiTags('Manage Fee - Oracle')
|
||||||
|
@Patch('/UpdateEfFee')
|
||||||
|
UpdateEfFee(@Body() body: UpdateEfFeeDTO) {
|
||||||
|
return this.manageFeeService.UPDATEEFFEE(body)
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiTags('Manage Fee - Oracle')
|
||||||
|
@Patch('/UpdateFeeComm')
|
||||||
|
UpdateFeeComm(@Body() body: UpdateFeeCommBodyDTO) {
|
||||||
|
return this.manageFeeService.UPDATEFEECOMM(body)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
360
src/oracle/manage-fee/manage-fee.dto.ts
Normal file
360
src/oracle/manage-fee/manage-fee.dto.ts
Normal file
@ -0,0 +1,360 @@
|
|||||||
|
import { ApiProperty } from "@nestjs/swagger";
|
||||||
|
import { Transform } from "class-transformer";
|
||||||
|
import { IsDefined, IsInt, IsNumber, IsString, Min } from "class-validator";
|
||||||
|
|
||||||
|
export class GetFeeGeneralDTO {
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@Transform(({ value }) => Number(value))
|
||||||
|
@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" })
|
||||||
|
@IsDefined({ message: "Property P_SPID is required" })
|
||||||
|
P_SPID: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString({ message: "Property P_ACTIVE_INACTIVE must be a string" })
|
||||||
|
@IsDefined({ message: "Property P_ACTIVE_INACTIVE is required" })
|
||||||
|
P_ACTIVE_INACTIVE: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class CreateBasicFeeDTO {
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber()
|
||||||
|
P_SPID: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber()
|
||||||
|
P_STARTCARNETVALUE: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber()
|
||||||
|
P_ENDCARNETVALUE: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_EFFDATE: string;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber()
|
||||||
|
P_FEES: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_USERID: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class CreateBondRateDTO {
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber()
|
||||||
|
P_SPID: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_HOLDERTYPE: string;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_USCIBMEMBERFLAG: string;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_SPCLCOMMODITY: string;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_SPCLCOUNTRY: string;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_EFFDATE: string;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber()
|
||||||
|
P_RATE: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_USERID: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class CreateCargoRateDTO {
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber()
|
||||||
|
P_SPID: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_CARNETTYPE: string;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber()
|
||||||
|
P_STARTSETS: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber()
|
||||||
|
P_ENDSETS: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_EFFDATE: string;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber()
|
||||||
|
P_RATE: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_USERID: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class CreateCfFeeDTO {
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber()
|
||||||
|
P_SPID: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber()
|
||||||
|
P_STARTSETS: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber()
|
||||||
|
P_ENDSETS: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_EFFDATE: string;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_CUSTOMERTYPE: string;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_CARNETTYPE: string;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber()
|
||||||
|
P_RATE: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_USERID: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class CreateCsFeeDTO {
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber()
|
||||||
|
P_SPID: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_CUSTOMERTYPE: string;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_CARNETTYPE: string;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_EFFDATE: string;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber()
|
||||||
|
P_RATE: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_USERID: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class CreateEfFeeDTO {
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber()
|
||||||
|
P_SPID: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_CUSTOMERTYPE: string;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_DELIVERYTYPE: string;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber()
|
||||||
|
P_STARTTIME: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber()
|
||||||
|
P_ENDTIME: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_TIMEZONE: string;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_EFFDATE: string;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber()
|
||||||
|
P_FEES: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_USERID: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class CreateFeeCommDTO {
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber()
|
||||||
|
P_SPID: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber()
|
||||||
|
P_PARAMID: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber()
|
||||||
|
P_COMMRATE: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_EFFDATE: string;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_USERID: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class UpdateBasicFeeDTO {
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber()
|
||||||
|
P_BASICFEESETUPID: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber()
|
||||||
|
P_FEES: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_EFFDATE: string;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_USERID: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class UpdateBondRateDTO {
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber()
|
||||||
|
P_BONDRATESETUPID: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber()
|
||||||
|
P_RATE: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_EFFDATE: string;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_USERID: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class UpdateCargoRateDTO {
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber()
|
||||||
|
P_CARGORATESETUPID: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber()
|
||||||
|
P_RATE: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_EFFDATE: string;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_USERID: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class UpdateCfFeeDTO {
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber()
|
||||||
|
P_CFFEESETUPID: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber()
|
||||||
|
P_RATE: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_EFFDATE: string;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_USERID: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class UpdateCsFeeDTO {
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber()
|
||||||
|
P_CSFEESETUPID: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber()
|
||||||
|
P_RATE: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_EFFDATE: string;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_USERID: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class UpdateEfFeeDTO {
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber()
|
||||||
|
P_EFFEESETUPID: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber()
|
||||||
|
P_FEES: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_EFFDATE: string;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_USERID: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class UpdateFeeCommDTO {
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber()
|
||||||
|
P_FEECOMMID: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber()
|
||||||
|
P_RATE: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_EFFDATE: string;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_USERID: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class UpdateFeeCommBodyDTO {
|
||||||
|
@ApiProperty({ type: UpdateFeeCommDTO, required: true }) // Correctly reference UpdateFeeCommDTO
|
||||||
|
p_fees_comm: UpdateFeeCommDTO; // No need for @IsObject()
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,6 @@ import { Body, Controller, Get, Param, ParseIntPipe, Patch, Post, Put, UsePipes,
|
|||||||
import { ApiTags } from '@nestjs/swagger';
|
import { ApiTags } from '@nestjs/swagger';
|
||||||
import { CreateHoldersDTO, GetHolderContactActivateOrInactivateDTO, GetHolderOrContactDTO, UpdateHolderContactDTO, UpdateHolderDTO } from './manage-holders.dto';
|
import { CreateHoldersDTO, GetHolderContactActivateOrInactivateDTO, GetHolderOrContactDTO, UpdateHolderContactDTO, UpdateHolderDTO } from './manage-holders.dto';
|
||||||
import { ManageHoldersService } from './manage-holders.service';
|
import { ManageHoldersService } from './manage-holders.service';
|
||||||
import { CustomParseIntPipe } from 'src/custom-pipe/custom-parseInt-pipe.service';
|
|
||||||
|
|
||||||
@Controller('oracle')
|
@Controller('oracle')
|
||||||
export class ManageHoldersController {
|
export class ManageHoldersController {
|
||||||
|
|||||||
@ -2,7 +2,6 @@ import { Module } from '@nestjs/common';
|
|||||||
import { ManageHoldersService } from './manage-holders.service';
|
import { ManageHoldersService } from './manage-holders.service';
|
||||||
import { ManageHoldersController } from './manage-holders.controller';
|
import { ManageHoldersController } from './manage-holders.controller';
|
||||||
import { DbModule } from 'src/db/db.module';
|
import { DbModule } from 'src/db/db.module';
|
||||||
import { CustomPipeModule } from 'src/custom-pipe/custom-pipe.module';
|
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports:[DbModule],
|
imports:[DbModule],
|
||||||
|
|||||||
@ -238,7 +238,7 @@ export class ManageHoldersService {
|
|||||||
// return fres
|
// return fres
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching users: ', err);
|
|
||||||
return { error: err.message }
|
return { error: err.message }
|
||||||
} finally { }
|
} finally { }
|
||||||
|
|
||||||
@ -413,7 +413,7 @@ export class ManageHoldersService {
|
|||||||
// return fres
|
// return fres
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching users: ', err);
|
|
||||||
return { error: err.message }
|
return { error: err.message }
|
||||||
} finally { }
|
} finally { }
|
||||||
|
|
||||||
@ -472,7 +472,7 @@ export class ManageHoldersService {
|
|||||||
return { p_cursor: p_cursor_rows };
|
return { p_cursor: p_cursor_rows };
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching users: ', err);
|
|
||||||
return { error: err.message }
|
return { error: err.message }
|
||||||
} finally { }
|
} finally { }
|
||||||
}
|
}
|
||||||
@ -611,7 +611,7 @@ export class ManageHoldersService {
|
|||||||
// return fres
|
// return fres
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching users: ', err);
|
|
||||||
return { error: err.message }
|
return { error: err.message }
|
||||||
} finally { }
|
} finally { }
|
||||||
}
|
}
|
||||||
@ -668,7 +668,7 @@ export class ManageHoldersService {
|
|||||||
return { p_cursor: p_cursor_rows };
|
return { p_cursor: p_cursor_rows };
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching users: ', err);
|
|
||||||
return { error: err.message }
|
return { error: err.message }
|
||||||
} finally { }
|
} finally { }
|
||||||
}
|
}
|
||||||
@ -725,7 +725,7 @@ export class ManageHoldersService {
|
|||||||
return { p_cursor: p_cursor_rows };
|
return { p_cursor: p_cursor_rows };
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching users: ', err);
|
|
||||||
return { error: err.message }
|
return { error: err.message }
|
||||||
} finally { }
|
} finally { }
|
||||||
}
|
}
|
||||||
@ -782,7 +782,7 @@ export class ManageHoldersService {
|
|||||||
return { p_cursor: p_cursor_rows };
|
return { p_cursor: p_cursor_rows };
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching users: ', err);
|
|
||||||
return { error: err.message }
|
return { error: err.message }
|
||||||
} finally { }
|
} finally { }
|
||||||
}
|
}
|
||||||
@ -839,7 +839,7 @@ export class ManageHoldersService {
|
|||||||
return { p_cursor: p_cursor_rows };
|
return { p_cursor: p_cursor_rows };
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching users: ', err);
|
|
||||||
return { error: err.message }
|
return { error: err.message }
|
||||||
} finally { }
|
} finally { }
|
||||||
}
|
}
|
||||||
@ -896,7 +896,7 @@ export class ManageHoldersService {
|
|||||||
return { p_cursor: p_cursor_rows };
|
return { p_cursor: p_cursor_rows };
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching users: ', err);
|
|
||||||
return { error: err.message }
|
return { error: err.message }
|
||||||
} finally { }
|
} finally { }
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -1,314 +0,0 @@
|
|||||||
import { Body, Controller, Get, Param, ParseIntPipe, Patch, Post, Put, Query, UsePipes } from '@nestjs/common';
|
|
||||||
import { OracleService } from './oracle.service';
|
|
||||||
import { ActivateOrInactivateParamRecordDTO, CreateBasicFeeDTO, CreateBondRateDTO, CreateCargoRateDTO, CreateCarnetSequenceDTO, CreateCfFeeDTO, CreateCsFeeDTO, CreateEfFeeDTO, CreateFeeCommDTO, CreateParamRecordDTO, CreateTableRecordDTO, InsertSPContactsDTO, TestDTO, UpdateBasicFeeDTO, UpdateBondRateDTO, UpdateCargoRateDTO, UpdateCfFeeDTO, UpdateCsFeeDTO, UpdateEfFeeDTO, UpdateFeeCommBodyDTO, UpdateFeeCommDTO, UpdateParamRecordDTO, UpdateSPContactsDTO } from './oracle.dto';
|
|
||||||
import { ParamTableService } from './paramTable.service';
|
|
||||||
import { ManageFeeService } from './manageFee.service';
|
|
||||||
import { ApiQuery, ApiTags } from '@nestjs/swagger';
|
|
||||||
|
|
||||||
@Controller('oracle')
|
|
||||||
export class OracleController {
|
|
||||||
constructor(
|
|
||||||
private readonly oarcleService: OracleService,
|
|
||||||
private readonly paramTableService: ParamTableService,
|
|
||||||
private readonly manageFeeService: ManageFeeService,
|
|
||||||
) { }
|
|
||||||
|
|
||||||
// @ApiTags('HomePage - Oracle')
|
|
||||||
// @Post('/test')
|
|
||||||
// test(@Body() body:TestDTO) {
|
|
||||||
|
|
||||||
// return body;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Service Provider [ SP ]
|
|
||||||
|
|
||||||
// @ApiTags('SP - Oracle')
|
|
||||||
// @Post('/InsertNewServiceProvider')
|
|
||||||
// insertNewServiceProvider(@Body() body: InsertNewServiceProviderDTO) {
|
|
||||||
// return this.oarcleService.insertNewServiceProvider(
|
|
||||||
// body.p_name,
|
|
||||||
// body.p_lookupcode,
|
|
||||||
// body.p_address1,
|
|
||||||
// body.p_address2,
|
|
||||||
// body.p_city,
|
|
||||||
// body.p_state,
|
|
||||||
// body.p_zip,
|
|
||||||
// body.p_country,
|
|
||||||
// body.p_issuingregion,
|
|
||||||
// body.p_replacementregion,
|
|
||||||
// body.p_bondsurety,
|
|
||||||
// body.p_cargopolicyno,
|
|
||||||
// body.p_cargosurety,
|
|
||||||
// body.p_user_id,
|
|
||||||
// body.P_NOTES,
|
|
||||||
// body.P_FILEIDS
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
|
|
||||||
// @ApiTags('SP - Oracle')
|
|
||||||
// @Put('/UpdateServiceProvider')
|
|
||||||
// updateServiceProider(@Body() body: UpdateServiceProviderDTO) {
|
|
||||||
// return this.oarcleService.updateServiceProvider(
|
|
||||||
// body.p_spid,
|
|
||||||
// body.p_name,
|
|
||||||
// body.p_lookupcode,
|
|
||||||
// body.p_address1,
|
|
||||||
// body.p_address2,
|
|
||||||
// body.p_city,
|
|
||||||
// body.p_state,
|
|
||||||
// body.p_zip,
|
|
||||||
// body.p_country,
|
|
||||||
// body.p_issuingregion,
|
|
||||||
// body.p_replacementregion,
|
|
||||||
// body.p_bondsurety,
|
|
||||||
// body.p_cargopolicyno,
|
|
||||||
// body.p_cargosurety,
|
|
||||||
// body.p_user_id,
|
|
||||||
// body.P_NOTES,
|
|
||||||
// body.P_FILEIDS
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
|
|
||||||
// @ApiTags('SP - Oracle')
|
|
||||||
// @Get('/GetAllServiceproviders')
|
|
||||||
// getAllServiceproviders() {
|
|
||||||
// return this.oarcleService.getAllServiceproviders();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// @ApiTags('SP - Oracle')
|
|
||||||
// @Get('/GetSelectedServiceprovider/:id')
|
|
||||||
// getSelectedServiceprovider(@Param('id', ParseIntPipe) id: number) {
|
|
||||||
// return this.oarcleService.getServiceproviderByID(id);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// SPContacts
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Carnet Sequence
|
|
||||||
|
|
||||||
@ApiTags('Carnet Sequence - Oracle')
|
|
||||||
@Post('/CreateCarnetSequence/')
|
|
||||||
createCarnetSequence(@Body() body: CreateCarnetSequenceDTO) {
|
|
||||||
return this.oarcleService.createCarnetSequence(
|
|
||||||
body.p_spid,
|
|
||||||
body.p_regionid,
|
|
||||||
body.p_startnumber,
|
|
||||||
body.p_endnumber,
|
|
||||||
body.p_carnettype
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiTags('Carnet Sequence - Oracle')
|
|
||||||
@Get('/GetCarnetSequence/:id')
|
|
||||||
getCarnetSequence(@Param('id', ParseIntPipe) id: number) {
|
|
||||||
return this.oarcleService.getCarnetSequence(id)
|
|
||||||
}
|
|
||||||
|
|
||||||
// param table
|
|
||||||
|
|
||||||
@ApiTags('Param Table - Oracle')
|
|
||||||
@Get('/GetParamValues')
|
|
||||||
@UsePipes()
|
|
||||||
@ApiQuery({ name: 'id', required: false, type: Number, description: 'The ID of the parameter' })
|
|
||||||
@ApiQuery({ name: 'type', required: false, type: String, description: 'The type of the parameter' })
|
|
||||||
getParamValues(
|
|
||||||
@Query('id') id: string,
|
|
||||||
@Query('type') type: string
|
|
||||||
) {
|
|
||||||
return this.paramTableService.GETPARAMVALUES(id ? Number(id) : undefined, type);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiTags('Param Table - Oracle')
|
|
||||||
@Post('/CreateTableRecord')
|
|
||||||
createTableRecord(@Body() body: CreateTableRecordDTO) {
|
|
||||||
return this.paramTableService.CREATETABLERECORD(body.P_USERID, body.P_TABLEFULLDESC)
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiTags('Param Table - Oracle')
|
|
||||||
@Post('/CreateParamRecord')
|
|
||||||
createParamRecord(@Body() body: CreateParamRecordDTO) {
|
|
||||||
return this.paramTableService.CREATEPARAMRECORD(
|
|
||||||
body.P_PARAMTYPE,
|
|
||||||
body.P_PARAMDESC,
|
|
||||||
body.P_PARAMVALUE,
|
|
||||||
body.P_SORTSEQ,
|
|
||||||
body.P_USERID,
|
|
||||||
body.P_SPID,
|
|
||||||
body.P_ADDLPARAMVALUE1,
|
|
||||||
body.P_ADDLPARAMVALUE2,
|
|
||||||
body.P_ADDLPARAMVALUE3,
|
|
||||||
body.P_ADDLPARAMVALUE4,
|
|
||||||
body.P_ADDLPARAMVALUE5,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiTags('Param Table - Oracle')
|
|
||||||
@Patch('/UpdateParamRecord')
|
|
||||||
UpdateParamRecord(@Body() body: UpdateParamRecordDTO) {
|
|
||||||
return this.paramTableService.UPDATEPARAMRECORD(body)
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiTags('Param Table - Oracle')
|
|
||||||
@Put('/InActivateParamRecord')
|
|
||||||
inActivateParamRecord(@Body() body: ActivateOrInactivateParamRecordDTO) {
|
|
||||||
return this.paramTableService.INACTIVATEPARAMRECORD(body)
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiTags('Param Table - Oracle')
|
|
||||||
@Put('/ReActivateParamRecord')
|
|
||||||
reActivateParamRecord(@Body() body: ActivateOrInactivateParamRecordDTO) {
|
|
||||||
return this.paramTableService.REACTIVATEPARAMRECORD(body)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ManageFee
|
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
|
||||||
@Post('/CreateBasicFee')
|
|
||||||
CreateBasicFee(@Body() body: CreateBasicFeeDTO) {
|
|
||||||
return this.manageFeeService.CREATEBASICFEE(body)
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
|
||||||
@Post('/CreateBondRate')
|
|
||||||
CreateBondRate(@Body() body: CreateBondRateDTO) {
|
|
||||||
return this.manageFeeService.CREATEBONDRATE(body)
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
|
||||||
@Post('/CreateCargoRate')
|
|
||||||
CreateCargoRate(@Body() body: CreateCargoRateDTO) {
|
|
||||||
return this.manageFeeService.CREATECARGORATE(body)
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
|
||||||
@Post('/CreateCfFee')
|
|
||||||
CreateCfFee(@Body() body: CreateCfFeeDTO) {
|
|
||||||
return this.manageFeeService.CREATECFFEE(body)
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
|
||||||
@Post('/CreateCsFee')
|
|
||||||
CreateCsFee(@Body() body: CreateCsFeeDTO) {
|
|
||||||
return this.manageFeeService.CREATECSFEE(body)
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
|
||||||
@Post('/CreateEfFee')
|
|
||||||
CreateEeFee(@Body() body: CreateEfFeeDTO) {
|
|
||||||
return this.manageFeeService.CREATEEFFEE(body)
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
|
||||||
@Post('/CreateFeeComm')
|
|
||||||
CreateFeeComm(@Body() body: CreateFeeCommDTO) {
|
|
||||||
return this.manageFeeService.CREATEFEECOMM(body)
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
|
||||||
@Patch('/UpdateBasicFee')
|
|
||||||
UpdateBasicFee(@Body() body: UpdateBasicFeeDTO) {
|
|
||||||
return this.manageFeeService.UPDATEBASICFEE(body)
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
|
||||||
@Patch('/UpdateBondRate')
|
|
||||||
UpdateBondRate(@Body() body: UpdateBondRateDTO) {
|
|
||||||
return this.manageFeeService.UPDATEBONDRATE(body)
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
|
||||||
@Patch('/UpdateCargoRate')
|
|
||||||
UpdateCargoRate(@Body() body: UpdateCargoRateDTO) {
|
|
||||||
return this.manageFeeService.UPDATECARGORATE(body)
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
|
||||||
@Patch('/UpdateCfFee')
|
|
||||||
UpdateCfFee(@Body() body: UpdateCfFeeDTO) {
|
|
||||||
return this.manageFeeService.UPDATECFFEE(body)
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
|
||||||
@Patch('/UpdateCsFee')
|
|
||||||
UpdateCsFee(@Body() body: UpdateCsFeeDTO) {
|
|
||||||
return this.manageFeeService.UPDATECSFEE(body)
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
|
||||||
@Patch('/UpdateEfFee')
|
|
||||||
UpdateEfFee(@Body() body: UpdateEfFeeDTO) {
|
|
||||||
return this.manageFeeService.UPDATEEFFEE(body)
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
|
||||||
@Patch('/UpdateFeeComm')
|
|
||||||
UpdateFeeComm(@Body() body: UpdateFeeCommBodyDTO) {
|
|
||||||
return this.manageFeeService.UPDATEFEECOMM(body)
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
|
||||||
@Get('/GetBasicFeeRates/:P_SPID/:P_ACTIVE_INACTIVE')
|
|
||||||
GetBasicFeeRates(
|
|
||||||
@Param('P_SPID', ParseIntPipe) P_SPID: number,
|
|
||||||
@Param('P_ACTIVE_INACTIVE',) P_ACTIVE_INACTIVE: string
|
|
||||||
) {
|
|
||||||
return this.manageFeeService.GETBASICFEERATES(P_SPID, P_ACTIVE_INACTIVE)
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
|
||||||
@Get('/GetBondRates/:P_SPID/:P_ACTIVE_INACTIVE')
|
|
||||||
GetBondRates(
|
|
||||||
@Param('P_SPID', ParseIntPipe) P_SPID: number,
|
|
||||||
@Param('P_ACTIVE_INACTIVE',) P_ACTIVE_INACTIVE: string
|
|
||||||
) {
|
|
||||||
return this.manageFeeService.GETBONDRATES(P_SPID, P_ACTIVE_INACTIVE)
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
|
||||||
@Get('/GetCargoRates/:P_SPID/:P_ACTIVE_INACTIVE')
|
|
||||||
GetCargoRates(
|
|
||||||
@Param('P_SPID', ParseIntPipe) P_SPID: number,
|
|
||||||
@Param('P_ACTIVE_INACTIVE',) P_ACTIVE_INACTIVE: string
|
|
||||||
) {
|
|
||||||
return this.manageFeeService.GETCARGORATES(P_SPID, P_ACTIVE_INACTIVE)
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
|
||||||
@Get('/GetCfFeeRates/:P_SPID/:P_ACTIVE_INACTIVE')
|
|
||||||
GetCfFeeRates(
|
|
||||||
@Param('P_SPID', ParseIntPipe) P_SPID: number,
|
|
||||||
@Param('P_ACTIVE_INACTIVE',) P_ACTIVE_INACTIVE: string
|
|
||||||
) {
|
|
||||||
return this.manageFeeService.GETCFFEERATES(P_SPID, P_ACTIVE_INACTIVE)
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
|
||||||
@Get('/GetCsFeeRates/:P_SPID/:P_ACTIVE_INACTIVE')
|
|
||||||
GetCsFeeRates(
|
|
||||||
@Param('P_SPID', ParseIntPipe) P_SPID: number,
|
|
||||||
@Param('P_ACTIVE_INACTIVE',) P_ACTIVE_INACTIVE: string
|
|
||||||
) {
|
|
||||||
return this.manageFeeService.GETCSFEERATES(P_SPID, P_ACTIVE_INACTIVE)
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
|
||||||
@Get('/GetEfFeeRates/:P_SPID/:P_ACTIVE_INACTIVE')
|
|
||||||
GetEfFeeRates(
|
|
||||||
@Param('P_SPID', ParseIntPipe) P_SPID: number,
|
|
||||||
@Param('P_ACTIVE_INACTIVE',) P_ACTIVE_INACTIVE: string
|
|
||||||
) {
|
|
||||||
return this.manageFeeService.GETEFFEERATES(P_SPID, P_ACTIVE_INACTIVE)
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
|
||||||
@Get('/GetFeeComm/:P_SPID/:P_ACTIVE_INACTIVE')
|
|
||||||
GetFeeComm(
|
|
||||||
@Param('P_SPID', ParseIntPipe) P_SPID: number,
|
|
||||||
@Param('P_ACTIVE_INACTIVE') P_ACTIVE_INACTIVE: string
|
|
||||||
) {
|
|
||||||
return this.manageFeeService.GETFEECOMM(P_SPID, P_ACTIVE_INACTIVE)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -3,586 +3,11 @@ import { Type } from 'class-transformer';
|
|||||||
import { IsArray, IsDefined, IsEmail, IsNumber, IsOptional, IsString, ValidateNested } from 'class-validator';
|
import { IsArray, IsDefined, IsEmail, IsNumber, IsOptional, IsString, ValidateNested } from 'class-validator';
|
||||||
|
|
||||||
|
|
||||||
// export class GetSelectedServiceProviderDTO {
|
|
||||||
// @IsNumber()
|
|
||||||
// p_spid: number;
|
|
||||||
// }
|
|
||||||
|
|
||||||
export class InsertSPContactsDTO {
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
p_spid: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
p_defcontactflag: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
p_firstname: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
p_lastname: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
|
||||||
@IsString()
|
|
||||||
P_MIDDLEINITIAL: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
p_title: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
p_phoneno: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
p_mobileno: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
p_faxno: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsEmail()
|
|
||||||
p_emailaddress: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
p_user_id: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class UpdateSPContactsDTO {
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
p_spcontactid: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
p_firstname: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
p_lastname: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
|
||||||
@IsString()
|
|
||||||
P_MIDDLEINITIAL: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
p_title: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
p_phoneno: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
p_mobileno: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
p_faxno: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsEmail()
|
|
||||||
p_emailaddress: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
p_user_id: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class CreateCarnetSequenceDTO {
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
p_spid: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
p_regionid: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
p_startnumber: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
p_endnumber: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
p_carnettype: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class CreateTableRecordDTO {
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_USERID: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_TABLEFULLDESC: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class CreateParamRecordDTO {
|
|
||||||
@ApiProperty({ required: false })
|
|
||||||
@IsOptional()
|
|
||||||
@IsNumber()
|
|
||||||
P_SPID?: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_PARAMTYPE: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_PARAMDESC: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_PARAMVALUE: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
|
||||||
@IsOptional()
|
|
||||||
@IsString()
|
|
||||||
P_ADDLPARAMVALUE1?: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
|
||||||
@IsOptional()
|
|
||||||
@IsString()
|
|
||||||
P_ADDLPARAMVALUE2?: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
|
||||||
@IsOptional()
|
|
||||||
@IsString()
|
|
||||||
P_ADDLPARAMVALUE3?: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
|
||||||
@IsOptional()
|
|
||||||
@IsString()
|
|
||||||
P_ADDLPARAMVALUE4?: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
|
||||||
@IsOptional()
|
|
||||||
@IsString()
|
|
||||||
P_ADDLPARAMVALUE5?: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
P_SORTSEQ: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_USERID: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export class UpdateParamRecordDTO {
|
|
||||||
@ApiProperty({ required: false })
|
|
||||||
@IsOptional()
|
|
||||||
@IsNumber()
|
|
||||||
P_SPID?: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
P_PARAMID: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_PARAMDESC: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
|
||||||
@IsOptional()
|
|
||||||
@IsString()
|
|
||||||
P_ADDLPARAMVALUE1?: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
|
||||||
@IsOptional()
|
|
||||||
@IsString()
|
|
||||||
P_ADDLPARAMVALUE2?: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
|
||||||
@IsOptional()
|
|
||||||
@IsString()
|
|
||||||
P_ADDLPARAMVALUE3?: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
|
||||||
@IsOptional()
|
|
||||||
@IsString()
|
|
||||||
P_ADDLPARAMVALUE4?: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
|
||||||
@IsOptional()
|
|
||||||
@IsString()
|
|
||||||
P_ADDLPARAMVALUE5?: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
P_SORTSEQ: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_USERID: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class CreateBasicFeeDTO {
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
P_SPID: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
P_STARTCARNETVALUE: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
P_ENDCARNETVALUE: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_EFFDATE: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
P_FEES: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_USERID: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class CreateBondRateDTO {
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
P_SPID: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_HOLDERTYPE: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_USCIBMEMBERFLAG: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_SPCLCOMMODITY: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_SPCLCOUNTRY: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_EFFDATE: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
P_RATE: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_USERID: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class CreateCargoRateDTO {
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
P_SPID: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_CARNETTYPE: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
P_STARTSETS: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
P_ENDSETS: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_EFFDATE: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
P_RATE: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_USERID: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class CreateCfFeeDTO {
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
P_SPID: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
P_STARTSETS: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
P_ENDSETS: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_EFFDATE: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_CUSTOMERTYPE: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_CARNETTYPE: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
P_RATE: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_USERID: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class CreateCsFeeDTO {
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
P_SPID: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_CUSTOMERTYPE: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_CARNETTYPE: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_EFFDATE: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
P_RATE: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_USERID: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class CreateEfFeeDTO {
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
P_SPID: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_CUSTOMERTYPE: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_DELIVERYTYPE: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
P_STARTTIME: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
P_ENDTIME: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_TIMEZONE: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_EFFDATE: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
P_FEES: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_USERID: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class CreateFeeCommDTO {
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
P_SPID: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
P_PARAMID: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
P_COMMRATE: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_EFFDATE: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_USERID: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class UpdateBasicFeeDTO {
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
P_BASICFEESETUPID: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
P_FEES: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_EFFDATE: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_USERID: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class UpdateBondRateDTO {
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
P_BONDRATESETUPID: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
P_RATE: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_EFFDATE: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_USERID: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class UpdateCargoRateDTO {
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
P_CARGORATESETUPID: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
P_RATE: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_EFFDATE: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_USERID: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class UpdateCfFeeDTO {
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
P_CFFEESETUPID: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
P_RATE: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_EFFDATE: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_USERID: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class UpdateCsFeeDTO {
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
P_CSFEESETUPID: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
P_RATE: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_EFFDATE: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_USERID: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class UpdateEfFeeDTO {
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
P_EFFEESETUPID: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
P_FEES: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_EFFDATE: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_USERID: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Existing UpdateFeeCommDTO
|
|
||||||
export class UpdateFeeCommDTO {
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
P_FEECOMMID: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
P_RATE: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_EFFDATE: string;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_USERID: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
// New UpdateFeeCommBodyDTO
|
|
||||||
export class UpdateFeeCommBodyDTO {
|
|
||||||
@ApiProperty({ type: UpdateFeeCommDTO, required: true }) // Correctly reference UpdateFeeCommDTO
|
|
||||||
p_fees_comm: UpdateFeeCommDTO; // No need for @IsObject()
|
|
||||||
}
|
|
||||||
|
|
||||||
export class ActivateOrInactivateParamRecordDTO {
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
P_PARAMID: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_USERID: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,5 @@
|
|||||||
import { Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { OracleService } from './oracle.service';
|
|
||||||
import { OracleController } from './oracle.controller';
|
|
||||||
import { DbModule } from 'src/db/db.module';
|
import { DbModule } from 'src/db/db.module';
|
||||||
import { ParamTableService } from './paramTable.service';
|
|
||||||
import { ManageFeeService } from './manageFee.service';
|
|
||||||
import { ManageHoldersModule } from './manage-holders/manage-holders.module';
|
import { ManageHoldersModule } from './manage-holders/manage-holders.module';
|
||||||
import { HomePageModule } from './home-page/home-page.module';
|
import { HomePageModule } from './home-page/home-page.module';
|
||||||
import { UscibManagedSpModule } from './uscib-managed-sp/uscib-managed-sp.module';
|
import { UscibManagedSpModule } from './uscib-managed-sp/uscib-managed-sp.module';
|
||||||
@ -12,9 +8,9 @@ import { ManageFeeModule } from './manage-fee/manage-fee.module';
|
|||||||
import { ManageClientsModule } from './manage-clients/manage-clients.module';
|
import { ManageClientsModule } from './manage-clients/manage-clients.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports:[DbModule, HomePageModule, ManageHoldersModule, UscibManagedSpModule, ParamTableModule, ManageFeeModule, ManageClientsModule],
|
imports:[DbModule, HomePageModule, UscibManagedSpModule, ParamTableModule, ManageFeeModule, ManageHoldersModule, ManageClientsModule],
|
||||||
providers: [OracleService,ParamTableService,ManageFeeService],
|
providers: [],
|
||||||
controllers: [OracleController],
|
controllers: [],
|
||||||
exports:[OracleService,ParamTableService,ManageFeeService]
|
exports:[]
|
||||||
})
|
})
|
||||||
export class OracleModule {}
|
export class OracleModule {}
|
||||||
|
|||||||
@ -1,134 +0,0 @@
|
|||||||
import { Injectable } from '@nestjs/common';
|
|
||||||
import { OracleDBService } from 'src/db/db.service';
|
|
||||||
import * as oracledb from 'oracledb'
|
|
||||||
|
|
||||||
@Injectable()
|
|
||||||
export class OracleService {
|
|
||||||
constructor(private readonly oracleDBService: OracleDBService) { }
|
|
||||||
|
|
||||||
// Service provider contacts [ SPContacts ]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// CarnetSequence
|
|
||||||
|
|
||||||
async createCarnetSequence(
|
|
||||||
p_spid: number,
|
|
||||||
p_regionid: number,
|
|
||||||
p_startnumber: number,
|
|
||||||
p_endnumber: number,
|
|
||||||
p_carnettype: string
|
|
||||||
) {
|
|
||||||
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
|
|
||||||
USCIB_Managed_Pkg.CreateCarnetSequence(
|
|
||||||
:p_spid,
|
|
||||||
:p_regionid,
|
|
||||||
:p_startnumber,
|
|
||||||
:p_endnumber,
|
|
||||||
:p_carnettype,
|
|
||||||
:p_cursor);
|
|
||||||
END;`, {
|
|
||||||
p_spid: {
|
|
||||||
val: p_spid,
|
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
|
||||||
},
|
|
||||||
p_regionid: {
|
|
||||||
val: p_regionid,
|
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
|
||||||
},
|
|
||||||
p_startnumber: {
|
|
||||||
val: p_startnumber,
|
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
|
||||||
},
|
|
||||||
p_endnumber: {
|
|
||||||
val: p_endnumber,
|
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
|
||||||
},
|
|
||||||
p_carnettype: {
|
|
||||||
val: p_carnettype,
|
|
||||||
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();
|
|
||||||
|
|
||||||
await result.outBinds.p_cursor.close()
|
|
||||||
|
|
||||||
return fres
|
|
||||||
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Error fetching users: ', err);
|
|
||||||
return { error: err.message }
|
|
||||||
} finally { }
|
|
||||||
}
|
|
||||||
|
|
||||||
async getCarnetSequence(p_spid: number) {
|
|
||||||
let connection;
|
|
||||||
let rows = [];
|
|
||||||
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
|
|
||||||
USCIB_Managed_Pkg.GetCarnetSequence(:p_spid,:p_cursor);
|
|
||||||
END;`,
|
|
||||||
{
|
|
||||||
p_spid: {
|
|
||||||
val: p_spid,
|
|
||||||
type: oracledb.DB_TYPE_NUMBER,
|
|
||||||
},
|
|
||||||
p_cursor: {
|
|
||||||
type: oracledb.CURSOR,
|
|
||||||
dir: oracledb.BIND_OUT
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
if (result.outBinds && result.outBinds.p_cursor) {
|
|
||||||
const cursor = result.outBinds.p_cursor; // The OUT cursor
|
|
||||||
let rowsBatch;
|
|
||||||
|
|
||||||
do {
|
|
||||||
rowsBatch = await cursor.getRows(100); // Fetch 100 rows at a time
|
|
||||||
rows = rows.concat(rowsBatch); // Append fetched rows to the main array
|
|
||||||
} while (rowsBatch.length > 0);
|
|
||||||
|
|
||||||
// Close the cursor after you're done
|
|
||||||
await cursor.close();
|
|
||||||
} else {
|
|
||||||
throw new Error('No cursor returned from the stored procedure');
|
|
||||||
}
|
|
||||||
|
|
||||||
return rows;
|
|
||||||
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Error fetching users: ', err);
|
|
||||||
return { error: err.message }
|
|
||||||
} finally { }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,4 +1,48 @@
|
|||||||
import { Controller } from '@nestjs/common';
|
import { Body, Controller, Get, Patch, Post, Put, Query, UsePipes } from '@nestjs/common';
|
||||||
|
import { ApiQuery, ApiTags } from '@nestjs/swagger';
|
||||||
|
import { ParamTableService } from './param-table.service';
|
||||||
|
import { ActivateOrInactivateParamRecordDTO, CreateParamRecordDTO, CreateTableRecordDTO, getParamValuesDTO, UpdateParamRecordDTO } from './param-table.dto';
|
||||||
|
|
||||||
@Controller('param-table')
|
@Controller('param-table')
|
||||||
export class ParamTableController {}
|
export class ParamTableController {
|
||||||
|
|
||||||
|
constructor(private readonly paramTableService: ParamTableService) { }
|
||||||
|
|
||||||
|
@ApiTags('Param Table - Oracle')
|
||||||
|
@Get('/GetParamValues')
|
||||||
|
@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' })
|
||||||
|
getParamValues(@Query() body: getParamValuesDTO) {
|
||||||
|
return this.paramTableService.GETPARAMVALUES(body)
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiTags('Param Table - Oracle')
|
||||||
|
@Post('/CreateTableRecord')
|
||||||
|
createTableRecord(@Body() body: CreateTableRecordDTO) {
|
||||||
|
return this.paramTableService.CREATETABLERECORD(body)
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiTags('Param Table - Oracle')
|
||||||
|
@Post('/CreateParamRecord')
|
||||||
|
createParamRecord(@Body() body: CreateParamRecordDTO) {
|
||||||
|
return this.paramTableService.CREATEPARAMRECORD(body)
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiTags('Param Table - Oracle')
|
||||||
|
@Patch('/UpdateParamRecord')
|
||||||
|
UpdateParamRecord(@Body() body: UpdateParamRecordDTO) {
|
||||||
|
return this.paramTableService.UPDATEPARAMRECORD(body)
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiTags('Param Table - Oracle')
|
||||||
|
@Put('/InActivateParamRecord')
|
||||||
|
inActivateParamRecord(@Body() body: ActivateOrInactivateParamRecordDTO) {
|
||||||
|
return this.paramTableService.INACTIVATEPARAMRECORD(body)
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiTags('Param Table - Oracle')
|
||||||
|
@Put('/ReActivateParamRecord')
|
||||||
|
reActivateParamRecord(@Body() body: ActivateOrInactivateParamRecordDTO) {
|
||||||
|
return this.paramTableService.REACTIVATEPARAMRECORD(body)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
140
src/oracle/param-table/param-table.dto.ts
Normal file
140
src/oracle/param-table/param-table.dto.ts
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
import { ApiProperty } from "@nestjs/swagger";
|
||||||
|
import { Transform } from "class-transformer";
|
||||||
|
import { IsDefined, IsInt, IsNumber, IsOptional, IsString, Min, ValidateIf } from "class-validator";
|
||||||
|
|
||||||
|
export class CreateTableRecordDTO {
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString({ message: "Property P_USERID must be a string" })
|
||||||
|
@IsDefined({ message: "Property P_USERID is required" })
|
||||||
|
P_USERID: string;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString({ message: "Property P_TABLEFULLDESC must be a string" })
|
||||||
|
@IsDefined({ message: "Property P_TABLEFULLDESC is required" })
|
||||||
|
P_TABLEFULLDESC: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class CreateParamRecordDTO {
|
||||||
|
@ApiProperty({ required: false })
|
||||||
|
@IsOptional()
|
||||||
|
@IsNumber()
|
||||||
|
P_SPID?: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_PARAMTYPE: string;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_PARAMDESC: string;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_PARAMVALUE: string;
|
||||||
|
|
||||||
|
@ApiProperty({ required: false })
|
||||||
|
@IsOptional()
|
||||||
|
@IsString()
|
||||||
|
P_ADDLPARAMVALUE1?: string;
|
||||||
|
|
||||||
|
@ApiProperty({ required: false })
|
||||||
|
@IsOptional()
|
||||||
|
@IsString()
|
||||||
|
P_ADDLPARAMVALUE2?: string;
|
||||||
|
|
||||||
|
@ApiProperty({ required: false })
|
||||||
|
@IsOptional()
|
||||||
|
@IsString()
|
||||||
|
P_ADDLPARAMVALUE3?: string;
|
||||||
|
|
||||||
|
@ApiProperty({ required: false })
|
||||||
|
@IsOptional()
|
||||||
|
@IsString()
|
||||||
|
P_ADDLPARAMVALUE4?: string;
|
||||||
|
|
||||||
|
@ApiProperty({ required: false })
|
||||||
|
@IsOptional()
|
||||||
|
@IsString()
|
||||||
|
P_ADDLPARAMVALUE5?: string;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber()
|
||||||
|
P_SORTSEQ: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_USERID: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class UpdateParamRecordDTO {
|
||||||
|
@ApiProperty({ required: false })
|
||||||
|
@IsOptional()
|
||||||
|
@IsNumber()
|
||||||
|
P_SPID?: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber()
|
||||||
|
P_PARAMID: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_PARAMDESC: string;
|
||||||
|
|
||||||
|
@ApiProperty({ required: false })
|
||||||
|
@IsOptional()
|
||||||
|
@IsString()
|
||||||
|
P_ADDLPARAMVALUE1?: string;
|
||||||
|
|
||||||
|
@ApiProperty({ required: false })
|
||||||
|
@IsOptional()
|
||||||
|
@IsString()
|
||||||
|
P_ADDLPARAMVALUE2?: string;
|
||||||
|
|
||||||
|
@ApiProperty({ required: false })
|
||||||
|
@IsOptional()
|
||||||
|
@IsString()
|
||||||
|
P_ADDLPARAMVALUE3?: string;
|
||||||
|
|
||||||
|
@ApiProperty({ required: false })
|
||||||
|
@IsOptional()
|
||||||
|
@IsString()
|
||||||
|
P_ADDLPARAMVALUE4?: string;
|
||||||
|
|
||||||
|
@ApiProperty({ required: false })
|
||||||
|
@IsOptional()
|
||||||
|
@IsString()
|
||||||
|
P_ADDLPARAMVALUE5?: string;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber()
|
||||||
|
P_SORTSEQ: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
P_USERID: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class getParamValuesDTO {
|
||||||
|
@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;
|
||||||
|
|
||||||
|
@IsString({ message: "Property P_PARAMTYPE must be a string" })
|
||||||
|
@IsOptional()
|
||||||
|
P_PARAMTYPE?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class ActivateOrInactivateParamRecordDTO {
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber({}, { message: "Property P_PARAMID must be a number" })
|
||||||
|
@IsDefined({ message: "Property P_PARAMID is required" })
|
||||||
|
P_PARAMID: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString({ message: "Property P_USERID must be a string" })
|
||||||
|
@IsDefined({ message: "Property P_USERID is required" })
|
||||||
|
P_USERID: string;
|
||||||
|
}
|
||||||
@ -1,4 +1,367 @@
|
|||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
|
import { OracleDBService } from 'src/db/db.service';
|
||||||
|
import * as oracledb from 'oracledb'
|
||||||
|
import { ActivateOrInactivateParamRecordDTO, CreateParamRecordDTO, CreateTableRecordDTO, getParamValuesDTO, UpdateParamRecordDTO } from './param-table.dto';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ParamTableService {}
|
export class ParamTableService {
|
||||||
|
constructor(private readonly oracleDBService: OracleDBService) { }
|
||||||
|
|
||||||
|
async GETPARAMVALUES(body:getParamValuesDTO) {
|
||||||
|
|
||||||
|
let finalBody = {
|
||||||
|
P_SPID: body.P_SPID ? body.P_SPID : null,
|
||||||
|
P_PARAMTYPE: body.P_PARAMTYPE ? body.P_PARAMTYPE : null
|
||||||
|
}
|
||||||
|
|
||||||
|
let connection;
|
||||||
|
let rows = [];
|
||||||
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection()
|
||||||
|
if (!connection) {
|
||||||
|
throw new Error('No DB Connected')
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = await connection.execute(
|
||||||
|
`BEGIN
|
||||||
|
MANAGEPARAMTABLE_PKG.GETPARAMVALUES(: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
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (result.outBinds && result.outBinds.p_cursor) {
|
||||||
|
const cursor = result.outBinds.p_cursor;
|
||||||
|
let rowsBatch;
|
||||||
|
|
||||||
|
do {
|
||||||
|
rowsBatch = await cursor.getRows(100);
|
||||||
|
rows = rows.concat(rowsBatch);
|
||||||
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
|
await cursor.close();
|
||||||
|
} else {
|
||||||
|
throw new Error('No cursor returned from the stored procedure');
|
||||||
|
}
|
||||||
|
|
||||||
|
return rows;
|
||||||
|
|
||||||
|
} catch (err) {
|
||||||
|
|
||||||
|
return { error: err.message }
|
||||||
|
} finally { }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
async CREATETABLERECORD(body: CreateTableRecordDTO) {
|
||||||
|
let connection;
|
||||||
|
try {
|
||||||
|
|
||||||
|
connection = await this.oracleDBService.getConnection()
|
||||||
|
if (!connection) {
|
||||||
|
throw new Error('No DB Connected')
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = await connection.execute(
|
||||||
|
`BEGIN
|
||||||
|
MANAGEPARAMTABLE_PKG.CREATETABLERECORD(:P_USERID,:P_TABLEFULLDESC,:p_cursor);
|
||||||
|
END;`,
|
||||||
|
{
|
||||||
|
P_TABLEFULLDESC: {
|
||||||
|
val: body.P_TABLEFULLDESC,
|
||||||
|
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) {
|
||||||
|
|
||||||
|
return { error: err.message }
|
||||||
|
} finally { }
|
||||||
|
}
|
||||||
|
|
||||||
|
async CREATEPARAMRECORD(body: CreateParamRecordDTO) {
|
||||||
|
let connection;
|
||||||
|
try {
|
||||||
|
|
||||||
|
connection = await this.oracleDBService.getConnection()
|
||||||
|
if (!connection) {
|
||||||
|
throw new Error('No DB Connected')
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = await connection.execute(
|
||||||
|
`BEGIN
|
||||||
|
MANAGEPARAMTABLE_PKG.CREATEPARAMRECORD(
|
||||||
|
:P_SPID,
|
||||||
|
:P_PARAMTYPE,
|
||||||
|
:P_PARAMDESC,
|
||||||
|
:P_PARAMVALUE,
|
||||||
|
:P_ADDLPARAMVALUE1,
|
||||||
|
:P_ADDLPARAMVALUE2,
|
||||||
|
:P_ADDLPARAMVALUE3,
|
||||||
|
:P_ADDLPARAMVALUE4,
|
||||||
|
:P_ADDLPARAMVALUE5,
|
||||||
|
:P_SORTSEQ,
|
||||||
|
:P_USERID,
|
||||||
|
:p_cursor);
|
||||||
|
END;`,
|
||||||
|
{
|
||||||
|
P_SPID: {
|
||||||
|
val: body.P_SPID,
|
||||||
|
type: oracledb.DB_TYPE_NUMBER
|
||||||
|
},
|
||||||
|
P_PARAMTYPE: {
|
||||||
|
val: body.P_PARAMTYPE,
|
||||||
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
|
},
|
||||||
|
P_PARAMDESC: {
|
||||||
|
val: body.P_PARAMDESC,
|
||||||
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
|
},
|
||||||
|
P_PARAMVALUE: {
|
||||||
|
val: body.P_PARAMVALUE,
|
||||||
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
|
},
|
||||||
|
P_ADDLPARAMVALUE1: {
|
||||||
|
val: body.P_ADDLPARAMVALUE1,
|
||||||
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
|
},
|
||||||
|
P_ADDLPARAMVALUE2: {
|
||||||
|
val: body.P_ADDLPARAMVALUE2,
|
||||||
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
|
},
|
||||||
|
P_ADDLPARAMVALUE3: {
|
||||||
|
val: body.P_ADDLPARAMVALUE3,
|
||||||
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
|
},
|
||||||
|
P_ADDLPARAMVALUE4: {
|
||||||
|
val: body.P_ADDLPARAMVALUE4,
|
||||||
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
|
},
|
||||||
|
P_ADDLPARAMVALUE5: {
|
||||||
|
val: body.P_ADDLPARAMVALUE5,
|
||||||
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
|
},
|
||||||
|
P_SORTSEQ: {
|
||||||
|
val: body.P_SORTSEQ,
|
||||||
|
type: oracledb.DB_TYPE_NUMBER
|
||||||
|
},
|
||||||
|
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) {
|
||||||
|
|
||||||
|
return { error: err.message }
|
||||||
|
} finally { }
|
||||||
|
}
|
||||||
|
|
||||||
|
async UPDATEPARAMRECORD(body: UpdateParamRecordDTO) {
|
||||||
|
let connection;
|
||||||
|
try {
|
||||||
|
|
||||||
|
connection = await this.oracleDBService.getConnection()
|
||||||
|
if (!connection) {
|
||||||
|
throw new Error('No DB Connected')
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = await connection.execute(
|
||||||
|
`BEGIN
|
||||||
|
MANAGEPARAMTABLE_PKG.UPDATEPARAMRECORD(
|
||||||
|
:P_SPID,
|
||||||
|
:P_PARAMID,
|
||||||
|
:P_PARAMDESC,
|
||||||
|
:P_ADDLPARAMVALUE1,
|
||||||
|
:P_ADDLPARAMVALUE2,
|
||||||
|
:P_ADDLPARAMVALUE3,
|
||||||
|
:P_ADDLPARAMVALUE4,
|
||||||
|
:P_ADDLPARAMVALUE5,
|
||||||
|
:P_SORTSEQ,
|
||||||
|
:P_USERID,
|
||||||
|
:p_cursor);
|
||||||
|
END;`,
|
||||||
|
{
|
||||||
|
P_SPID: {
|
||||||
|
val: body.P_SPID,
|
||||||
|
type: oracledb.DB_TYPE_NUMBER
|
||||||
|
},
|
||||||
|
P_PARAMID: {
|
||||||
|
val: body.P_PARAMID,
|
||||||
|
type: oracledb.DB_TYPE_NUMBER
|
||||||
|
},
|
||||||
|
P_PARAMDESC: {
|
||||||
|
val: body.P_PARAMDESC,
|
||||||
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
|
},
|
||||||
|
P_ADDLPARAMVALUE1: {
|
||||||
|
val: body.P_ADDLPARAMVALUE1,
|
||||||
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
|
},
|
||||||
|
P_ADDLPARAMVALUE2: {
|
||||||
|
val: body.P_ADDLPARAMVALUE2,
|
||||||
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
|
},
|
||||||
|
P_ADDLPARAMVALUE3: {
|
||||||
|
val: body.P_ADDLPARAMVALUE3,
|
||||||
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
|
},
|
||||||
|
P_ADDLPARAMVALUE4: {
|
||||||
|
val: body.P_ADDLPARAMVALUE4,
|
||||||
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
|
},
|
||||||
|
P_ADDLPARAMVALUE5: {
|
||||||
|
val: body.P_ADDLPARAMVALUE5,
|
||||||
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
|
},
|
||||||
|
P_SORTSEQ: {
|
||||||
|
val: body.P_SORTSEQ,
|
||||||
|
type: oracledb.DB_TYPE_NUMBER
|
||||||
|
},
|
||||||
|
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) {
|
||||||
|
|
||||||
|
return { error: err.message }
|
||||||
|
} finally { }
|
||||||
|
}
|
||||||
|
|
||||||
|
async INACTIVATEPARAMRECORD(body: ActivateOrInactivateParamRecordDTO) {
|
||||||
|
let connection;
|
||||||
|
try {
|
||||||
|
|
||||||
|
connection = await this.oracleDBService.getConnection()
|
||||||
|
if (!connection) {
|
||||||
|
throw new Error('No DB Connected')
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = await connection.execute(
|
||||||
|
`BEGIN
|
||||||
|
MANAGEPARAMTABLE_PKG.INACTIVATEPARAMRECORD(
|
||||||
|
:P_PARAMID,
|
||||||
|
:P_USERID);
|
||||||
|
END;`,
|
||||||
|
{
|
||||||
|
P_PARAMID: {
|
||||||
|
val: body.P_PARAMID,
|
||||||
|
type: oracledb.DB_TYPE_NUMBER
|
||||||
|
},
|
||||||
|
P_USERID: {
|
||||||
|
val: body.P_USERID,
|
||||||
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
await connection.commit();
|
||||||
|
|
||||||
|
return "SP Executed Successfully"
|
||||||
|
|
||||||
|
|
||||||
|
} catch (err) {
|
||||||
|
|
||||||
|
return { error: err.message }
|
||||||
|
} finally { }
|
||||||
|
}
|
||||||
|
|
||||||
|
async REACTIVATEPARAMRECORD(body: ActivateOrInactivateParamRecordDTO) {
|
||||||
|
let connection;
|
||||||
|
try {
|
||||||
|
|
||||||
|
connection = await this.oracleDBService.getConnection()
|
||||||
|
if (!connection) {
|
||||||
|
throw new Error('No DB Connected')
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = await connection.execute(
|
||||||
|
`BEGIN
|
||||||
|
MANAGEPARAMTABLE_PKG.REACTIVATEPARAMRECORD(
|
||||||
|
:P_PARAMID,
|
||||||
|
:P_USERID);
|
||||||
|
END;`,
|
||||||
|
{
|
||||||
|
P_PARAMID: {
|
||||||
|
val: body.P_PARAMID,
|
||||||
|
type: oracledb.DB_TYPE_NUMBER
|
||||||
|
},
|
||||||
|
P_USERID: {
|
||||||
|
val: body.P_USERID,
|
||||||
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
await connection.commit();
|
||||||
|
|
||||||
|
return "SP Executed Successfully"
|
||||||
|
|
||||||
|
|
||||||
|
} catch (err) {
|
||||||
|
|
||||||
|
return { error: err.message }
|
||||||
|
} finally { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -1,377 +0,0 @@
|
|||||||
import { Injectable } from '@nestjs/common';
|
|
||||||
import { OracleDBService } from 'src/db/db.service';
|
|
||||||
import * as oracledb from 'oracledb'
|
|
||||||
import { ActivateOrInactivateParamRecordDTO, UpdateParamRecordDTO } from './oracle.dto';
|
|
||||||
|
|
||||||
@Injectable()
|
|
||||||
export class ParamTableService {
|
|
||||||
constructor(private readonly oracleDBService: OracleDBService) { }
|
|
||||||
|
|
||||||
async GETPARAMVALUES(P_SPID?: number | null, P_PARAMTYPE?: string | null) {
|
|
||||||
P_SPID = P_SPID ? P_SPID : null;
|
|
||||||
P_PARAMTYPE = P_PARAMTYPE ? P_PARAMTYPE : null;
|
|
||||||
let connection;
|
|
||||||
let rows = [];
|
|
||||||
try {
|
|
||||||
connection = await this.oracleDBService.getConnection()
|
|
||||||
if (!connection) {
|
|
||||||
throw new Error('No DB Connected')
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = await connection.execute(
|
|
||||||
`BEGIN
|
|
||||||
MANAGEPARAMTABLE_PKG.GETPARAMVALUES(:P_SPID,:P_PARAMTYPE,:p_cursor);
|
|
||||||
END;`,
|
|
||||||
{
|
|
||||||
P_SPID: {
|
|
||||||
val: P_SPID,
|
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
|
||||||
},
|
|
||||||
P_PARAMTYPE: {
|
|
||||||
val: P_PARAMTYPE,
|
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
|
||||||
},
|
|
||||||
p_cursor: {
|
|
||||||
type: oracledb.CURSOR,
|
|
||||||
dir: oracledb.BIND_OUT
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
if (result.outBinds && result.outBinds.p_cursor) {
|
|
||||||
const cursor = result.outBinds.p_cursor; // The OUT cursor
|
|
||||||
let rowsBatch;
|
|
||||||
|
|
||||||
do {
|
|
||||||
rowsBatch = await cursor.getRows(100); // Fetch 100 rows at a time
|
|
||||||
rows = rows.concat(rowsBatch); // Append fetched rows to the main array
|
|
||||||
} while (rowsBatch.length > 0);
|
|
||||||
|
|
||||||
console.log('Rows fetched:', rows);
|
|
||||||
|
|
||||||
// Close the cursor after you're done
|
|
||||||
await cursor.close();
|
|
||||||
} else {
|
|
||||||
throw new Error('No cursor returned from the stored procedure');
|
|
||||||
}
|
|
||||||
|
|
||||||
return rows;
|
|
||||||
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Error fetching users: ', err);
|
|
||||||
return {error: err.message}
|
|
||||||
} finally { }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
async CREATETABLERECORD(P_USERID: string, P_TABLEFULLDESC: string) {
|
|
||||||
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
|
|
||||||
MANAGEPARAMTABLE_PKG.CREATETABLERECORD(:P_USERID,:P_TABLEFULLDESC,:p_cursor);
|
|
||||||
END;`,
|
|
||||||
{
|
|
||||||
P_TABLEFULLDESC: {
|
|
||||||
val: P_TABLEFULLDESC,
|
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
|
||||||
},
|
|
||||||
P_USERID: {
|
|
||||||
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
|
|
||||||
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Error fetching users: ', err);
|
|
||||||
return {error: err.message}
|
|
||||||
} finally { }
|
|
||||||
}
|
|
||||||
|
|
||||||
async CREATEPARAMRECORD(
|
|
||||||
P_PARAMTYPE: string,
|
|
||||||
P_PARAMDESC: string,
|
|
||||||
P_PARAMVALUE: string,
|
|
||||||
P_SORTSEQ: number,
|
|
||||||
P_USERID: string,
|
|
||||||
P_SPID?: number,
|
|
||||||
P_ADDLPARAMVALUE1?: string,
|
|
||||||
P_ADDLPARAMVALUE2?: string,
|
|
||||||
P_ADDLPARAMVALUE3?: string,
|
|
||||||
P_ADDLPARAMVALUE4?: string,
|
|
||||||
P_ADDLPARAMVALUE5?: string,
|
|
||||||
) {
|
|
||||||
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
|
|
||||||
MANAGEPARAMTABLE_PKG.CREATEPARAMRECORD(
|
|
||||||
:P_SPID,
|
|
||||||
:P_PARAMTYPE,
|
|
||||||
:P_PARAMDESC,
|
|
||||||
:P_PARAMVALUE,
|
|
||||||
:P_ADDLPARAMVALUE1,
|
|
||||||
:P_ADDLPARAMVALUE2,
|
|
||||||
:P_ADDLPARAMVALUE3,
|
|
||||||
:P_ADDLPARAMVALUE4,
|
|
||||||
:P_ADDLPARAMVALUE5,
|
|
||||||
:P_SORTSEQ,
|
|
||||||
:P_USERID,
|
|
||||||
:p_cursor);
|
|
||||||
END;`,
|
|
||||||
{
|
|
||||||
P_SPID: {
|
|
||||||
val: P_SPID,
|
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
|
||||||
},
|
|
||||||
P_PARAMTYPE: {
|
|
||||||
val: P_PARAMTYPE,
|
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
|
||||||
},
|
|
||||||
P_PARAMDESC: {
|
|
||||||
val: P_PARAMDESC,
|
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
|
||||||
},
|
|
||||||
P_PARAMVALUE: {
|
|
||||||
val: P_PARAMVALUE,
|
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
|
||||||
},
|
|
||||||
P_ADDLPARAMVALUE1: {
|
|
||||||
val: P_ADDLPARAMVALUE1,
|
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
|
||||||
},
|
|
||||||
P_ADDLPARAMVALUE2: {
|
|
||||||
val: P_ADDLPARAMVALUE2,
|
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
|
||||||
},
|
|
||||||
P_ADDLPARAMVALUE3: {
|
|
||||||
val: P_ADDLPARAMVALUE3,
|
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
|
||||||
},
|
|
||||||
P_ADDLPARAMVALUE4: {
|
|
||||||
val: P_ADDLPARAMVALUE4,
|
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
|
||||||
},
|
|
||||||
P_ADDLPARAMVALUE5: {
|
|
||||||
val: P_ADDLPARAMVALUE5,
|
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
|
||||||
},
|
|
||||||
P_SORTSEQ: {
|
|
||||||
val: P_SORTSEQ,
|
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
|
||||||
},
|
|
||||||
P_USERID: {
|
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Error fetching users: ', err);
|
|
||||||
return {error: err.message}
|
|
||||||
} finally { }
|
|
||||||
}
|
|
||||||
|
|
||||||
async UPDATEPARAMRECORD(body: UpdateParamRecordDTO) {
|
|
||||||
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
|
|
||||||
MANAGEPARAMTABLE_PKG.UPDATEPARAMRECORD(
|
|
||||||
:P_SPID,
|
|
||||||
:P_PARAMID,
|
|
||||||
:P_PARAMDESC,
|
|
||||||
:P_ADDLPARAMVALUE1,
|
|
||||||
:P_ADDLPARAMVALUE2,
|
|
||||||
:P_ADDLPARAMVALUE3,
|
|
||||||
:P_ADDLPARAMVALUE4,
|
|
||||||
:P_ADDLPARAMVALUE5,
|
|
||||||
:P_SORTSEQ,
|
|
||||||
:P_USERID,
|
|
||||||
:p_cursor);
|
|
||||||
END;`,
|
|
||||||
{
|
|
||||||
P_SPID: {
|
|
||||||
val: body.P_SPID,
|
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
|
||||||
},
|
|
||||||
P_PARAMID: {
|
|
||||||
val: body.P_PARAMID,
|
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
|
||||||
},
|
|
||||||
P_PARAMDESC: {
|
|
||||||
val: body.P_PARAMDESC,
|
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
|
||||||
},
|
|
||||||
P_ADDLPARAMVALUE1: {
|
|
||||||
val: body.P_ADDLPARAMVALUE1,
|
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
|
||||||
},
|
|
||||||
P_ADDLPARAMVALUE2: {
|
|
||||||
val: body.P_ADDLPARAMVALUE2,
|
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
|
||||||
},
|
|
||||||
P_ADDLPARAMVALUE3: {
|
|
||||||
val: body.P_ADDLPARAMVALUE3,
|
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
|
||||||
},
|
|
||||||
P_ADDLPARAMVALUE4: {
|
|
||||||
val: body.P_ADDLPARAMVALUE4,
|
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
|
||||||
},
|
|
||||||
P_ADDLPARAMVALUE5: {
|
|
||||||
val: body.P_ADDLPARAMVALUE5,
|
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
|
||||||
},
|
|
||||||
P_SORTSEQ: {
|
|
||||||
val: body.P_SORTSEQ,
|
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
|
||||||
},
|
|
||||||
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);
|
|
||||||
return {error: err.message}
|
|
||||||
} finally { }
|
|
||||||
}
|
|
||||||
|
|
||||||
async INACTIVATEPARAMRECORD(body:ActivateOrInactivateParamRecordDTO) {
|
|
||||||
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
|
|
||||||
MANAGEPARAMTABLE_PKG.INACTIVATEPARAMRECORD(
|
|
||||||
:P_PARAMID,
|
|
||||||
:P_USERID);
|
|
||||||
END;`,
|
|
||||||
{
|
|
||||||
P_PARAMID: {
|
|
||||||
val: body.P_PARAMID,
|
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
|
||||||
},
|
|
||||||
P_USERID: {
|
|
||||||
val: body.P_USERID,
|
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
await connection.commit();
|
|
||||||
|
|
||||||
return "SP Executed Successfully"
|
|
||||||
|
|
||||||
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Error fetching users: ', err);
|
|
||||||
return {error: err.message}
|
|
||||||
} finally { }
|
|
||||||
}
|
|
||||||
|
|
||||||
async REACTIVATEPARAMRECORD(body:ActivateOrInactivateParamRecordDTO) {
|
|
||||||
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
|
|
||||||
MANAGEPARAMTABLE_PKG.REACTIVATEPARAMRECORD(
|
|
||||||
:P_PARAMID,
|
|
||||||
:P_USERID);
|
|
||||||
END;`,
|
|
||||||
{
|
|
||||||
P_PARAMID: {
|
|
||||||
val: body.P_PARAMID,
|
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
|
||||||
},
|
|
||||||
P_USERID: {
|
|
||||||
val: body.P_USERID,
|
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
|
||||||
},
|
|
||||||
},
|
|
||||||
);
|
|
||||||
await connection.commit();
|
|
||||||
|
|
||||||
return "SP Executed Successfully"
|
|
||||||
|
|
||||||
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Error fetching users: ', err);
|
|
||||||
return {error: err.message}
|
|
||||||
} finally { }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,4 +1,22 @@
|
|||||||
import { Controller } from '@nestjs/common';
|
import { Body, Controller, Get, Param, ParseIntPipe, Post, Query } from '@nestjs/common';
|
||||||
|
import { CreateCarnetSequenceDTO, GetCarnetSequenceDTO } from './carnet-sequence.dto';
|
||||||
|
import { ApiTags } from '@nestjs/swagger';
|
||||||
|
import { CarnetSequenceService } from './carnet-sequence.service';
|
||||||
|
|
||||||
@Controller('carnet-sequence')
|
@Controller('carnet-sequence')
|
||||||
export class CarnetSequenceController {}
|
export class CarnetSequenceController {
|
||||||
|
|
||||||
|
constructor(private readonly carnetSequenceService:CarnetSequenceService){}
|
||||||
|
|
||||||
|
@ApiTags('Carnet Sequence - Oracle')
|
||||||
|
@Post('/CreateCarnetSequence/')
|
||||||
|
createCarnetSequence(@Body() body: CreateCarnetSequenceDTO) {
|
||||||
|
return this.carnetSequenceService.createCarnetSequence(body)
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiTags('Carnet Sequence - Oracle')
|
||||||
|
@Get('/GetCarnetSequence')
|
||||||
|
getCarnetSequence(@Query() body: GetCarnetSequenceDTO) {
|
||||||
|
return this.carnetSequenceService.getCarnetSequence(body)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -0,0 +1,42 @@
|
|||||||
|
import { ApiProperty } from "@nestjs/swagger";
|
||||||
|
import { Transform } from "class-transformer";
|
||||||
|
import { IsDefined, IsInt, IsNumber, IsString, Min } from "class-validator";
|
||||||
|
|
||||||
|
export class CreateCarnetSequenceDTO {
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber({}, { message: "Property p_spid must be a number" })
|
||||||
|
@IsDefined({ message: "Property p_spid is required" })
|
||||||
|
p_spid: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber({}, { message: "Property p_regionid must be a number" })
|
||||||
|
@IsDefined({ message: "Property p_regionid is required" })
|
||||||
|
p_regionid: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber({}, { message: "Property p_startnumber must be a number" })
|
||||||
|
@IsDefined({ message: "Property p_startnumber is required" })
|
||||||
|
@Min(0, { message: "Property p_startnumber must be at least 0" })
|
||||||
|
p_startnumber: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber({}, { message: "Property p_endnumber must be a number" })
|
||||||
|
@IsDefined({ message: "Property p_endnumber is required" })
|
||||||
|
@Min(0, { message: "Property p_endnumber must be at least 0" })
|
||||||
|
p_endnumber: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString({ message: "Property p_carnettype must be a string" })
|
||||||
|
@IsDefined({ message: "Property p_carnettype is required" })
|
||||||
|
p_carnettype: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class GetCarnetSequenceDTO{
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@Min(0, { message: "Property p_spid must be at least 0" })
|
||||||
|
@IsInt({ message: "Property p_SPid must be a whole number" })
|
||||||
|
@Transform(({ value }) => Number(value))
|
||||||
|
@IsNumber({}, { message: "Property p_spid must be a number" })
|
||||||
|
@IsDefined({ message: "Property p_spid is required" })
|
||||||
|
p_spid:number;
|
||||||
|
}
|
||||||
@ -1,4 +1,123 @@
|
|||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
|
import * as oracledb from 'oracledb';
|
||||||
|
import { OracleDBService } from 'src/db/db.service';
|
||||||
|
import { CreateCarnetSequenceDTO, GetCarnetSequenceDTO } from './carnet-sequence.dto';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class CarnetSequenceService {}
|
export class CarnetSequenceService {
|
||||||
|
|
||||||
|
constructor(private readonly oracleDBService:OracleDBService){}
|
||||||
|
|
||||||
|
async createCarnetSequence(body:CreateCarnetSequenceDTO) {
|
||||||
|
let connection;
|
||||||
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection()
|
||||||
|
if (!connection) {
|
||||||
|
throw new Error('No DB Connected')
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = await connection.execute(
|
||||||
|
`BEGIN
|
||||||
|
USCIB_Managed_Pkg.CreateCarnetSequence(
|
||||||
|
:p_spid,
|
||||||
|
:p_regionid,
|
||||||
|
:p_startnumber,
|
||||||
|
:p_endnumber,
|
||||||
|
:p_carnettype,
|
||||||
|
:p_cursor);
|
||||||
|
END;`, {
|
||||||
|
p_spid: {
|
||||||
|
val: body.p_spid,
|
||||||
|
type: oracledb.DB_TYPE_NUMBER
|
||||||
|
},
|
||||||
|
p_regionid: {
|
||||||
|
val: body.p_regionid,
|
||||||
|
type: oracledb.DB_TYPE_NUMBER
|
||||||
|
},
|
||||||
|
p_startnumber: {
|
||||||
|
val: body.p_startnumber,
|
||||||
|
type: oracledb.DB_TYPE_NUMBER
|
||||||
|
},
|
||||||
|
p_endnumber: {
|
||||||
|
val: body.p_endnumber,
|
||||||
|
type: oracledb.DB_TYPE_NUMBER
|
||||||
|
},
|
||||||
|
p_carnettype: {
|
||||||
|
val: body.p_carnettype,
|
||||||
|
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();
|
||||||
|
|
||||||
|
await result.outBinds.p_cursor.close()
|
||||||
|
|
||||||
|
return fres
|
||||||
|
|
||||||
|
} catch (err) {
|
||||||
|
|
||||||
|
return { error: err.message }
|
||||||
|
} finally { }
|
||||||
|
}
|
||||||
|
|
||||||
|
async getCarnetSequence(body: GetCarnetSequenceDTO) {
|
||||||
|
let connection;
|
||||||
|
let rows = [];
|
||||||
|
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
|
||||||
|
USCIB_Managed_Pkg.GetCarnetSequence(:p_spid,:p_cursor);
|
||||||
|
END;`,
|
||||||
|
{
|
||||||
|
p_spid: {
|
||||||
|
val: body.p_spid,
|
||||||
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
|
},
|
||||||
|
p_cursor: {
|
||||||
|
type: oracledb.CURSOR,
|
||||||
|
dir: oracledb.BIND_OUT
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
outFormat: oracledb.OUT_FORMAT_OBJECT
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (result.outBinds && result.outBinds.p_cursor) {
|
||||||
|
const cursor = result.outBinds.p_cursor;
|
||||||
|
let rowsBatch;
|
||||||
|
|
||||||
|
do {
|
||||||
|
rowsBatch = await cursor.getRows(100); // Fetch 100 rows at a time
|
||||||
|
rows = rows.concat(rowsBatch);
|
||||||
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
|
await cursor.close();
|
||||||
|
} else {
|
||||||
|
throw new Error('No cursor returned from the stored procedure');
|
||||||
|
}
|
||||||
|
|
||||||
|
return rows;
|
||||||
|
|
||||||
|
} catch (err) {
|
||||||
|
|
||||||
|
return { error: err.message }
|
||||||
|
} finally { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -21,13 +21,13 @@ export class RegionController {
|
|||||||
@ApiTags('Regions - Oracle')
|
@ApiTags('Regions - Oracle')
|
||||||
@Post('/InsertRegions')
|
@Post('/InsertRegions')
|
||||||
insertRegions(@Body() body: InsertRegionsDto) {
|
insertRegions(@Body() body: InsertRegionsDto) {
|
||||||
return this.regionService.insertRegions(body.p_region, body.p_name);
|
return this.regionService.insertRegions(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Regions - Oracle')
|
@ApiTags('Regions - Oracle')
|
||||||
@Patch('/UpdateRegion')
|
@Patch('/UpdateRegion')
|
||||||
updateRegions(@Body() body: UpdateRegionDto) {
|
updateRegions(@Body() body: UpdateRegionDto) {
|
||||||
return this.regionService.updateRegions(body.p_regionID, body.p_name);
|
return this.regionService.updateRegions(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Regions - Oracle')
|
@ApiTags('Regions - Oracle')
|
||||||
|
|||||||
@ -1,22 +1,26 @@
|
|||||||
import { IsNumber,IsString } from "class-validator";
|
import { IsDefined, IsNumber,IsString } from "class-validator";
|
||||||
import { ApiProperty } from "@nestjs/swagger";
|
import { ApiProperty } from "@nestjs/swagger";
|
||||||
|
|
||||||
export class InsertRegionsDto {
|
export class InsertRegionsDto {
|
||||||
@ApiProperty()
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString({ message: "Property p_region must be a string" })
|
||||||
|
@IsDefined({ message: "Property p_region is required" })
|
||||||
p_region: string;
|
p_region: string;
|
||||||
|
|
||||||
@ApiProperty()
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString({ message: "Property p_name must be a string" })
|
||||||
|
@IsDefined({ message: "Property p_name is required" })
|
||||||
p_name: string;
|
p_name: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class UpdateRegionDto {
|
export class UpdateRegionDto {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber({}, { message: "Property p_regionID must be a number" })
|
||||||
|
@IsDefined({ message: "Property p_regionID is required" })
|
||||||
p_regionID: number;
|
p_regionID: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString({ message: "Property p_name must be a string" })
|
||||||
|
@IsDefined({ message: "Property p_name is required" })
|
||||||
p_name: string;
|
p_name: string;
|
||||||
}
|
}
|
||||||
@ -1,10 +1,8 @@
|
|||||||
import { Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { RegionController } from './region.controller';
|
import { RegionController } from './region.controller';
|
||||||
import { RegionService } from './region.service';
|
import { RegionService } from './region.service';
|
||||||
import { DbModule } from 'src/db/db.module';
|
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports:[DbModule],
|
|
||||||
controllers: [RegionController],
|
controllers: [RegionController],
|
||||||
providers: [RegionService]
|
providers: [RegionService]
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,16 +1,17 @@
|
|||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { OracleDBService } from 'src/db/db.service';
|
import { OracleDBService } from 'src/db/db.service';
|
||||||
import * as oracledb from 'oracledb'
|
import * as oracledb from 'oracledb'
|
||||||
|
import { InsertRegionsDto, UpdateRegionDto } from './region.dto';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class RegionService {
|
export class RegionService {
|
||||||
|
|
||||||
constructor(private readonly oracleDBService: OracleDBService) { }
|
constructor(private readonly oracleDBService: OracleDBService) { }
|
||||||
|
|
||||||
async insertRegions(p_region: String, p_name: String) {
|
async insertRegions(body: InsertRegionsDto) {
|
||||||
let connection;
|
let connection;
|
||||||
try {
|
try {
|
||||||
// Connect to the Oracle database using oracledb
|
|
||||||
connection = await this.oracleDBService.getConnection()
|
connection = await this.oracleDBService.getConnection()
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected')
|
||||||
@ -21,11 +22,11 @@ export class RegionService {
|
|||||||
USCIB_Managed_Pkg.InsertNewRegion(:p_region,:p_name,:p_cursor);
|
USCIB_Managed_Pkg.InsertNewRegion(:p_region,:p_name,:p_cursor);
|
||||||
END;`, {
|
END;`, {
|
||||||
p_region: {
|
p_region: {
|
||||||
val: p_region,
|
val: body.p_region,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_name: {
|
p_name: {
|
||||||
val: p_name,
|
val: body.p_name,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_cursor: {
|
p_cursor: {
|
||||||
@ -44,15 +45,15 @@ export class RegionService {
|
|||||||
return fres
|
return fres
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching users: ', err);
|
|
||||||
return { error: err.message }
|
return { error: err.message }
|
||||||
} finally { }
|
} finally { }
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateRegions(p_regionID: Number, p_name: String) {
|
async updateRegions(body: UpdateRegionDto) {
|
||||||
let connection;
|
let connection;
|
||||||
try {
|
try {
|
||||||
// Connect to the Oracle database using oracledb
|
|
||||||
connection = await this.oracleDBService.getConnection()
|
connection = await this.oracleDBService.getConnection()
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected')
|
||||||
@ -63,11 +64,11 @@ export class RegionService {
|
|||||||
USCIB_Managed_Pkg.UpdateRegion(:p_regionID,:p_name,:p_cursor);
|
USCIB_Managed_Pkg.UpdateRegion(:p_regionID,:p_name,:p_cursor);
|
||||||
END;`, {
|
END;`, {
|
||||||
p_regionID: {
|
p_regionID: {
|
||||||
val: p_regionID,
|
val: body.p_regionID,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER
|
||||||
},
|
},
|
||||||
p_name: {
|
p_name: {
|
||||||
val: p_name,
|
val: body.p_name,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_cursor: {
|
p_cursor: {
|
||||||
@ -86,7 +87,7 @@ export class RegionService {
|
|||||||
return fres
|
return fres
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching users: ', err);
|
|
||||||
return { error: err.message }
|
return { error: err.message }
|
||||||
} finally { }
|
} finally { }
|
||||||
}
|
}
|
||||||
@ -102,11 +103,6 @@ export class RegionService {
|
|||||||
console.log("DB ERROR: ", err);
|
console.log("DB ERROR: ", err);
|
||||||
return { error: "Error while connecting to DB" }
|
return { error: "Error while connecting to DB" }
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (!connection) {
|
|
||||||
// throw new Error('No DB Connected')
|
|
||||||
// }
|
|
||||||
|
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
`BEGIN
|
`BEGIN
|
||||||
USCIB_Managed_Pkg.GetRegions(:p_cursor);
|
USCIB_Managed_Pkg.GetRegions(:p_cursor);
|
||||||
@ -123,17 +119,14 @@ export class RegionService {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (result.outBinds && result.outBinds.p_cursor) {
|
if (result.outBinds && result.outBinds.p_cursor) {
|
||||||
const cursor = result.outBinds.p_cursor; // The OUT cursor
|
const cursor = result.outBinds.p_cursor;
|
||||||
let rowsBatch;
|
let rowsBatch;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
rowsBatch = await cursor.getRows(100); // Fetch 100 rows at a time
|
rowsBatch = await cursor.getRows(100);
|
||||||
rows = rows.concat(rowsBatch); // Append fetched rows to the main array
|
rows = rows.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
console.log('Rows fetched:', rows);
|
|
||||||
|
|
||||||
// Close the cursor after you're done
|
|
||||||
await cursor.close();
|
await cursor.close();
|
||||||
} else {
|
} else {
|
||||||
throw new Error('No cursor returned from the stored procedure');
|
throw new Error('No cursor returned from the stored procedure');
|
||||||
@ -142,7 +135,7 @@ export class RegionService {
|
|||||||
return rows;
|
return rows;
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching users: ', err);
|
|
||||||
return { error: err.message }
|
return { error: err.message }
|
||||||
} finally { }
|
} finally { }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { SpContactsService } from './sp-contacts.service';
|
import { SpContactsService } from './sp-contacts.service';
|
||||||
import { Body, Controller, Get, Param, ParseIntPipe, Post, Put } from '@nestjs/common';
|
import { Body, Controller, Get, Param, ParseIntPipe, Post, Put, Query } from '@nestjs/common';
|
||||||
import { InsertSPContactsDTO, UpdateSPContactsDTO } from './sp-contacts.dto';
|
import { getSPDefaultcontactDTO, inactivateSPContactDTO, InsertSPContactsDTO, setSPDefaultcontactDTO, UpdateSPContactsDTO } from './sp-contacts.dto';
|
||||||
import { ApiTags } from '@nestjs/swagger';
|
import { ApiTags } from '@nestjs/swagger';
|
||||||
|
|
||||||
@Controller('oracle')
|
@Controller('oracle')
|
||||||
@ -13,54 +13,31 @@ export class SpContactsController {
|
|||||||
@ApiTags('SPContacts - Oracle')
|
@ApiTags('SPContacts - Oracle')
|
||||||
@Post('/InsertSPContacts')
|
@Post('/InsertSPContacts')
|
||||||
insertSPContacts(@Body() body: InsertSPContactsDTO) {
|
insertSPContacts(@Body() body: InsertSPContactsDTO) {
|
||||||
return this.spContactsService.insertSPContacts(
|
return this.spContactsService.insertSPContacts(body)
|
||||||
body.p_spid,
|
|
||||||
body.p_defcontactflag,
|
|
||||||
body.p_firstname,
|
|
||||||
body.p_lastname,
|
|
||||||
body.P_MIDDLEINITIAL,
|
|
||||||
body.p_title,
|
|
||||||
body.p_phoneno,
|
|
||||||
body.p_mobileno,
|
|
||||||
body.p_faxno,
|
|
||||||
body.p_emailaddress,
|
|
||||||
body.p_user_id
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('SPContacts - Oracle')
|
@ApiTags('SPContacts - Oracle')
|
||||||
@Post('/SetSPDefaultcontact/:id')
|
@Post('/SetSPDefaultcontact')
|
||||||
setSPDefaultcontact(@Param('id', ParseIntPipe) id: number) {
|
setSPDefaultcontact(@Query() body:setSPDefaultcontactDTO) {
|
||||||
return this.spContactsService.setSPDefaultcontact(id)
|
return this.spContactsService.setSPDefaultcontact(body)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('SPContacts - Oracle')
|
@ApiTags('SPContacts - Oracle')
|
||||||
@Put('/UpdateSPContacts')
|
@Put('/UpdateSPContacts')
|
||||||
updateSPContacts(@Body() body: UpdateSPContactsDTO) {
|
updateSPContacts(@Body() body: UpdateSPContactsDTO) {
|
||||||
return this.spContactsService.updateSPContacts(
|
return this.spContactsService.updateSPContacts(body)
|
||||||
body.p_spcontactid,
|
|
||||||
body.p_firstname,
|
|
||||||
body.p_lastname,
|
|
||||||
body.P_MIDDLEINITIAL,
|
|
||||||
body.p_title,
|
|
||||||
body.p_phoneno,
|
|
||||||
body.p_mobileno,
|
|
||||||
body.p_faxno,
|
|
||||||
body.p_emailaddress,
|
|
||||||
body.p_user_id
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('SPContacts - Oracle')
|
@ApiTags('SPContacts - Oracle')
|
||||||
@Post('/InactivateSPContact/:id')
|
@Post('/InactivateSPContact')
|
||||||
inactivateSPContact(@Param('id', ParseIntPipe) id: number) {
|
inactivateSPContact(@Query() body:inactivateSPContactDTO) {
|
||||||
return this.spContactsService.inactivateSPContact(id)
|
return this.spContactsService.inactivateSPContact(body)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('SPContacts - Oracle')
|
@ApiTags('SPContacts - Oracle')
|
||||||
@Get('/GetSPDefaultcontact/:id')
|
@Get('/GetSPDefaultcontact')
|
||||||
getSPDefaultcontact(@Param('id', ParseIntPipe) id: number) {
|
getSPDefaultcontact(@Query() body:getSPDefaultcontactDTO) {
|
||||||
return this.spContactsService.getSPDefaultcontacts(id)
|
return this.spContactsService.getSPDefaultcontacts(body)
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Get('/GetAllSPcontacts')
|
// @Get('/GetAllSPcontacts')
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import { ApiProperty } from '@nestjs/swagger';
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
import { IsEmail, IsNumber, IsString } from 'class-validator';
|
import { Transform } from 'class-transformer';
|
||||||
|
import { IsDefined, IsEmail, IsInt, IsNumber, IsString, Min } from 'class-validator';
|
||||||
|
|
||||||
export class InsertSPContactsDTO {
|
export class InsertSPContactsDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@ -88,3 +89,24 @@ export class UpdateSPContactsDTO {
|
|||||||
@IsString()
|
@IsString()
|
||||||
p_user_id: string;
|
p_user_id: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class setSPDefaultcontactDTO{
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@Min(0, { message: "Property p_spcontactid must be at least 0" })
|
||||||
|
@IsInt({ message: "Property p_SPid must be a whole number" })
|
||||||
|
@Transform(({ value }) => Number(value))
|
||||||
|
@IsNumber({}, { message: "Property p_spcontactid must be a number" })
|
||||||
|
@IsDefined({ message: "Property p_spcontactid is required" })
|
||||||
|
p_spcontactid:number;
|
||||||
|
}
|
||||||
|
export class inactivateSPContactDTO extends setSPDefaultcontactDTO{}
|
||||||
|
|
||||||
|
export class getSPDefaultcontactDTO {
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@Min(0, { message: "Property p_SPid must be at least 0" })
|
||||||
|
@IsInt({ message: "Property p_SPid must be a whole number" })
|
||||||
|
@Transform(({ value }) => Number(value))
|
||||||
|
@IsNumber({}, { message: "Property p_SPid must be a number" })
|
||||||
|
@IsDefined({ message: "Property p_SPid is required" })
|
||||||
|
p_SPid:number;
|
||||||
|
}
|
||||||
@ -1,29 +1,23 @@
|
|||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { OracleDBService } from 'src/db/db.service';
|
import { OracleDBService } from 'src/db/db.service';
|
||||||
import * as oracledb from 'oracledb'
|
import * as oracledb from 'oracledb'
|
||||||
|
import {
|
||||||
|
getSPDefaultcontactDTO,
|
||||||
|
inactivateSPContactDTO,
|
||||||
|
InsertSPContactsDTO,
|
||||||
|
setSPDefaultcontactDTO,
|
||||||
|
UpdateSPContactsDTO
|
||||||
|
} from './sp-contacts.dto';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class SpContactsService {
|
export class SpContactsService {
|
||||||
|
|
||||||
constructor(private readonly oracleDBService: OracleDBService) { }
|
constructor(private readonly oracleDBService: OracleDBService) { }
|
||||||
|
|
||||||
|
async insertSPContacts(body: InsertSPContactsDTO) {
|
||||||
async insertSPContacts(
|
|
||||||
p_spid: number,
|
|
||||||
p_defcontactflag: string,
|
|
||||||
p_firstname: string,
|
|
||||||
p_lastname: string,
|
|
||||||
P_MIDDLEINITIAL: string,
|
|
||||||
p_title: string,
|
|
||||||
p_phoneno: string,
|
|
||||||
p_mobileno: string,
|
|
||||||
p_faxno: string,
|
|
||||||
p_emailaddress: string,
|
|
||||||
p_user_id: string
|
|
||||||
) {
|
|
||||||
let connection;
|
let connection;
|
||||||
try {
|
try {
|
||||||
// Connect to the Oracle database using oracledb
|
|
||||||
connection = await this.oracleDBService.getConnection()
|
connection = await this.oracleDBService.getConnection()
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected')
|
||||||
@ -46,47 +40,47 @@ export class SpContactsService {
|
|||||||
:p_cursor);
|
:p_cursor);
|
||||||
END;`, {
|
END;`, {
|
||||||
p_spid: {
|
p_spid: {
|
||||||
val: p_spid,
|
val: body.p_spid,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER
|
||||||
},
|
},
|
||||||
p_defcontactflag: {
|
p_defcontactflag: {
|
||||||
val: p_defcontactflag,
|
val: body.p_defcontactflag,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_firstname: {
|
p_firstname: {
|
||||||
val: p_firstname,
|
val: body.p_firstname,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_lastname: {
|
p_lastname: {
|
||||||
val: p_lastname,
|
val: body.p_lastname,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
P_MIDDLEINITIAL: {
|
P_MIDDLEINITIAL: {
|
||||||
val: P_MIDDLEINITIAL,
|
val: body.P_MIDDLEINITIAL,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_title: {
|
p_title: {
|
||||||
val: p_title,
|
val: body.p_title,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_phoneno: {
|
p_phoneno: {
|
||||||
val: p_phoneno,
|
val: body.p_phoneno,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_mobileno: {
|
p_mobileno: {
|
||||||
val: p_mobileno,
|
val: body.p_mobileno,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_faxno: {
|
p_faxno: {
|
||||||
val: p_faxno,
|
val: body.p_faxno,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_emailaddress: {
|
p_emailaddress: {
|
||||||
val: p_emailaddress,
|
val: body.p_emailaddress,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_user_id: {
|
p_user_id: {
|
||||||
val: p_user_id,
|
val: body.p_user_id,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_cursor: {
|
p_cursor: {
|
||||||
@ -105,16 +99,16 @@ export class SpContactsService {
|
|||||||
return fres
|
return fres
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching users: ', err);
|
|
||||||
return { error: err.message }
|
return { error: err.message }
|
||||||
} finally { }
|
} finally { }
|
||||||
}
|
}
|
||||||
|
|
||||||
async setSPDefaultcontact(p_spcontactid: number) {
|
async setSPDefaultcontact(body: setSPDefaultcontactDTO) {
|
||||||
|
|
||||||
let connection;
|
let connection;
|
||||||
try {
|
try {
|
||||||
// Connect to the Oracle database using oracledb
|
|
||||||
connection = await this.oracleDBService.getConnection()
|
connection = await this.oracleDBService.getConnection()
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected')
|
||||||
@ -126,7 +120,7 @@ export class SpContactsService {
|
|||||||
END;`,
|
END;`,
|
||||||
{
|
{
|
||||||
p_spcontactid: {
|
p_spcontactid: {
|
||||||
val: p_spcontactid,
|
val: body.p_spcontactid,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -137,27 +131,16 @@ export class SpContactsService {
|
|||||||
return "SP executed successfully"
|
return "SP executed successfully"
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching users: ', err);
|
|
||||||
return { error: err.message }
|
return { error: err.message }
|
||||||
} finally { }
|
} finally { }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateSPContacts(
|
async updateSPContacts(body: UpdateSPContactsDTO) {
|
||||||
p_spcontactid: number,
|
|
||||||
p_firstname: string,
|
|
||||||
p_lastname: string,
|
|
||||||
P_MIDDLEINITIAL: string,
|
|
||||||
p_title: string,
|
|
||||||
p_phoneno: string,
|
|
||||||
p_mobileno: string,
|
|
||||||
p_faxno: string,
|
|
||||||
p_emailaddress: string,
|
|
||||||
p_user_id: string,
|
|
||||||
) {
|
|
||||||
let connection;
|
let connection;
|
||||||
try {
|
try {
|
||||||
// Connect to the Oracle database using oracledb
|
|
||||||
connection = await this.oracleDBService.getConnection()
|
connection = await this.oracleDBService.getConnection()
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected')
|
||||||
@ -179,43 +162,43 @@ export class SpContactsService {
|
|||||||
:p_cursor);
|
:p_cursor);
|
||||||
END;`, {
|
END;`, {
|
||||||
p_spcontactid: {
|
p_spcontactid: {
|
||||||
val: p_spcontactid,
|
val: body.p_spcontactid,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER
|
||||||
},
|
},
|
||||||
p_firstname: {
|
p_firstname: {
|
||||||
val: p_firstname,
|
val: body.p_firstname,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_lastname: {
|
p_lastname: {
|
||||||
val: p_lastname,
|
val: body.p_lastname,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
P_MIDDLEINITIAL: {
|
P_MIDDLEINITIAL: {
|
||||||
val: P_MIDDLEINITIAL,
|
val: body.P_MIDDLEINITIAL,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_title: {
|
p_title: {
|
||||||
val: p_title,
|
val: body.p_title,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_phoneno: {
|
p_phoneno: {
|
||||||
val: p_phoneno,
|
val: body.p_phoneno,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_mobileno: {
|
p_mobileno: {
|
||||||
val: p_mobileno,
|
val: body.p_mobileno,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_faxno: {
|
p_faxno: {
|
||||||
val: p_faxno,
|
val: body.p_faxno,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_emailaddress: {
|
p_emailaddress: {
|
||||||
val: p_emailaddress,
|
val: body.p_emailaddress,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_user_id: {
|
p_user_id: {
|
||||||
val: p_user_id,
|
val: body.p_user_id,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_cursor: {
|
p_cursor: {
|
||||||
@ -234,16 +217,16 @@ export class SpContactsService {
|
|||||||
return fres
|
return fres
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching users: ', err);
|
|
||||||
return { error: err.message }
|
return { error: err.message }
|
||||||
} finally { }
|
} finally { }
|
||||||
}
|
}
|
||||||
|
|
||||||
async inactivateSPContact(p_spcontactid: number) {
|
async inactivateSPContact(body: inactivateSPContactDTO) {
|
||||||
|
|
||||||
let connection;
|
let connection;
|
||||||
try {
|
try {
|
||||||
// Connect to the Oracle database using oracledb
|
|
||||||
connection = await this.oracleDBService.getConnection()
|
connection = await this.oracleDBService.getConnection()
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected')
|
||||||
@ -254,7 +237,7 @@ export class SpContactsService {
|
|||||||
USCIB_Managed_Pkg.InActivateSPContacts(:p_spcontactid);
|
USCIB_Managed_Pkg.InActivateSPContacts(:p_spcontactid);
|
||||||
END;`, {
|
END;`, {
|
||||||
p_spcontactid: {
|
p_spcontactid: {
|
||||||
val: p_spcontactid,
|
val: body.p_spcontactid,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -265,18 +248,18 @@ export class SpContactsService {
|
|||||||
return "SP executed successfully"
|
return "SP executed successfully"
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching users: ', err);
|
|
||||||
return { error: err.message }
|
return { error: err.message }
|
||||||
} finally { }
|
} finally { }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async getSPDefaultcontacts(p_SPid: number) {
|
async getSPDefaultcontacts(body: getSPDefaultcontactDTO) {
|
||||||
|
|
||||||
let connection;
|
let connection;
|
||||||
let rows = [];
|
let rows = [];
|
||||||
try {
|
try {
|
||||||
// Connect to the Oracle database using oracledb
|
|
||||||
connection = await this.oracleDBService.getConnection()
|
connection = await this.oracleDBService.getConnection()
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected')
|
||||||
@ -288,7 +271,7 @@ export class SpContactsService {
|
|||||||
END;`,
|
END;`,
|
||||||
{
|
{
|
||||||
p_SPid: {
|
p_SPid: {
|
||||||
val: p_SPid,
|
val: body.p_SPid,
|
||||||
type: oracledb.DB_TYPE_NUMBER,
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
p_cursor: {
|
p_cursor: {
|
||||||
@ -302,15 +285,15 @@ export class SpContactsService {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (result.outBinds && result.outBinds.p_cursor) {
|
if (result.outBinds && result.outBinds.p_cursor) {
|
||||||
const cursor = result.outBinds.p_cursor; // The OUT cursor
|
const cursor = result.outBinds.p_cursor;
|
||||||
let rowsBatch;
|
let rowsBatch;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
rowsBatch = await cursor.getRows(100); // Fetch 100 rows at a time
|
rowsBatch = await cursor.getRows(100);
|
||||||
rows = rows.concat(rowsBatch); // Append fetched rows to the main array
|
rows = rows.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
// Close the cursor after you're done
|
|
||||||
await cursor.close();
|
await cursor.close();
|
||||||
} else {
|
} else {
|
||||||
throw new Error('No cursor returned from the stored procedure');
|
throw new Error('No cursor returned from the stored procedure');
|
||||||
@ -319,7 +302,7 @@ export class SpContactsService {
|
|||||||
return rows;
|
return rows;
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching users: ', err);
|
|
||||||
return { error: err.message }
|
return { error: err.message }
|
||||||
} finally { }
|
} finally { }
|
||||||
|
|
||||||
@ -329,7 +312,7 @@ export class SpContactsService {
|
|||||||
let connection;
|
let connection;
|
||||||
let rows = [];
|
let rows = [];
|
||||||
try {
|
try {
|
||||||
// Connect to the Oracle database using oracledb
|
|
||||||
connection = await this.oracleDBService.getConnection()
|
connection = await this.oracleDBService.getConnection()
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected')
|
||||||
@ -351,17 +334,17 @@ export class SpContactsService {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (result.outBinds && result.outBinds.p_cursor) {
|
if (result.outBinds && result.outBinds.p_cursor) {
|
||||||
const cursor = result.outBinds.p_cursor; // The OUT cursor
|
const cursor = result.outBinds.p_cursor;
|
||||||
let rowsBatch;
|
let rowsBatch;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
rowsBatch = await cursor.getRows(100); // Fetch 100 rows at a time
|
rowsBatch = await cursor.getRows(100);
|
||||||
rows = rows.concat(rowsBatch); // Append fetched rows to the main array
|
rows = rows.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
console.log('Rows fetched:', rows);
|
|
||||||
|
|
||||||
// Close the cursor after you're done
|
|
||||||
|
|
||||||
await cursor.close();
|
await cursor.close();
|
||||||
} else {
|
} else {
|
||||||
throw new Error('No cursor returned from the stored procedure');
|
throw new Error('No cursor returned from the stored procedure');
|
||||||
@ -370,7 +353,7 @@ export class SpContactsService {
|
|||||||
return rows;
|
return rows;
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching users: ', err);
|
|
||||||
return { error: err.message }
|
return { error: err.message }
|
||||||
} finally { }
|
} finally { }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { Body, Controller, Get, Param, ParseIntPipe, Post, Put } from '@nestjs/common';
|
import { Body, Controller, Get, Param, ParseIntPipe, Post, Put, Query } from '@nestjs/common';
|
||||||
import { SpService } from './sp.service';
|
import { SpService } from './sp.service';
|
||||||
import { ApiTags } from '@nestjs/swagger';
|
import { ApiTags } from '@nestjs/swagger';
|
||||||
import { InsertNewServiceProviderDTO, UpdateServiceProviderDTO } from './sp.dto';
|
import { getSelectedServiceproviderDTO, InsertNewServiceProviderDTO, UpdateServiceProviderDTO } from './sp.dto';
|
||||||
|
|
||||||
@Controller('oracle')
|
@Controller('oracle')
|
||||||
export class SpController {
|
export class SpController {
|
||||||
@ -13,48 +13,13 @@ export class SpController {
|
|||||||
@ApiTags('SP - Oracle')
|
@ApiTags('SP - Oracle')
|
||||||
@Post('/InsertNewServiceProvider')
|
@Post('/InsertNewServiceProvider')
|
||||||
insertNewServiceProvider(@Body() body: InsertNewServiceProviderDTO) {
|
insertNewServiceProvider(@Body() body: InsertNewServiceProviderDTO) {
|
||||||
return this.spService.insertNewServiceProvider(
|
return this.spService.insertNewServiceProvider(body)
|
||||||
body.p_name,
|
|
||||||
body.p_lookupcode,
|
|
||||||
body.p_address1,
|
|
||||||
body.p_address2,
|
|
||||||
body.p_city,
|
|
||||||
body.p_state,
|
|
||||||
body.p_zip,
|
|
||||||
body.p_country,
|
|
||||||
body.p_issuingregion,
|
|
||||||
body.p_replacementregion,
|
|
||||||
body.p_bondsurety,
|
|
||||||
body.p_cargopolicyno,
|
|
||||||
body.p_cargosurety,
|
|
||||||
body.p_user_id,
|
|
||||||
body.P_NOTES,
|
|
||||||
body.P_FILEIDS
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('SP - Oracle')
|
@ApiTags('SP - Oracle')
|
||||||
@Put('/UpdateServiceProvider')
|
@Put('/UpdateServiceProvider')
|
||||||
updateServiceProider(@Body() body: UpdateServiceProviderDTO) {
|
updateServiceProider(@Body() body: UpdateServiceProviderDTO) {
|
||||||
return this.spService.updateServiceProvider(
|
return this.spService.updateServiceProvider(body)
|
||||||
body.p_spid,
|
|
||||||
body.p_name,
|
|
||||||
body.p_lookupcode,
|
|
||||||
body.p_address1,
|
|
||||||
body.p_address2,
|
|
||||||
body.p_city,
|
|
||||||
body.p_state,
|
|
||||||
body.p_zip,
|
|
||||||
body.p_country,
|
|
||||||
body.p_issuingregion,
|
|
||||||
body.p_replacementregion,
|
|
||||||
body.p_bondsurety,
|
|
||||||
body.p_cargopolicyno,
|
|
||||||
body.p_cargosurety,
|
|
||||||
body.p_user_id,
|
|
||||||
body.P_NOTES,
|
|
||||||
body.P_FILEIDS
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('SP - Oracle')
|
@ApiTags('SP - Oracle')
|
||||||
@ -64,8 +29,8 @@ export class SpController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('SP - Oracle')
|
@ApiTags('SP - Oracle')
|
||||||
@Get('/GetSelectedServiceprovider/:id')
|
@Get('/GetSelectedServiceprovider')
|
||||||
getSelectedServiceprovider(@Param('id', ParseIntPipe) id: number) {
|
getSelectedServiceprovider(@Query() body:getSelectedServiceproviderDTO) {
|
||||||
return this.spService.getServiceproviderByID(id);
|
return this.spService.getServiceproviderByID(body);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,144 +1,183 @@
|
|||||||
import { ApiProperty } from '@nestjs/swagger';
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
import { IsNumber, IsString } from 'class-validator';
|
import { Transform } from 'class-transformer';
|
||||||
|
import { IsDefined, IsInt, IsNumber, IsOptional, IsString, Min } from 'class-validator';
|
||||||
|
|
||||||
export class InsertNewServiceProviderDTO {
|
export class InsertNewServiceProviderDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString({ message: "Property p_name must be a string" })
|
||||||
|
@IsDefined({ message: "Property p_name is required" })
|
||||||
p_name: string;
|
p_name: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString({ message: "Property p_lookupcode must be a string" })
|
||||||
|
@IsDefined({ message: "Property p_lookupcode is required" })
|
||||||
p_lookupcode: string;
|
p_lookupcode: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString({ message: "Property p_address1 must be a string" })
|
||||||
|
@IsDefined({ message: "Property p_address1 is required" })
|
||||||
p_address1: string;
|
p_address1: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@IsString()
|
@IsString({ message: "Property p_address2 must be a string" })
|
||||||
p_address2: string;
|
@IsOptional()
|
||||||
|
p_address2?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString({ message: "Property p_city must be a string" })
|
||||||
|
@IsDefined({ message: "Property p_city is required" })
|
||||||
p_city: string;
|
p_city: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString({ message: "Property p_state must be a string" })
|
||||||
|
@IsDefined({ message: "Property p_state is required" })
|
||||||
p_state: string;
|
p_state: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString({ message: "Property p_zip must be a string" })
|
||||||
|
@IsDefined({ message: "Property p_zip is required" })
|
||||||
p_zip: string;
|
p_zip: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString({ message: "Property p_country must be a string" })
|
||||||
|
@IsDefined({ message: "Property p_country is required" })
|
||||||
p_country: string;
|
p_country: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString({ message: "Property p_issuingregion must be a string" })
|
||||||
|
@IsDefined({ message: "Property p_issuingregion is required" })
|
||||||
p_issuingregion: string;
|
p_issuingregion: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString({ message: "Property p_replacementregion must be a string" })
|
||||||
|
@IsDefined({ message: "Property p_replacementregion is required" })
|
||||||
p_replacementregion: string;
|
p_replacementregion: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString({ message: "Property p_bondsurety must be a string" })
|
||||||
|
@IsDefined({ message: "Property p_bondsurety is required" })
|
||||||
p_bondsurety: string;
|
p_bondsurety: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString({ message: "Property p_cargopolicyno must be a string" })
|
||||||
|
@IsDefined({ message: "Property p_cargopolicyno is required" })
|
||||||
p_cargopolicyno: string;
|
p_cargopolicyno: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString({ message: "Property p_cargosurety must be a string" })
|
||||||
|
@IsDefined({ message: "Property p_cargosurety is required" })
|
||||||
p_cargosurety: string;
|
p_cargosurety: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString({ message: "Property p_user_id must be a string" })
|
||||||
|
@IsDefined({ message: "Property p_user_id is required" })
|
||||||
p_user_id: string;
|
p_user_id: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@IsString()
|
@IsString({ message: "Property P_NOTES must be a string" })
|
||||||
P_NOTES: string;
|
@IsOptional()
|
||||||
|
P_NOTES?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@IsString()
|
@IsString({ message: "Property P_FILEIDS must be a string" })
|
||||||
P_FILEIDS: string;
|
@IsOptional()
|
||||||
|
P_FILEIDS?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class UpdateServiceProviderDTO {
|
export class UpdateServiceProviderDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber({}, { message: "Property p_spid must be a number" })
|
||||||
|
@IsDefined({ message: "Property p_spid is required" })
|
||||||
p_spid: number;
|
p_spid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString({ message: "Property p_name must be a string" })
|
||||||
|
@IsDefined({ message: "Property p_name is required" })
|
||||||
p_name: string;
|
p_name: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString({ message: "Property p_lookupcode must be a string" })
|
||||||
|
@IsDefined({ message: "Property p_lookupcode is required" })
|
||||||
p_lookupcode: string;
|
p_lookupcode: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString({ message: "Property p_address1 must be a string" })
|
||||||
|
@IsDefined({ message: "Property p_address1 is required" })
|
||||||
p_address1: string;
|
p_address1: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@IsString()
|
@IsString({ message: "Property p_address2 must be a string" })
|
||||||
p_address2: string;
|
@IsOptional()
|
||||||
|
p_address2?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString({ message: "Property p_city must be a string" })
|
||||||
|
@IsDefined({ message: "Property p_city is required" })
|
||||||
p_city: string;
|
p_city: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString({ message: "Property p_state must be a string" })
|
||||||
|
@IsDefined({ message: "Property p_state is required" })
|
||||||
p_state: string;
|
p_state: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString({ message: "Property p_zip must be a string" })
|
||||||
|
@IsDefined({ message: "Property p_zip is required" })
|
||||||
p_zip: string;
|
p_zip: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString({ message: "Property p_country must be a string" })
|
||||||
|
@IsDefined({ message: "Property p_country is required" })
|
||||||
p_country: string;
|
p_country: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString({ message: "Property p_issuingregion must be a string" })
|
||||||
|
@IsDefined({ message: "Property p_issuingregion is required" })
|
||||||
p_issuingregion: string;
|
p_issuingregion: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString({ message: "Property p_replacementregion must be a string" })
|
||||||
|
@IsDefined({ message: "Property p_replacementregion is required" })
|
||||||
p_replacementregion: string;
|
p_replacementregion: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString({ message: "Property p_bondsurety must be a string" })
|
||||||
|
@IsDefined({ message: "Property p_bondsurety is required" })
|
||||||
p_bondsurety: string;
|
p_bondsurety: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString({ message: "Property p_cargopolicyno must be a string" })
|
||||||
|
@IsDefined({ message: "Property p_cargopolicyno is required" })
|
||||||
p_cargopolicyno: string;
|
p_cargopolicyno: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString({ message: "Property p_cargosurety must be a string" })
|
||||||
|
@IsDefined({ message: "Property p_cargosurety is required" })
|
||||||
p_cargosurety: string;
|
p_cargosurety: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString({ message: "Property p_user_id must be a string" })
|
||||||
|
@IsDefined({ message: "Property p_user_id is required" })
|
||||||
p_user_id: string;
|
p_user_id: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@IsString()
|
@IsString({ message: "Property P_NOTES must be a string" })
|
||||||
P_NOTES: string;
|
@IsOptional()
|
||||||
|
P_NOTES?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@IsString()
|
@IsString({ message: "Property P_FILEIDS must be a string" })
|
||||||
P_FILEIDS: string;
|
@IsOptional()
|
||||||
|
P_FILEIDS?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
// export class GetSPcontactsDTO {
|
export class getSelectedServiceproviderDTO{
|
||||||
// @IsNumber()
|
@ApiProperty({ required: true })
|
||||||
// p_SPid: number;
|
@Min(0, { message: "Property p_spid must be at least 0" })
|
||||||
// }
|
@IsInt({ message: "Property p_SPid must be a whole number" })
|
||||||
|
@Transform(({ value }) => Number(value))
|
||||||
|
@IsNumber({}, { message: "Property p_spid must be a number" })
|
||||||
|
@IsDefined({ message: "Property p_spid is required" })
|
||||||
|
p_spid:number;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,8 @@
|
|||||||
import { Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { SpController } from './sp.controller';
|
import { SpController } from './sp.controller';
|
||||||
import { SpService } from './sp.service';
|
import { SpService } from './sp.service';
|
||||||
import { DbModule } from 'src/db/db.module';
|
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports:[DbModule],
|
|
||||||
controllers: [SpController],
|
controllers: [SpController],
|
||||||
providers: [SpService]
|
providers: [SpService]
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,34 +1,18 @@
|
|||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { OracleDBService } from 'src/db/db.service';
|
import { OracleDBService } from 'src/db/db.service';
|
||||||
import * as oracledb from 'oracledb'
|
import * as oracledb from 'oracledb'
|
||||||
|
import { getSelectedServiceproviderDTO, InsertNewServiceProviderDTO, UpdateServiceProviderDTO } from './sp.dto';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class SpService {
|
export class SpService {
|
||||||
|
|
||||||
constructor(private readonly oracleDBService: OracleDBService) { }
|
constructor(private readonly oracleDBService: OracleDBService) { }
|
||||||
|
|
||||||
async insertNewServiceProvider(
|
async insertNewServiceProvider(body: InsertNewServiceProviderDTO) {
|
||||||
p_name: String,
|
|
||||||
p_lookupcode: String,
|
|
||||||
p_address1: String,
|
|
||||||
p_address2: String,
|
|
||||||
p_city: String,
|
|
||||||
p_state: String,
|
|
||||||
p_zip: String,
|
|
||||||
p_country: String,
|
|
||||||
p_issuingregion: String,
|
|
||||||
p_replacementregion: String,
|
|
||||||
p_bondsurety: String,
|
|
||||||
p_cargopolicyno: String,
|
|
||||||
p_cargosurety: String,
|
|
||||||
p_user_id: String,
|
|
||||||
P_NOTES: string,
|
|
||||||
P_FILEIDS: string
|
|
||||||
) {
|
|
||||||
|
|
||||||
let connection;
|
let connection;
|
||||||
try {
|
try {
|
||||||
// Connect to the Oracle database using oracledb
|
|
||||||
connection = await this.oracleDBService.getConnection()
|
connection = await this.oracleDBService.getConnection()
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected')
|
||||||
@ -56,67 +40,67 @@ export class SpService {
|
|||||||
:p_cursor);
|
:p_cursor);
|
||||||
END;`, {
|
END;`, {
|
||||||
p_name: {
|
p_name: {
|
||||||
val: p_name,
|
val: body.p_name,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_lookupcode: {
|
p_lookupcode: {
|
||||||
val: p_lookupcode,
|
val: body.p_lookupcode,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_address1: {
|
p_address1: {
|
||||||
val: p_address1,
|
val: body.p_address1,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_address2: {
|
p_address2: {
|
||||||
val: p_address2,
|
val: body.p_address2,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_city: {
|
p_city: {
|
||||||
val: p_city,
|
val: body.p_city,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_state: {
|
p_state: {
|
||||||
val: p_state,
|
val: body.p_state,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_zip: {
|
p_zip: {
|
||||||
val: p_zip,
|
val: body.p_zip,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_country: {
|
p_country: {
|
||||||
val: p_country,
|
val: body.p_country,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_issuingregion: {
|
p_issuingregion: {
|
||||||
val: p_issuingregion,
|
val: body.p_issuingregion,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_replacementregion: {
|
p_replacementregion: {
|
||||||
val: p_replacementregion,
|
val: body.p_replacementregion,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_bondsurety: {
|
p_bondsurety: {
|
||||||
val: p_bondsurety,
|
val: body.p_bondsurety,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_cargopolicyno: {
|
p_cargopolicyno: {
|
||||||
val: p_cargopolicyno,
|
val: body.p_cargopolicyno,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_cargosurety: {
|
p_cargosurety: {
|
||||||
val: p_cargosurety,
|
val: body.p_cargosurety,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_user_id: {
|
p_user_id: {
|
||||||
val: p_user_id,
|
val: body.p_user_id,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
P_NOTES: {
|
P_NOTES: {
|
||||||
val: P_NOTES,
|
val: body.P_NOTES,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
P_FILEIDS: {
|
P_FILEIDS: {
|
||||||
val: P_FILEIDS,
|
val: body.P_FILEIDS,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -135,35 +119,17 @@ export class SpService {
|
|||||||
return fres
|
return fres
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching users: ', err);
|
|
||||||
return { error: err.message }
|
return { error: err.message }
|
||||||
} finally { }
|
} finally { }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateServiceProvider(
|
async updateServiceProvider(body: UpdateServiceProviderDTO) {
|
||||||
p_spid: Number,
|
|
||||||
p_name: String,
|
|
||||||
p_lookupcode: String,
|
|
||||||
p_address1: String,
|
|
||||||
p_address2: String,
|
|
||||||
p_city: String,
|
|
||||||
p_state: String,
|
|
||||||
p_zip: String,
|
|
||||||
p_country: String,
|
|
||||||
p_issuingregion: String,
|
|
||||||
p_replacementregion: String,
|
|
||||||
p_bondsurety: String,
|
|
||||||
p_cargopolicyno: String,
|
|
||||||
p_cargosurety: String,
|
|
||||||
p_user_id: String,
|
|
||||||
P_NOTES: string,
|
|
||||||
P_FILEIDS: string
|
|
||||||
) {
|
|
||||||
|
|
||||||
let connection;
|
let connection;
|
||||||
try {
|
try {
|
||||||
// Connect to the Oracle database using oracledb
|
|
||||||
connection = await this.oracleDBService.getConnection()
|
connection = await this.oracleDBService.getConnection()
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected')
|
||||||
@ -192,71 +158,71 @@ export class SpService {
|
|||||||
:p_cursor);
|
:p_cursor);
|
||||||
END;`, {
|
END;`, {
|
||||||
p_spid: {
|
p_spid: {
|
||||||
val: p_spid,
|
val: body.p_spid,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER
|
||||||
},
|
},
|
||||||
p_name: {
|
p_name: {
|
||||||
val: p_name,
|
val: body.p_name,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_lookupcode: {
|
p_lookupcode: {
|
||||||
val: p_lookupcode,
|
val: body.p_lookupcode,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_address1: {
|
p_address1: {
|
||||||
val: p_address1,
|
val: body.p_address1,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_address2: {
|
p_address2: {
|
||||||
val: p_address2,
|
val: body.p_address2,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_city: {
|
p_city: {
|
||||||
val: p_city,
|
val: body.p_city,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_state: {
|
p_state: {
|
||||||
val: p_state,
|
val: body.p_state,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_zip: {
|
p_zip: {
|
||||||
val: p_zip,
|
val: body.p_zip,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_country: {
|
p_country: {
|
||||||
val: p_country,
|
val: body.p_country,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_issuingregion: {
|
p_issuingregion: {
|
||||||
val: p_issuingregion,
|
val: body.p_issuingregion,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_replacementregion: {
|
p_replacementregion: {
|
||||||
val: p_replacementregion,
|
val: body.p_replacementregion,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_bondsurety: {
|
p_bondsurety: {
|
||||||
val: p_bondsurety,
|
val: body.p_bondsurety,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_cargopolicyno: {
|
p_cargopolicyno: {
|
||||||
val: p_cargopolicyno,
|
val: body.p_cargopolicyno,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_cargosurety: {
|
p_cargosurety: {
|
||||||
val: p_cargosurety,
|
val: body.p_cargosurety,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_user_id: {
|
p_user_id: {
|
||||||
val: p_user_id,
|
val: body.p_user_id,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
P_NOTES: {
|
P_NOTES: {
|
||||||
val: P_NOTES,
|
val: body.P_NOTES,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
P_FILEIDS: {
|
P_FILEIDS: {
|
||||||
val: P_FILEIDS,
|
val: body.P_FILEIDS,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR
|
||||||
},
|
},
|
||||||
p_cursor: {
|
p_cursor: {
|
||||||
@ -275,7 +241,7 @@ export class SpService {
|
|||||||
return fres
|
return fres
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching users: ', err);
|
|
||||||
return { error: err.message }
|
return { error: err.message }
|
||||||
} finally { }
|
} finally { }
|
||||||
|
|
||||||
@ -286,7 +252,7 @@ export class SpService {
|
|||||||
let connection;
|
let connection;
|
||||||
let rows = [];
|
let rows = [];
|
||||||
try {
|
try {
|
||||||
// Connect to the Oracle database using oracledb
|
|
||||||
connection = await this.oracleDBService.getConnection()
|
connection = await this.oracleDBService.getConnection()
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected')
|
||||||
@ -308,15 +274,15 @@ export class SpService {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (result.outBinds && result.outBinds.p_cursor) {
|
if (result.outBinds && result.outBinds.p_cursor) {
|
||||||
const cursor = result.outBinds.p_cursor; // The OUT cursor
|
const cursor = result.outBinds.p_cursor;
|
||||||
let rowsBatch;
|
let rowsBatch;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
rowsBatch = await cursor.getRows(100); // Fetch 100 rows at a time
|
rowsBatch = await cursor.getRows(100);
|
||||||
rows = rows.concat(rowsBatch); // Append fetched rows to the main array
|
rows = rows.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
// Close the cursor after you're done
|
|
||||||
await cursor.close();
|
await cursor.close();
|
||||||
|
|
||||||
return rows;
|
return rows;
|
||||||
@ -325,18 +291,18 @@ export class SpService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching users: ', err);
|
|
||||||
return { error: err.message }
|
return { error: err.message }
|
||||||
} finally { }
|
} finally { }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async getServiceproviderByID(p_spid: Number) {
|
async getServiceproviderByID(body:getSelectedServiceproviderDTO) {
|
||||||
|
|
||||||
let connection;
|
let connection;
|
||||||
let rows = [];
|
let rows = [];
|
||||||
try {
|
try {
|
||||||
// Connect to the Oracle database using oracledb
|
|
||||||
connection = await this.oracleDBService.getConnection()
|
connection = await this.oracleDBService.getConnection()
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected')
|
||||||
@ -348,7 +314,7 @@ export class SpService {
|
|||||||
END;`,
|
END;`,
|
||||||
{
|
{
|
||||||
p_spid: {
|
p_spid: {
|
||||||
val: p_spid,
|
val: body.p_spid,
|
||||||
type: oracledb.DB_TYPE_NUMBER,
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
p_cursor: {
|
p_cursor: {
|
||||||
@ -362,17 +328,14 @@ export class SpService {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (result.outBinds && result.outBinds.p_cursor) {
|
if (result.outBinds && result.outBinds.p_cursor) {
|
||||||
const cursor = result.outBinds.p_cursor; // The OUT cursor
|
const cursor = result.outBinds.p_cursor;
|
||||||
let rowsBatch;
|
let rowsBatch;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
rowsBatch = await cursor.getRows(100); // Fetch 100 rows at a time
|
rowsBatch = await cursor.getRows(100);
|
||||||
rows = rows.concat(rowsBatch); // Append fetched rows to the main array
|
rows = rows.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
console.log('Rows fetched:', rows);
|
|
||||||
|
|
||||||
// Close the cursor after you're done
|
|
||||||
await cursor.close();
|
await cursor.close();
|
||||||
} else {
|
} else {
|
||||||
throw new Error('No cursor returned from the stored procedure');
|
throw new Error('No cursor returned from the stored procedure');
|
||||||
@ -381,7 +344,7 @@ export class SpService {
|
|||||||
return rows;
|
return rows;
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching users: ', err);
|
|
||||||
return { error: err.message }
|
return { error: err.message }
|
||||||
} finally { }
|
} finally { }
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user