removed unused code

This commit is contained in:
Kallesh B S 2025-04-02 13:29:06 +05:30
parent 2f1fca47c8
commit cfa37000e9
47 changed files with 7313 additions and 6717 deletions

View File

@ -4,7 +4,7 @@ import { OracleModule } from './oracle/oracle.module';
import { AuthModule } from './auth/auth.module';
@Module({
imports: [ AuthModule, DbModule, OracleModule],
imports: [AuthModule, DbModule, OracleModule],
controllers: [],
providers: [],
})

View File

@ -5,12 +5,11 @@ import { AuthLoginDTO } from './auth.dto';
@Controller()
export class AuthController {
constructor(private readonly authService: AuthService) {}
constructor(private readonly authService:AuthService){}
@ApiTags('Auth')
@Post('/login')
login(@Body() body:AuthLoginDTO){
return this.authService.login(body);
}
@ApiTags('Auth')
@Post('/login')
login(@Body() body: AuthLoginDTO) {
return this.authService.login(body);
}
}

View File

@ -1,13 +1,12 @@
import { ApiProperty } from "@nestjs/swagger";
import { IsString } from "class-validator";
import { ApiProperty } from '@nestjs/swagger';
import { IsString } from 'class-validator';
export class AuthLoginDTO{
@ApiProperty({required:true})
@IsString()
p_emailaddr:string;
export class AuthLoginDTO {
@ApiProperty({ required: true })
@IsString()
p_emailaddr: string;
@ApiProperty({required:true})
@IsString()
p_password:string;
}
@ApiProperty({ required: true })
@IsString()
p_password: string;
}

View File

@ -1,12 +1,11 @@
import { Module } from '@nestjs/common';
import { AuthService } from './auth.service';
import { AuthController } from './auth.controller';
import { OracleDBService } from 'src/db/db.service';
import { DbModule } from 'src/db/db.module';
@Module({
imports:[DbModule],
imports: [DbModule],
providers: [AuthService],
controllers: [AuthController]
controllers: [AuthController],
})
export class AuthModule {}

View File

@ -1,70 +1,67 @@
import { BadRequestException, Injectable } from '@nestjs/common';
import { OracleDBService } from 'src/db/db.service';
import { AuthLoginDTO } from './auth.dto';
import * as oracledb from 'oracledb'
import * as oracledb from 'oracledb';
@Injectable()
export class AuthService {
constructor(private readonly oracleDBService: OracleDBService) {}
constructor(private readonly oracleDBService: OracleDBService) { }
async login(body: AuthLoginDTO) {
let connection;
let rows = [];
try {
connection = await this.oracleDBService.getConnection();
if (!connection) {
throw new Error('No DB Connected');
}
async login(body:AuthLoginDTO) {
let connection;
let rows = [];
let crows:any = [];
try {
connection = await this.oracleDBService.getConnection()
if (!connection) {
throw new Error('No DB Connected')
}
const result = await connection.execute(
`BEGIN
const result = await connection.execute(
`BEGIN
USERLOGIN_PKG.ValidateUser(:p_emailaddr,:p_password,:p_login_cursor);
END;`,
{
p_emailaddr: {
val: body.p_emailaddr,
type: oracledb.DB_TYPE_NVARCHAR
},
p_password: {
val: body.p_password,
type: oracledb.DB_TYPE_NVARCHAR
},
p_login_cursor: {
type: oracledb.CURSOR,
dir: oracledb.BIND_OUT
}
},
{
outFormat: oracledb.OUT_FORMAT_OBJECT
}
);
{
p_emailaddr: {
val: body.p_emailaddr,
type: oracledb.DB_TYPE_NVARCHAR,
},
p_password: {
val: body.p_password,
type: oracledb.DB_TYPE_NVARCHAR,
},
p_login_cursor: {
type: oracledb.CURSOR,
dir: oracledb.BIND_OUT,
},
},
{
outFormat: oracledb.OUT_FORMAT_OBJECT,
},
);
if (result.outBinds && result.outBinds.p_login_cursor) {
const cursor = result.outBinds.p_login_cursor;
let rowsBatch;
if (result.outBinds && result.outBinds.p_login_cursor) {
const cursor = result.outBinds.p_login_cursor;
let rowsBatch;
do {
rowsBatch = await cursor.getRows(100);
rows = rows.concat(rowsBatch);
} while (rowsBatch.length > 0);
await cursor.close();
} else {
return new BadRequestException({Error:"Error executing request try after some time!"});
}
if(rows[0]["ERRORMESG"]){
return {error:"Invalid username or password!"}
}
return {msg:"Logged in successfully"}
} catch (err) {
console.error('Error fetching users: ', err.message);
return {error:"Invalid username or password"}
} finally { }
do {
rowsBatch = await cursor.getRows(100);
rows = rows.concat(rowsBatch);
} while (rowsBatch.length > 0);
await cursor.close();
} else {
return new BadRequestException({
Error: 'Error executing request try after some time!',
});
}
if (rows[0]['ERRORMESG']) {
return { error: 'Invalid username or password!' };
}
return { msg: 'Logged in successfully' };
} catch (err) {
console.error('Error fetching users: ', err.message);
return { error: 'Invalid username or password' };
}
}
}

View File

@ -3,7 +3,7 @@ import { MssqlDBService, OracleDBService } from './db.service';
@Global()
@Module({
providers: [OracleDBService,MssqlDBService],
exports:[OracleDBService,MssqlDBService]
providers: [OracleDBService, MssqlDBService],
exports: [OracleDBService, MssqlDBService],
})
export class DbModule {}

View File

@ -1,62 +1,62 @@
import { MssqlConfig , OracleConfig} from 'ormconfig';
import { createPool, Pool, Connection as cob, } from 'oracledb';
import { MssqlConfig, OracleConfig } from 'ormconfig';
import { createPool, Pool, Connection as cob } from 'oracledb';
import { Connection, ConnectionPool } from 'mssql';
import { Global, Injectable } from '@nestjs/common';
import { Injectable } from '@nestjs/common';
@Injectable()
export class OracleDBService {
private pool: Pool;
private pool: Pool;
constructor() {
this.initializePool();
}
constructor() {
this.initializePool();
}
private async initializePool() {
this.pool = await createPool({
...OracleConfig,
poolMin: 1,
poolMax: 10,
poolIncrement: 1,
});
}
private async initializePool() {
this.pool = await createPool({
...OracleConfig,
poolMin: 1,
poolMax: 10,
poolIncrement: 1,
});
}
async getConnection(): Promise<cob> {
const connection = await this.pool.getConnection();
console.log('Database connection initialized successfully for oracle.');
return connection;
}
async getConnection(): Promise<cob> {
const connection = await this.pool.getConnection();
console.log('Database connection initialized successfully for oracle.');
return connection;
}
}
@Injectable()
export class MssqlDBService {
private pool: ConnectionPool;
private readonly config = {
...MssqlConfig,
server: "localhost",
pool: {
max: 10,
min: 0,
idleTimeoutMillis: 30000,
},
};
private pool: ConnectionPool;
private readonly config = {
...MssqlConfig,
server: 'localhost',
pool: {
max: 10,
min: 0,
idleTimeoutMillis: 30000,
},
};
constructor() {
this.initializePool();
}
constructor() {
this.initializePool();
}
private async initializePool() {
this.pool = new ConnectionPool(this.config);
}
private initializePool() {
this.pool = new ConnectionPool(this.config);
}
async getConnection(): Promise<Connection> {
try {
const connection = await this.pool.connect();
console.log('Database connection initialized successfully for Mssql.');
// console.log(`Connection established to server: ${this.config.server}`); // Log server info
return connection;
} catch (error) {
console.error('Error getting connection from pool', error.stack);
throw error; // Rethrow the error after logging
}
async getConnection(): Promise<Connection> {
try {
const connection = await this.pool.connect();
console.log('Database connection initialized successfully for Mssql.');
// console.log(`Connection established to server: ${this.config.server}`); // Log server info
return connection;
} catch (error) {
console.error('Error getting connection from pool', error.stack);
throw error; // Rethrow the error after logging
}
}
}
}

View File

@ -1,17 +1,21 @@
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { BadRequestException, ValidationError, ValidationPipe } from '@nestjs/common';
import {
BadRequestException,
ValidationError,
ValidationPipe,
} from '@nestjs/common';
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
import { SwaggerDocumentOptions } from '@nestjs/swagger';
async function bootstrap() {
const app = await NestFactory.create(AppModule, {
cors: {
"origin": "*",
"methods": "GET,HEAD,PUT,PATCH,POST,DELETE",
"preflightContinue": false,
"optionsSuccessStatus": 204
}
origin: '*',
methods: 'GET,HEAD,PUT,PATCH,POST,DELETE',
preflightContinue: false,
optionsSuccessStatus: 204,
},
});
function extractConstraints(validationErrors: ValidationError[]) {
@ -41,39 +45,49 @@ async function bootstrap() {
}
const customExceptionFactory = (validationErrors: ValidationError[]) => {
const res = extractConstraints(validationErrors);
let res = extractConstraints(validationErrors);
const newResult = res
.map((x) => {
const errorMessage = x[Object.keys(x)[0]];
let newResult = res.map(x => {
const errorMessage = x[Object.keys(x)[0]];
return { message: errorMessage };
})
.filter(Boolean);
return { message: errorMessage };
}).filter(Boolean);
return new BadRequestException({ message: 'Validation failed', errors: newResult });
return new BadRequestException({
message: 'Validation failed',
errors: newResult,
});
};
app.useGlobalPipes(new ValidationPipe({
transform: true,
exceptionFactory: customExceptionFactory,
whitelist: true,
stopAtFirstError: true,
forbidNonWhitelisted: true,
}));
app.useGlobalPipes(
new ValidationPipe({
transform: true,
exceptionFactory: customExceptionFactory,
whitelist: true,
stopAtFirstError: true,
forbidNonWhitelisted: true,
}),
);
// app.useGlobalPipes(new ValidationPipe({ exceptionFactory:customExceptionFactory, whitelist: true, forbidNonWhitelisted: true, transform: true }));
const config = new DocumentBuilder()
.setTitle('API')
.setDescription('API description')
.setVersion('1.0')
.addServer("http://localhost:3000", "Development Server 1")
.addServer("https://dev.alphaomegainfosys.com/test-api", "Development Server 2")
.addServer('http://localhost:3000', 'Development Server 1')
.addServer(
'https://dev.alphaomegainfosys.com/test-api',
'Development Server 2',
)
.build();
const options: SwaggerDocumentOptions = {
autoTagControllers: false,
};
const documentFactory = () => SwaggerModule.createDocument(app, config, options);
const documentFactory = () =>
SwaggerModule.createDocument(app, config, options);
SwaggerModule.setup('api', app, documentFactory);
await app.listen(process.env.PORT ?? 3000);

View File

@ -1,78 +1,81 @@
import {
Get,
Post,
Body,
Param,
Controller,
ParseIntPipe,
BadRequestException
Get,
Post,
Body,
Param,
Controller,
ParseIntPipe,
BadRequestException,
} from '@nestjs/common';
import { HomePageService } from './home-page.service';
import { ApiTags } from '@nestjs/swagger';
import {
SaveCarnetApplicationDTO,
TransmitApplicationtoProcessDTO,
GetCarnetDetailsbyCarnetStatusDTO
SaveCarnetApplicationDTO,
TransmitApplicationtoProcessDTO,
GetCarnetDetailsbyCarnetStatusDTO,
} from './home-page.dto';
@Controller()
export class HomePageController {
constructor(
private readonly homePageService: HomePageService
) { }
constructor(private readonly homePageService: HomePageService) {}
@ApiTags('HomePage - Oracle')
@Get('/oracle/GetHomePageData/:id')
GetHomePageData(@Param('id', ParseIntPipe) id: number) {
return this.homePageService.GetHomePageData(id);
@ApiTags('HomePage - Oracle')
@Get('/oracle/GetHomePageData/:id')
GetHomePageData(@Param('id', ParseIntPipe) id: number) {
return this.homePageService.GetHomePageData(id);
}
@ApiTags('HomePage - Oracle')
@Get('/oracle/GetCarnetSummaryData/:userid')
GetCarnetSummaryData(@Param('userid') id: string) {
return this.homePageService.GetCarnetSummaryData(id);
}
@ApiTags('HomePage - Oracle')
@Get(
'/oracle/GetCarnetDetailsbyCarnetStatus/:p_spid/:p_userid/:p_CarnetStatus',
)
GetCarnetDetailsbyCarnetStatus(
@Param('p_spid', ParseIntPipe) p_spid: number,
@Param('p_userid') p_userid: string,
@Param('p_CarnetStatus') p_CarnetStatus: string,
) {
if (!p_spid || !p_userid || !p_CarnetStatus) {
throw new BadRequestException(
'spid, userid and Carnet Status are required',
);
} else if (Number(p_userid) || Number(p_CarnetStatus)) {
throw new BadRequestException(
'Param p_userid and p_CarnetStatus should be string',
);
}
try {
const body: GetCarnetDetailsbyCarnetStatusDTO = {
p_spid: p_spid,
p_userid: p_userid,
p_CarnetStatus: p_CarnetStatus,
};
@ApiTags('HomePage - Oracle')
@Get('/oracle/GetCarnetSummaryData/:userid')
GetCarnetSummaryData(@Param('userid') id: string) {
return this.homePageService.GetCarnetSummaryData(id);
return this.homePageService.GetCarnetDetailsbyCarnetStatus(body);
} catch (err) {
return new BadRequestException({
message: 'Validation faileda',
error: err.message,
});
}
}
@ApiTags('HomePage - Oracle')
@Get('/oracle/GetCarnetDetailsbyCarnetStatus/:p_spid/:p_userid/:p_CarnetStatus')
GetCarnetDetailsbyCarnetStatus(
@Param('p_spid', ParseIntPipe) p_spid: number,
@Param('p_userid') p_userid: string,
@Param('p_CarnetStatus') p_CarnetStatus: string
) {
if (!p_spid || !p_userid || !p_CarnetStatus) {
throw new BadRequestException('spid, userid and Carnet Status are required');
}
else if (Number(p_userid) || Number(p_CarnetStatus)) {
throw new BadRequestException('Param p_userid and p_CarnetStatus should be string');
}
try {
const body: GetCarnetDetailsbyCarnetStatusDTO = {
p_spid: p_spid,
p_userid: p_userid,
p_CarnetStatus: p_CarnetStatus
};
@ApiTags('HomePage - Oracle')
@Post('/oracle/SaveCarnetApplication')
SaveCarnetApplication(@Body() body: SaveCarnetApplicationDTO) {
return this.homePageService.SaveCarnetApplication(body);
}
return this.homePageService.GetCarnetDetailsbyCarnetStatus(body);
}
catch (err) {
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);
}
@ApiTags('HomePage - Oracle')
@Post('/oracle/TransmitApplicationtoProcess')
TransmitApplicationtoProcess(@Body() body: TransmitApplicationtoProcessDTO) {
return this.homePageService.TransmitApplicationtoProcess(body);
}
}

View File

@ -1,293 +1,363 @@
import { ApiProperty } from "@nestjs/swagger";
import { Type } from "class-transformer";
import { IsArray, IsDefined, IsInt, IsNumber, IsOptional, IsString, Length, Max, Min, ValidateNested } from "class-validator";
import { ApiProperty } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import {
IsArray,
IsDefined,
IsInt,
IsNumber,
IsOptional,
IsString,
Length,
Max,
Min,
ValidateNested,
} from 'class-validator';
export class p_gltableDTO {
@ApiProperty({ required: true })
@Max(999999999, { message: "Property ItemNo must not exceed 999999999" })
@Min(0, { message: "Property ItemNo must be at least 0 or more" })
@IsInt()
@IsNumber({}, { message: "Property ItemNo must be a number" })
@IsDefined({ message: "Property ItemNo is required" })
ItemNo: number;
@ApiProperty({ required: true })
@Max(999999999, { message: 'Property ItemNo must not exceed 999999999' })
@Min(0, { message: 'Property ItemNo must be at least 0 or more' })
@IsInt()
@IsNumber({}, { message: 'Property ItemNo must be a number' })
@IsDefined({ message: 'Property ItemNo is required' })
ItemNo: number;
@ApiProperty({ required: true })
@Length(0, 1000, { message: "Property ItemDescription must be between 1 and 1000 characters" })
@IsString({ message: "Property ItemDescription should be string" })
@IsDefined({ message: "Property ItemDescription is required" })
ItemDescription: string;
@ApiProperty({ required: true })
@Length(0, 1000, {
message: 'Property ItemDescription must be between 1 and 1000 characters',
})
@IsString({ message: 'Property ItemDescription should be string' })
@IsDefined({ message: 'Property ItemDescription is required' })
ItemDescription: string;
@ApiProperty({ required: true })
@IsNumber({},{ message: "Property ItemValue should be number" })
@IsDefined({ message: "Property ItemValue is required" })
ItemValue: number;
@ApiProperty({ required: true })
@IsNumber({}, { message: 'Property ItemValue should be number' })
@IsDefined({ message: 'Property ItemValue is required' })
ItemValue: number;
@ApiProperty({ required: true })
@Max(99999999999, { message: "Property Noofpieces must not exceed 99999999999" })
@Min(0, { message: "Property Noofpieces must be at least 0 or more" })
@IsInt()
@IsNumber({}, { message: "Property Noofpieces must be a number" })
@IsDefined({ message: "Property Noofpieces is required" })
Noofpieces: number;
@ApiProperty({ required: true })
@Max(99999999999, {
message: 'Property Noofpieces must not exceed 99999999999',
})
@Min(0, { message: 'Property Noofpieces must be at least 0 or more' })
@IsInt()
@IsNumber({}, { message: 'Property Noofpieces must be a number' })
@IsDefined({ message: 'Property Noofpieces is required' })
Noofpieces: number;
@ApiProperty({ required: false })
@IsNumber()
@IsOptional()
ItemWeight?: number;
@ApiProperty({ required: false })
@IsNumber()
@IsOptional()
ItemWeight?: number;
@ApiProperty({ required: false })
@Length(0, 10, { message: "Property ItemWeightUOM must be between 0 and 10 characters" })
@IsString()
@IsOptional()
ItemWeightUOM?: string;
@ApiProperty({ required: false })
@Length(0, 10, {
message: 'Property ItemWeightUOM must be between 0 and 10 characters',
})
@IsString()
@IsOptional()
ItemWeightUOM?: string;
@ApiProperty({ required: true })
@Length(0, 2, { message: "Property GoodsOriginCountry must be between 0 and 2 characters" })
@IsString({ message: "Property GoodsOriginCountry should be string" })
@IsDefined({ message: "Property name is required" })
GoodsOriginCountry: string;
@ApiProperty({ required: true })
@Length(0, 2, {
message: 'Property GoodsOriginCountry must be between 0 and 2 characters',
})
@IsString({ message: 'Property GoodsOriginCountry should be string' })
@IsDefined({ message: 'Property name is required' })
GoodsOriginCountry: string;
}
export class p_countrytableDTO {
@ApiProperty({ required: true })
@Length(0, 1, { message: "Property VisitTransitInd must be 0 to 1 characters" })
@IsString()
@IsDefined({ message: "Property VisitTransitInd is required" })
VisitTransitInd: string;
@ApiProperty({ required: true })
@Length(0, 1, {
message: 'Property VisitTransitInd must be 0 to 1 characters',
})
@IsString()
@IsDefined({ message: 'Property VisitTransitInd is required' })
VisitTransitInd: string;
@ApiProperty({ required: true })
@Length(0, 2, { message: "Property CountryCode must be between 0 to 2 characters" })
@IsString()
@IsDefined({ message: "Property CountryCode is required" })
CountryCode: string;
@ApiProperty({ required: true })
@Length(0, 2, {
message: 'Property CountryCode must be between 0 to 2 characters',
})
@IsString()
@IsDefined({ message: 'Property CountryCode is required' })
CountryCode: string;
@ApiProperty({ required: true })
@Max(999, { message: "Property NoOfTimesEntLeave must not exceed 999" })
@Min(0, { message: "Property NoOfTimesEntLeave must be at least 0 or more" })
@IsInt()
@IsNumber({}, { message: "Property NoOfTimesEntLeave must be a number" })
@IsDefined({ message: "Property NoOfTimesEntLeave is required" })
NoOfTimesEntLeave: number;
@ApiProperty({ required: true })
@Max(999, { message: 'Property NoOfTimesEntLeave must not exceed 999' })
@Min(0, { message: 'Property NoOfTimesEntLeave must be at least 0 or more' })
@IsInt()
@IsNumber({}, { message: 'Property NoOfTimesEntLeave must be a number' })
@IsDefined({ message: 'Property NoOfTimesEntLeave is required' })
NoOfTimesEntLeave: number;
}
export class SaveCarnetApplicationDTO {
@ApiProperty({ required: true })
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
@Min(0, { message: "Property p_spid must be at least 0 or more" })
@IsInt()
@IsNumber({}, { message: "Property p_spid must be a number" })
p_spid: number;
@ApiProperty({ required: true })
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
@IsInt()
@IsNumber({}, { message: 'Property p_spid must be a number' })
p_spid: number;
@ApiProperty({ required: true })
@Max(999999999, { message: "Property p_clientid must not exceed 999999999" })
@Min(0, { message: "Property p_clientid must be at least 0 or more" })
@IsInt()
@IsNumber({}, { message: "Property p_clientid must be a number" })
p_clientid: number;
@ApiProperty({ required: true })
@Max(999999999, { message: 'Property p_clientid must not exceed 999999999' })
@Min(0, { message: 'Property p_clientid must be at least 0 or more' })
@IsInt()
@IsNumber({}, { message: 'Property p_clientid must be a number' })
p_clientid: number;
@ApiProperty({ required: true })
@Max(999999999, { message: "Property p_locationid must not exceed 999999999" })
@Min(0, { message: "Property p_locationid must be at least 0 or more" })
@IsInt()
@IsNumber({}, { message: "Property p_locationid must be a number" })
p_locationid: number;
@ApiProperty({ required: true })
@Max(999999999, {
message: 'Property p_locationid must not exceed 999999999',
})
@Min(0, { message: 'Property p_locationid must be at least 0 or more' })
@IsInt()
@IsNumber({}, { message: 'Property p_locationid must be a number' })
p_locationid: number;
@ApiProperty({ required: true })
@Length(0, 50, { message: "Property p_userid must be between 0 to 50 characters" })
@IsString()
p_userid: string;
@ApiProperty({ required: true })
@Length(0, 50, {
message: 'Property p_userid must be between 0 to 50 characters',
})
@IsString()
p_userid: string;
@ApiProperty({ required: false })
@Max(999999999, { message: "Property p_headerid must not exceed 999999999" })
@Min(0, { message: "Property p_headerid must be at least 0 or more" })
@IsInt()
@IsNumber({}, { message: "Property p_headerid must be a number" })
@IsOptional()
p_headerid?: number;
@ApiProperty({ required: false })
@Max(999999999, { message: 'Property p_headerid must not exceed 999999999' })
@Min(0, { message: 'Property p_headerid must be at least 0 or more' })
@IsInt()
@IsNumber({}, { message: 'Property p_headerid must be a number' })
@IsOptional()
p_headerid?: number;
@ApiProperty({ required: true })
@Length(0, 50, { message: "Property p_applicationname must be between 0 to 50 characters" })
@IsString()
p_applicationname: string;
@ApiProperty({ required: true })
@Length(0, 50, {
message: 'Property p_applicationname must be between 0 to 50 characters',
})
@IsString()
p_applicationname: string;
@ApiProperty({ required: false })
@Max(999999999, { message: "Property p_holderid must not exceed 999999999" })
@Min(0, { message: "Property p_holderid must be at least 0 or more" })
@IsInt()
@IsNumber({}, { message: "Property p_holderid must be a number" })
@IsOptional()
p_holderid?: number;
@ApiProperty({ required: false })
@Max(999999999, { message: 'Property p_holderid must not exceed 999999999' })
@Min(0, { message: 'Property p_holderid must be at least 0 or more' })
@IsInt()
@IsNumber({}, { message: 'Property p_holderid must be a number' })
@IsOptional()
p_holderid?: number;
@ApiProperty({ required: false })
@Length(0, 1, { message: "Property p_commercialsampleflag must be between 0 to 1 characters" })
@IsString()
@IsOptional()
p_commercialsampleflag?: string;
@ApiProperty({ required: false })
@Length(0, 1, {
message:
'Property p_commercialsampleflag must be between 0 to 1 characters',
})
@IsString()
@IsOptional()
p_commercialsampleflag?: string;
@ApiProperty({ required: false })
@Length(0, 1, { message: "Property p_profequipmentflag must be between 0 to 1 characters" })
@IsString()
@IsOptional()
p_profequipmentflag?: string;
@ApiProperty({ required: false })
@Length(0, 1, {
message: 'Property p_profequipmentflag must be between 0 to 1 characters',
})
@IsString()
@IsOptional()
p_profequipmentflag?: string;
@ApiProperty({ required: false })
@Length(0, 1, { message: "Property p_exhibitionsfairflag must be between 0 to 1 characters" })
@IsString()
@IsOptional()
p_exhibitionsfairflag?: string;
@ApiProperty({ required: false })
@Length(0, 1, {
message: 'Property p_exhibitionsfairflag must be between 0 to 1 characters',
})
@IsString()
@IsOptional()
p_exhibitionsfairflag?: string;
@ApiProperty({ required: false })
@Length(0, 1, { message: "Property p_autoflag must be between 0 to 1 characters" })
@IsString()
@IsOptional()
p_autoflag?: string;
@ApiProperty({ required: false })
@Length(0, 1, {
message: 'Property p_autoflag must be between 0 to 1 characters',
})
@IsString()
@IsOptional()
p_autoflag?: string;
@ApiProperty({ required: false })
@Length(0, 1, { message: "Property p_horseflag must be between 0 to 1 characters" })
@IsString()
@IsOptional()
p_horseflag?: string;
@ApiProperty({ required: false })
@Length(0, 1, {
message: 'Property p_horseflag must be between 0 to 1 characters',
})
@IsString()
@IsOptional()
p_horseflag?: string;
@ApiProperty({ required: false })
@Length(0, 200, { message: "Property p_authrep must be between 0 to 200 characters" })
@IsString()
@IsOptional()
p_authrep?: string;
@ApiProperty({ required: false })
@Length(0, 200, {
message: 'Property p_authrep must be between 0 to 200 characters',
})
@IsString()
@IsOptional()
p_authrep?: string;
@ApiProperty({ required: false, type: () => [p_gltableDTO] })
@Type(() => p_gltableDTO)
@ValidateNested({ each: true })
@IsArray()
// @ArrayNotEmpty({message:"Property gltable should not be empty"})
@IsOptional()
p_gltable?: p_gltableDTO[];
@ApiProperty({ required: false, type: () => [p_gltableDTO] })
@Type(() => p_gltableDTO)
@ValidateNested({ each: true })
@IsArray()
// @ArrayNotEmpty({message:"Property gltable should not be empty"})
@IsOptional()
p_gltable?: p_gltableDTO[];
@ApiProperty({ required: false })
@Max(99999, { message: "Property p_ussets must not exceed 99999" })
@Min(0, { message: "Property p_ussets must be at least 0 or more" })
@IsInt()
@IsNumber({}, { message: "Property p_ussets must be a number" })
@IsOptional()
p_ussets?: number;
@ApiProperty({ required: false })
@Max(99999, { message: 'Property p_ussets must not exceed 99999' })
@Min(0, { message: 'Property p_ussets must be at least 0 or more' })
@IsInt()
@IsNumber({}, { message: 'Property p_ussets must be a number' })
@IsOptional()
p_ussets?: number;
@ApiProperty({ required: false, type: () => [p_countrytableDTO] })
@ValidateNested({ each: true })
@IsArray()
@Type(() => p_countrytableDTO)
@IsOptional()
p_countrytable?: p_countrytableDTO[];
@ApiProperty({ required: false, type: () => [p_countrytableDTO] })
@ValidateNested({ each: true })
@IsArray()
@Type(() => p_countrytableDTO)
@IsOptional()
p_countrytable?: p_countrytableDTO[];
@ApiProperty({ required: false })
@Length(0, 10, { message: "Property p_shiptotype must be between 0 to 10 characters" })
@IsString()
@IsOptional()
p_shiptotype?: string;
@ApiProperty({ required: false })
@Length(0, 10, {
message: 'Property p_shiptotype must be between 0 to 10 characters',
})
@IsString()
@IsOptional()
p_shiptotype?: string;
@ApiProperty({ required: false })
@Max(999999999, { message: "Property p_shipaddrid must not exceed 999999999" })
@Min(0, { message: "Property p_shipaddrid must be at least 0 or more" })
@IsInt()
@IsNumber({}, { message: "Property p_shipaddrid must be a number" })
@IsOptional()
p_shipaddrid?: number;
@ApiProperty({ required: false })
@Max(999999999, {
message: 'Property p_shipaddrid must not exceed 999999999',
})
@Min(0, { message: 'Property p_shipaddrid must be at least 0 or more' })
@IsInt()
@IsNumber({}, { message: 'Property p_shipaddrid must be a number' })
@IsOptional()
p_shipaddrid?: number;
@ApiProperty({ required: false })
@Length(0, 1, { message: "Property p_formofsecurity must be between 0 to 1 characters" })
@IsString()
@IsOptional()
p_formofsecurity?: string;
@ApiProperty({ required: false })
@Length(0, 1, {
message: 'Property p_formofsecurity must be between 0 to 1 characters',
})
@IsString()
@IsOptional()
p_formofsecurity?: string;
@ApiProperty({ required: false })
@Length(0, 10, { message: "Property p_insprotection must be between 0 to 10 characters" })
@IsString()
@IsOptional()
p_insprotection?: string;
@ApiProperty({ required: false })
@Length(0, 10, {
message: 'Property p_insprotection must be between 0 to 10 characters',
})
@IsString()
@IsOptional()
p_insprotection?: string;
@ApiProperty({ required: false })
@Length(0, 10, { message: "Property p_ldiprotection must be between 0 to 10 characters" })
@IsString()
@IsOptional()
p_ldiprotection?: string;
@ApiProperty({ required: false })
@Length(0, 10, {
message: 'Property p_ldiprotection must be between 0 to 10 characters',
})
@IsString()
@IsOptional()
p_ldiprotection?: string;
@ApiProperty({ required: false })
@Length(0, 10, { message: "Property p_deliverytype must be between 0 to 10 characters" })
@IsString()
@IsOptional()
p_deliverytype?: string;
@ApiProperty({ required: false })
@Length(0, 10, {
message: 'Property p_deliverytype must be between 0 to 10 characters',
})
@IsString()
@IsOptional()
p_deliverytype?: string;
@ApiProperty({ required: false })
@Length(0, 10, { message: "Property p_deliverymethod must be between 0 to 10 characters" })
@IsString()
@IsOptional()
p_deliverymethod?: string;
@ApiProperty({ required: false })
@Length(0, 10, {
message: 'Property p_deliverymethod must be between 0 to 10 characters',
})
@IsString()
@IsOptional()
p_deliverymethod?: string;
@ApiProperty({ required: false })
@Length(0, 10, { message: "Property p_paymentmethod must be between 0 to 10 characters" })
@IsString()
@IsOptional()
p_paymentmethod?: string;
@ApiProperty({ required: false })
@Length(0, 10, {
message: 'Property p_paymentmethod must be between 0 to 10 characters',
})
@IsString()
@IsOptional()
p_paymentmethod?: string;
@ApiProperty({ required: false })
@Length(0, 20, { message: "Property p_custcourierno must be between 0 to 20 characters" })
@IsString()
@IsOptional()
p_custcourierno?: string;
@ApiProperty({ required: false })
@Length(0, 20, {
message: 'Property p_custcourierno must be between 0 to 20 characters',
})
@IsString()
@IsOptional()
p_custcourierno?: string;
@ApiProperty({ required: false })
@Length(0, 20, { message: "Property p_refno must be between 0 to 20 characters" })
@IsString()
@IsOptional()
p_refno?: string;
@ApiProperty({ required: false })
@Length(0, 20, {
message: 'Property p_refno must be between 0 to 20 characters',
})
@IsString()
@IsOptional()
p_refno?: string;
@ApiProperty({ required: false })
@Length(0, 2000, { message: "Property p_notes must be between 0 to 2000 characters" })
@IsString()
@IsOptional()
p_notes?: string;
@ApiProperty({ required: false })
@Length(0, 2000, {
message: 'Property p_notes must be between 0 to 2000 characters',
})
@IsString()
@IsOptional()
p_notes?: string;
}
export class TransmitApplicationtoProcessDTO {
@ApiProperty({ required: true })
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
@Min(0, { message: "Property p_spid must be at least 0 or more" })
@IsInt()
@IsNumber({}, { message: "Property p_spid must be a number" })
@IsDefined({message:"Property p_spid is required"})
p_spid: number;
@ApiProperty({ required: true })
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
@IsInt()
@IsNumber({}, { message: 'Property p_spid must be a number' })
@IsDefined({ message: 'Property p_spid is required' })
p_spid: number;
@ApiProperty({ required: true })
@Length(0, 50, { message: "Property p_userid must be between 0 to 50 characters" })
@IsString()
@IsDefined({message:"Property p_userid is required"})
p_userid: string;
@ApiProperty({ required: true })
@Length(0, 50, {
message: 'Property p_userid must be between 0 to 50 characters',
})
@IsString()
@IsDefined({ message: 'Property p_userid is required' })
p_userid: string;
@ApiProperty({ required: true })
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
@Min(0, { message: "Property p_spid must be at least 0 or more" })
@IsInt()
@IsNumber({}, { message: "Property p_headerid must be a number" })
@IsDefined({message:"Property p_headerid is required"})
p_headerid: number;
@ApiProperty({ required: true })
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
@IsInt()
@IsNumber({}, { message: 'Property p_headerid must be a number' })
@IsDefined({ message: 'Property p_headerid is required' })
p_headerid: number;
}
export class GetCarnetDetailsbyCarnetStatusDTO {
@ApiProperty({ required: true })
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
@Min(0, { message: "Property p_spid must be at least 0 or more" })
@IsInt()
@IsNumber({}, { message: "Property p_spid must be a number" })
@IsDefined({message:"Property p_spid is required"})
p_spid: number;
@ApiProperty({ required: true })
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
@IsInt()
@IsNumber({}, { message: 'Property p_spid must be a number' })
@IsDefined({ message: 'Property p_spid is required' })
p_spid: number;
@ApiProperty({ required: true })
@Length(0, 50, { message: "Property p_userid must be between 0 to 50 characters" })
@IsString({ message: "Property p_userid must be string" })
@IsDefined({message:"Property p_userid is required"})
p_userid: string;
@ApiProperty({ required: true })
@Length(0, 20, { message: "Property p_CarnetStatus must be between 0 to 20 characters" })
@IsString()
@IsDefined({message:"Property p_CarnetStatus is required"})
p_CarnetStatus: string;
}
@ApiProperty({ required: true })
@Length(0, 50, {
message: 'Property p_userid must be between 0 to 50 characters',
})
@IsString({ message: 'Property p_userid must be string' })
@IsDefined({ message: 'Property p_userid is required' })
p_userid: string;
@ApiProperty({ required: true })
@Length(0, 20, {
message: 'Property p_CarnetStatus must be between 0 to 20 characters',
})
@IsString()
@IsDefined({ message: 'Property p_CarnetStatus is required' })
p_CarnetStatus: string;
}

View File

@ -4,8 +4,8 @@ import { HomePageController } from './home-page.controller';
import { DbModule } from 'src/db/db.module';
@Module({
imports:[DbModule],
providers: [ HomePageService],
controllers: [HomePageController]
imports: [DbModule],
providers: [HomePageService],
controllers: [HomePageController],
})
export class HomePageModule {}
export class HomePageModule {}

File diff suppressed because it is too large Load Diff

View File

@ -1,70 +1,84 @@
import { Body, Controller, Get, Post, Put, Query } from '@nestjs/common';
import { ManageClientsService } from './manage-clients.service';
import { CreateAdditionalClientContactsDTO, CreateAdditionalClientLocationsDTO, CreateClientDataDTO, GetPreparerByClientidContactsByClientidLocByClientidDTO, 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';
@Controller('oracle')
export class ManageClientsController {
constructor(private readonly manageClientsService: ManageClientsService) {}
constructor(private readonly manageClientsService:ManageClientsService){}
@ApiTags('Manage Clients - Oracle')
@Post('CreateNewClients')
async CreateClientData(@Body() body: CreateClientDataDTO) {
return this.manageClientsService.CreateClientData(body);
}
@ApiTags('Manage Clients - Oracle')
@Post('CreateNewClients')
async CreateClientData(@Body() body:CreateClientDataDTO){
return this.manageClientsService.CreateClientData(body);
}
@ApiTags('Manage Clients - Oracle')
@Put('UpdateClient')
async UpdateClient(@Body() body: UpdateClientDTO) {
return this.manageClientsService.UpdateClient(body);
}
@ApiTags('Manage Clients - Oracle')
@Put('UpdateClient')
async UpdateClient(@Body() body:UpdateClientDTO){
return this.manageClientsService.UpdateClient(body);
}
@ApiTags('Manage Clients - Oracle')
@Put('UpdateClientContacts')
UpdateClientContacts(@Body() body: UpdateClientContactsDTO) {
return this.manageClientsService.UpdateClientContacts(body);
}
@ApiTags('Manage Clients - Oracle')
@Put('UpdateClientContacts')
UpdateClientContacts(@Body() body:UpdateClientContactsDTO){
return this.manageClientsService.UpdateClientContacts(body);
}
@ApiTags('Manage Clients - Oracle')
@Put('UpdateClientLocations')
UpdateClientLocations(@Body() body: UpdateClientLocationsDTO) {
return this.manageClientsService.UpdateClientLocations(body);
}
@ApiTags('Manage Clients - Oracle')
@Put('UpdateClientLocations')
UpdateClientLocations(@Body() body:UpdateClientLocationsDTO){
return this.manageClientsService.UpdateClientLocations(body);
}
@ApiTags('Manage Clients - Oracle')
@Post('CreateAdditionalClientContacts')
CreateClientContact(@Body() body: CreateAdditionalClientContactsDTO) {
return this.manageClientsService.CreateClientContact(body);
}
@ApiTags('Manage Clients - Oracle')
@Post('CreateAdditionalClientContacts')
CreateClientContact(@Body() body:CreateAdditionalClientContactsDTO){
return this.manageClientsService.CreateClientContact(body);
}
@ApiTags('Manage Clients - Oracle')
@Post('CreateAdditionalClientLocations')
CreateClientLocation(@Body() body: CreateAdditionalClientLocationsDTO) {
return this.manageClientsService.CreateClientLocation(body);
}
@ApiTags('Manage Clients - Oracle')
@Post('CreateAdditionalClientLocations')
CreateClientLocation(@Body() body:CreateAdditionalClientLocationsDTO){
return this.manageClientsService.CreateClientLocation(body);
}
@ApiTags('Manage Clients - Oracle')
@Get('GetPreparers')
async GetPreparers(@Query() query: GetPreparersDTO) {
return await this.manageClientsService.GetPreparers(query);
}
@ApiTags('Manage Clients - Oracle')
@Get('GetPreparers')
async GetPreparers(@Query() query:GetPreparersDTO) {
return await this.manageClientsService.GetPreparers(query)
}
@ApiTags('Manage Clients - Oracle')
@Get('GetPreparerByClientid')
GetPreparerByClientid(
@Query() body: GetPreparerByClientidContactsByClientidLocByClientidDTO,
) {
return this.manageClientsService.GetPreparerByClientid(body);
}
@ApiTags('Manage Clients - Oracle')
@Get('GetPreparerByClientid')
GetPreparerByClientid(@Query() body:GetPreparerByClientidContactsByClientidLocByClientidDTO){
return this.manageClientsService.GetPreparerByClientid(body);
}
@ApiTags('Manage Clients - Oracle')
@Get('GetPreparerContactsByClientid')
GetPreparerContactsByClientid(
@Query() body: GetPreparerByClientidContactsByClientidLocByClientidDTO,
) {
return body;
}
@ApiTags('Manage Clients - Oracle')
@Get('GetPreparerContactsByClientid')
GetPreparerContactsByClientid(@Query() body:GetPreparerByClientidContactsByClientidLocByClientidDTO){
return body;
}
@ApiTags('Manage Clients - Oracle')
@Get('GetPreparerLocByClientid')
GetPreparerLocByClientid(@Query() body:GetPreparerByClientidContactsByClientidLocByClientidDTO){
return body;
}
@ApiTags('Manage Clients - Oracle')
@Get('GetPreparerLocByClientid')
GetPreparerLocByClientid(
@Query() body: GetPreparerByClientidContactsByClientidLocByClientidDTO,
) {
return body;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -4,6 +4,6 @@ import { ManageClientsService } from './manage-clients.service';
@Module({
controllers: [ManageClientsController],
providers: [ManageClientsService]
providers: [ManageClientsService],
})
export class ManageClientsModule {}

File diff suppressed because it is too large Load Diff

View File

@ -1,152 +1,151 @@
import { Body, Controller, Get, Param, ParseIntPipe, Patch, Post, Query } from '@nestjs/common';
import { Body, Controller, Get, 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
CreateBasicFeeDTO,
CreateBondRateDTO,
CreateCargoRateDTO,
CreateCfFeeDTO,
CreateCsFeeDTO,
CreateEfFeeDTO,
CreateFeeCommDTO,
GetFeeGeneralDTO,
UpdateBasicFeeDTO,
UpdateBondRateDTO,
UpdateCargoRateDTO,
UpdateCfFeeDTO,
UpdateCsFeeDTO,
UpdateEfFeeDTO,
UpdateFeeCommBodyDTO,
} from './manage-fee.dto';
@Controller('manage-fee')
export class ManageFeeController {
constructor(private readonly manageFeeService: ManageFeeService) { }
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('/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('/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('/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('/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('/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('/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')
@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('/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('/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('/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('/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('/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('/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')
@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('/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('/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('/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('/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('/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('/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')
@Patch('/UpdateFeeComm')
UpdateFeeComm(@Body() body: UpdateFeeCommBodyDTO) {
return this.manageFeeService.UPDATEFEECOMM(body);
}
}

View File

@ -1,360 +1,359 @@
import { ApiProperty } from "@nestjs/swagger";
import { Transform } from "class-transformer";
import { IsDefined, IsInt, IsNumber, IsString, Min } from "class-validator";
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 })
@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;
@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_SPID: number;
@ApiProperty({ required: true })
@IsNumber()
P_STARTCARNETVALUE: number;
@ApiProperty({ required: true })
@IsNumber()
P_STARTCARNETVALUE: number;
@ApiProperty({ required: true })
@IsNumber()
P_ENDCARNETVALUE: number;
@ApiProperty({ required: true })
@IsNumber()
P_ENDCARNETVALUE: number;
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
@ApiProperty({ required: true })
@IsNumber()
P_FEES: number;
@ApiProperty({ required: true })
@IsNumber()
P_FEES: number;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
}
export class CreateBondRateDTO {
@ApiProperty({ required: true })
@IsNumber()
P_SPID: number;
@ApiProperty({ required: true })
@IsNumber()
P_SPID: number;
@ApiProperty({ required: true })
@IsString()
P_HOLDERTYPE: string;
@ApiProperty({ required: true })
@IsString()
P_HOLDERTYPE: string;
@ApiProperty({ required: true })
@IsString()
P_USCIBMEMBERFLAG: string;
@ApiProperty({ required: true })
@IsString()
P_USCIBMEMBERFLAG: string;
@ApiProperty({ required: true })
@IsString()
P_SPCLCOMMODITY: string;
@ApiProperty({ required: true })
@IsString()
P_SPCLCOMMODITY: string;
@ApiProperty({ required: true })
@IsString()
P_SPCLCOUNTRY: string;
@ApiProperty({ required: true })
@IsString()
P_SPCLCOUNTRY: string;
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
@ApiProperty({ required: true })
@IsNumber()
P_RATE: number;
@ApiProperty({ required: true })
@IsNumber()
P_RATE: number;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
}
export class CreateCargoRateDTO {
@ApiProperty({ required: true })
@IsNumber()
P_SPID: number;
@ApiProperty({ required: true })
@IsNumber()
P_SPID: number;
@ApiProperty({ required: true })
@IsString()
P_CARNETTYPE: string;
@ApiProperty({ required: true })
@IsString()
P_CARNETTYPE: string;
@ApiProperty({ required: true })
@IsNumber()
P_STARTSETS: number;
@ApiProperty({ required: true })
@IsNumber()
P_STARTSETS: number;
@ApiProperty({ required: true })
@IsNumber()
P_ENDSETS: number;
@ApiProperty({ required: true })
@IsNumber()
P_ENDSETS: number;
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
@ApiProperty({ required: true })
@IsNumber()
P_RATE: number;
@ApiProperty({ required: true })
@IsNumber()
P_RATE: number;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
}
export class CreateCfFeeDTO {
@ApiProperty({ required: true })
@IsNumber()
P_SPID: number;
@ApiProperty({ required: true })
@IsNumber()
P_SPID: number;
@ApiProperty({ required: true })
@IsNumber()
P_STARTSETS: number;
@ApiProperty({ required: true })
@IsNumber()
P_STARTSETS: number;
@ApiProperty({ required: true })
@IsNumber()
P_ENDSETS: number;
@ApiProperty({ required: true })
@IsNumber()
P_ENDSETS: number;
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
@ApiProperty({ required: true })
@IsString()
P_CUSTOMERTYPE: string;
@ApiProperty({ required: true })
@IsString()
P_CUSTOMERTYPE: string;
@ApiProperty({ required: true })
@IsString()
P_CARNETTYPE: string;
@ApiProperty({ required: true })
@IsString()
P_CARNETTYPE: string;
@ApiProperty({ required: true })
@IsNumber()
P_RATE: number;
@ApiProperty({ required: true })
@IsNumber()
P_RATE: number;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
}
export class CreateCsFeeDTO {
@ApiProperty({ required: true })
@IsNumber()
P_SPID: number;
@ApiProperty({ required: true })
@IsNumber()
P_SPID: number;
@ApiProperty({ required: true })
@IsString()
P_CUSTOMERTYPE: string;
@ApiProperty({ required: true })
@IsString()
P_CUSTOMERTYPE: string;
@ApiProperty({ required: true })
@IsString()
P_CARNETTYPE: string;
@ApiProperty({ required: true })
@IsString()
P_CARNETTYPE: string;
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
@ApiProperty({ required: true })
@IsNumber()
P_RATE: number;
@ApiProperty({ required: true })
@IsNumber()
P_RATE: number;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
}
export class CreateEfFeeDTO {
@ApiProperty({ required: true })
@IsNumber()
P_SPID: number;
@ApiProperty({ required: true })
@IsNumber()
P_SPID: number;
@ApiProperty({ required: true })
@IsString()
P_CUSTOMERTYPE: string;
@ApiProperty({ required: true })
@IsString()
P_CUSTOMERTYPE: string;
@ApiProperty({ required: true })
@IsString()
P_DELIVERYTYPE: string;
@ApiProperty({ required: true })
@IsString()
P_DELIVERYTYPE: string;
@ApiProperty({ required: true })
@IsNumber()
P_STARTTIME: number;
@ApiProperty({ required: true })
@IsNumber()
P_STARTTIME: number;
@ApiProperty({ required: true })
@IsNumber()
P_ENDTIME: number;
@ApiProperty({ required: true })
@IsNumber()
P_ENDTIME: number;
@ApiProperty({ required: true })
@IsString()
P_TIMEZONE: string;
@ApiProperty({ required: true })
@IsString()
P_TIMEZONE: string;
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
@ApiProperty({ required: true })
@IsNumber()
P_FEES: number;
@ApiProperty({ required: true })
@IsNumber()
P_FEES: number;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
}
export class CreateFeeCommDTO {
@ApiProperty({ required: true })
@IsNumber()
P_SPID: number;
@ApiProperty({ required: true })
@IsNumber()
P_SPID: number;
@ApiProperty({ required: true })
@IsNumber()
P_PARAMID: number;
@ApiProperty({ required: true })
@IsNumber()
P_PARAMID: number;
@ApiProperty({ required: true })
@IsNumber()
P_COMMRATE: number;
@ApiProperty({ required: true })
@IsNumber()
P_COMMRATE: number;
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
}
export class UpdateBasicFeeDTO {
@ApiProperty({ required: true })
@IsNumber()
P_BASICFEESETUPID: number;
@ApiProperty({ required: true })
@IsNumber()
P_BASICFEESETUPID: number;
@ApiProperty({ required: true })
@IsNumber()
P_FEES: number;
@ApiProperty({ required: true })
@IsNumber()
P_FEES: number;
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
}
export class UpdateBondRateDTO {
@ApiProperty({ required: true })
@IsNumber()
P_BONDRATESETUPID: number;
@ApiProperty({ required: true })
@IsNumber()
P_BONDRATESETUPID: number;
@ApiProperty({ required: true })
@IsNumber()
P_RATE: number;
@ApiProperty({ required: true })
@IsNumber()
P_RATE: number;
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
}
export class UpdateCargoRateDTO {
@ApiProperty({ required: true })
@IsNumber()
P_CARGORATESETUPID: number;
@ApiProperty({ required: true })
@IsNumber()
P_CARGORATESETUPID: number;
@ApiProperty({ required: true })
@IsNumber()
P_RATE: number;
@ApiProperty({ required: true })
@IsNumber()
P_RATE: number;
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
}
export class UpdateCfFeeDTO {
@ApiProperty({ required: true })
@IsNumber()
P_CFFEESETUPID: number;
@ApiProperty({ required: true })
@IsNumber()
P_CFFEESETUPID: number;
@ApiProperty({ required: true })
@IsNumber()
P_RATE: number;
@ApiProperty({ required: true })
@IsNumber()
P_RATE: number;
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
}
export class UpdateCsFeeDTO {
@ApiProperty({ required: true })
@IsNumber()
P_CSFEESETUPID: number;
@ApiProperty({ required: true })
@IsNumber()
P_CSFEESETUPID: number;
@ApiProperty({ required: true })
@IsNumber()
P_RATE: number;
@ApiProperty({ required: true })
@IsNumber()
P_RATE: number;
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
}
export class UpdateEfFeeDTO {
@ApiProperty({ required: true })
@IsNumber()
P_EFFEESETUPID: number;
@ApiProperty({ required: true })
@IsNumber()
P_EFFEESETUPID: number;
@ApiProperty({ required: true })
@IsNumber()
P_FEES: number;
@ApiProperty({ required: true })
@IsNumber()
P_FEES: number;
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
}
export class UpdateFeeCommDTO {
@ApiProperty({ required: true })
@IsNumber()
P_FEECOMMID: number;
@ApiProperty({ required: true })
@IsNumber()
P_FEECOMMID: number;
@ApiProperty({ required: true })
@IsNumber()
P_RATE: number;
@ApiProperty({ required: true })
@IsNumber()
P_RATE: number;
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
@ApiProperty({ required: true })
@IsString()
P_USERID: 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()
}
@ApiProperty({ type: UpdateFeeCommDTO, required: true }) // Correctly reference UpdateFeeCommDTO
p_fees_comm: UpdateFeeCommDTO; // No need for @IsObject()
}

View File

@ -4,6 +4,6 @@ import { ManageFeeService } from './manage-fee.service';
@Module({
controllers: [ManageFeeController],
providers: [ManageFeeService]
providers: [ManageFeeService],
})
export class ManageFeeModule {}

File diff suppressed because it is too large Load Diff

View File

@ -1,95 +1,115 @@
import { Body, Controller, Get, Param, ParseIntPipe, Patch, Post, Put, UsePipes, ValidationPipe } from '@nestjs/common';
import {
Body,
Controller,
Get,
Param,
ParseIntPipe,
Patch,
Post,
Put,
} from '@nestjs/common';
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';
@Controller('oracle')
export class ManageHoldersController {
constructor(private readonly manageHoldersService: ManageHoldersService) {}
constructor(private readonly manageHoldersService: ManageHoldersService) { }
@ApiTags('Manage Holders - Oracle')
@Post('/CreateHolderData')
CreateHolders(@Body() body: CreateHoldersDTO) {
return this.manageHoldersService.CreateHolders(body);
// return {message:"Request received.."}
}
@ApiTags('Manage Holders - Oracle')
@Post('/CreateHolderData')
CreateHolders(@Body() body: CreateHoldersDTO) {
return this.manageHoldersService.CreateHolders(body);
// return {message:"Request received.."}
}
@ApiTags('Manage Holders - Oracle')
@Put('/UpdateHolder')
UpdateHolder(@Body() body: UpdateHolderDTO) {
return this.manageHoldersService.UpdateHolder(body);
}
@ApiTags('Manage Holders - Oracle')
@Put('/UpdateHolder')
UpdateHolder(@Body() body: UpdateHolderDTO) {
return this.manageHoldersService.UpdateHolder(body);
}
@ApiTags('Manage Holders - Oracle')
@Put('/UpdateHolderContact')
UpdateHolderContact(@Body() body: UpdateHolderContactDTO) {
return this.manageHoldersService.UpdateHolderContact(body);
}
@ApiTags('Manage Holders - Oracle')
@Put('/UpdateHolderContact')
UpdateHolderContact(@Body() body: UpdateHolderContactDTO) {
return this.manageHoldersService.UpdateHolderContact(body);
}
@ApiTags('Manage Holders - Oracle')
@Get('/GetHolderRecord/:p_spid/:p_holderid')
GetHolderMaster(
@Param('p_spid', ParseIntPipe) p_spid: number,
@Param('p_holderid', ParseIntPipe) p_holderid: number,
) {
const reqParams: GetHolderOrContactDTO = { p_spid, p_holderid };
@ApiTags('Manage Holders - Oracle')
@Get('/GetHolderRecord/:p_spid/:p_holderid')
GetHolderMaster(
@Param('p_spid', ParseIntPipe) p_spid: number,
@Param('p_holderid', ParseIntPipe) p_holderid: number,
){
const reqParams:GetHolderOrContactDTO = {p_spid,p_holderid}
return this.manageHoldersService.GetHolderRecord(reqParams);
}
return this.manageHoldersService.GetHolderRecord(reqParams);
}
@ApiTags('Manage Holders - Oracle')
@Get('/GetHolderContacts/:p_spid/:p_holderid')
GetHolderContacts(
@Param('p_spid', ParseIntPipe) p_spid: number,
@Param('p_holderid', ParseIntPipe) p_holderid: number,
){
const reqParams:GetHolderOrContactDTO = {p_spid,p_holderid}
@ApiTags('Manage Holders - Oracle')
@Get('/GetHolderContacts/:p_spid/:p_holderid')
GetHolderContacts(
@Param('p_spid', ParseIntPipe) p_spid: number,
@Param('p_holderid', ParseIntPipe) p_holderid: number,
) {
const reqParams: GetHolderOrContactDTO = { p_spid, p_holderid };
return this.manageHoldersService.GetHolderContacts(reqParams);
}
return this.manageHoldersService.GetHolderContacts(reqParams);
}
@ApiTags('Manage Holders - Oracle')
@Patch('/InactivateHolder/:p_spid/:p_holderid')
InactivateHolder(
@Param('p_spid', ParseIntPipe) p_spid: number,
@Param('p_holderid', ParseIntPipe) p_holderid: number,
){
const reqParams:GetHolderOrContactDTO = {p_spid,p_holderid}
@ApiTags('Manage Holders - Oracle')
@Patch('/InactivateHolder/:p_spid/:p_holderid')
InactivateHolder(
@Param('p_spid', ParseIntPipe) p_spid: number,
@Param('p_holderid', ParseIntPipe) p_holderid: number,
) {
const reqParams: GetHolderOrContactDTO = { p_spid, p_holderid };
return this.manageHoldersService.InactivateHolder(reqParams);
}
return this.manageHoldersService.InactivateHolder(reqParams);
}
@ApiTags('Manage Holders - Oracle')
@Patch('/ReactivateHolder/:p_spid/:p_holderid')
ReactivateHolder(
@Param('p_spid', ParseIntPipe) p_spid: number,
@Param('p_holderid', ParseIntPipe) p_holderid: number,
){
const reqParams:GetHolderOrContactDTO = {p_spid,p_holderid}
@ApiTags('Manage Holders - Oracle')
@Patch('/ReactivateHolder/:p_spid/:p_holderid')
ReactivateHolder(
@Param('p_spid', ParseIntPipe) p_spid: number,
@Param('p_holderid', ParseIntPipe) p_holderid: number,
) {
const reqParams: GetHolderOrContactDTO = { p_spid, p_holderid };
return this.manageHoldersService.ReactivateHolder(reqParams);
}
return this.manageHoldersService.ReactivateHolder(reqParams);
}
@ApiTags('Manage Holders - Oracle')
@Patch('/InactivateHolderContact/:p_spid/:p_holderContactid')
InactivateHolderContact(
@Param('p_spid', ParseIntPipe) p_spid: number,
@Param('p_holderContactid', ParseIntPipe) p_holderContactid: number,
){
const reqParams:GetHolderContactActivateOrInactivateDTO = {p_spid,p_holderContactid}
@ApiTags('Manage Holders - Oracle')
@Patch('/InactivateHolderContact/:p_spid/:p_holderContactid')
InactivateHolderContact(
@Param('p_spid', ParseIntPipe) p_spid: number,
@Param('p_holderContactid', ParseIntPipe) p_holderContactid: number,
) {
const reqParams: GetHolderContactActivateOrInactivateDTO = {
p_spid,
p_holderContactid,
};
return this.manageHoldersService.InactivateHolderContact(reqParams);
}
return this.manageHoldersService.InactivateHolderContact(reqParams);
}
@ApiTags('Manage Holders - Oracle')
@Patch('/ReactivateHolderContact/:p_spid/:p_holderContactid')
ReactivateHolderContact(
@Param('p_spid', ParseIntPipe) p_spid: number,
@Param('p_holderid', ParseIntPipe) p_holderContactid: number,
){
const reqParams:GetHolderContactActivateOrInactivateDTO = {p_spid,p_holderContactid}
@ApiTags('Manage Holders - Oracle')
@Patch('/ReactivateHolderContact/:p_spid/:p_holderContactid')
ReactivateHolderContact(
@Param('p_spid', ParseIntPipe) p_spid: number,
@Param('p_holderid', ParseIntPipe) p_holderContactid: number,
) {
const reqParams: GetHolderContactActivateOrInactivateDTO = {
p_spid,
p_holderContactid,
};
return this.manageHoldersService.ReactivateHolderContact(reqParams);
}
return this.manageHoldersService.ReactivateHolderContact(reqParams);
}
}

View File

@ -1,381 +1,487 @@
import { ApiProperty } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import { IsString, IsNumber, IsOptional, ValidateNested, IsArray, IsDefined, Length, Max, Min, IsInt } from 'class-validator';
import {
IsString,
IsNumber,
IsOptional,
ValidateNested,
IsArray,
IsDefined,
Length,
Max,
Min,
IsInt,
} from 'class-validator';
export class p_contactstableDTO {
@ApiProperty({ required: true })
@Length(0, 50, { message: "Property FirstName must be between 0 to 50 characters" })
@IsString({ message: "Property FirstName must be a string" })
@IsDefined({ message: "Property FirstName is required" })
FirstName: string;
@ApiProperty({ required: true })
@Length(0, 50, {
message: 'Property FirstName must be between 0 to 50 characters',
})
@IsString({ message: 'Property FirstName must be a string' })
@IsDefined({ message: 'Property FirstName is required' })
FirstName: string;
@ApiProperty({ required: true })
@Length(0, 50, { message: "Property LastName must be between 0 to 50 characters" })
@IsString({ message: "Property LastName must be a string" })
@IsDefined({ message: "Property LastName is required" })
LastName: string;
@ApiProperty({ required: true })
@Length(0, 50, {
message: 'Property LastName must be between 0 to 50 characters',
})
@IsString({ message: 'Property LastName must be a string' })
@IsDefined({ message: 'Property LastName is required' })
LastName: string;
@ApiProperty({ required: false })
@Length(0, 3, { message: "Property MiddleInitial must be between 0 to 3 characters" })
@IsString({ message: "Property MiddleInitial must be a string" })
@IsOptional()
MiddleInitial?: string;
@ApiProperty({ required: false })
@Length(0, 3, {
message: 'Property MiddleInitial must be between 0 to 3 characters',
})
@IsString({ message: 'Property MiddleInitial must be a string' })
@IsOptional()
MiddleInitial?: string;
@ApiProperty({ required: false })
@Length(0, 50, { message: "Property Title must be between 0 to 50 characters" })
@IsString({ message: "Property Title must be a string" })
@IsOptional()
Title?: string;
@ApiProperty({ required: false })
@Length(0, 50, {
message: 'Property Title must be between 0 to 50 characters',
})
@IsString({ message: 'Property Title must be a string' })
@IsOptional()
Title?: string;
@ApiProperty({ required: true })
@Length(0, 100, { message: "Property EmailAddress must be between 0 to 100 characters" })
@IsString({ message: "Property EmailAddress must be a string" })
@IsDefined({ message: "Property EmailAddress is required" })
EmailAddress: string;
@ApiProperty({ required: true })
@Length(0, 100, {
message: 'Property EmailAddress must be between 0 to 100 characters',
})
@IsString({ message: 'Property EmailAddress must be a string' })
@IsDefined({ message: 'Property EmailAddress is required' })
EmailAddress: string;
@ApiProperty({ required: true })
@Length(0, 20, { message: "Property PhoneNo must be between 0 to 20 characters" })
@IsString({ message: "Property PhoneNo must be a string" })
@IsDefined({ message: "Property PhoneNo is required" })
PhoneNo: string;
@ApiProperty({ required: true })
@Length(0, 20, {
message: 'Property PhoneNo must be between 0 to 20 characters',
})
@IsString({ message: 'Property PhoneNo must be a string' })
@IsDefined({ message: 'Property PhoneNo is required' })
PhoneNo: string;
@ApiProperty({ required: true })
@Length(0, 20, { message: "Property MobileNo must be between 0 to 20 characters" })
@IsString({ message: "Property MobileNo must be a string" })
@IsDefined({ message: "Property MobileNo is required" })
MobileNo: string;
@ApiProperty({ required: true })
@Length(0, 20, {
message: 'Property MobileNo must be between 0 to 20 characters',
})
@IsString({ message: 'Property MobileNo must be a string' })
@IsDefined({ message: 'Property MobileNo is required' })
MobileNo: string;
@ApiProperty({ required: false })
@Length(0, 20, { message: "Property FaxNo must be between 0 to 20 characters" })
@IsString({ message: "Property FaxNo must be a string" })
@IsOptional()
FaxNo?: string;
@ApiProperty({ required: false })
@Length(0, 20, {
message: 'Property FaxNo must be between 0 to 20 characters',
})
@IsString({ message: 'Property FaxNo must be a string' })
@IsOptional()
FaxNo?: string;
}
export class CreateHoldersDTO {
@ApiProperty({ required: true })
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
@Min(0, { message: "Property p_spid must be at least 0 or more" })
@IsInt({ message: "Property p_spid allows only whole numbers" })
@IsNumber({}, { message: "Property p_spid must be a number" })
@IsDefined({ message: "Property p_spid is required" })
p_spid: number;
@ApiProperty({ required: true })
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
@IsInt({ message: 'Property p_spid allows only whole numbers' })
@IsNumber({}, { message: 'Property p_spid must be a number' })
@IsDefined({ message: 'Property p_spid is required' })
p_spid: number;
@ApiProperty({ required: true })
@Max(999999999, { message: "Property p_clientlocationid must not exceed 999999999" })
@Min(0, { message: "Property p_clientlocationid must be at least 0 or more" })
@IsInt({ message: "Property p_clientlocationid allows only whole numbers" })
@IsNumber({}, { message: "Property p_clientlocationid must be a number" })
@IsDefined({ message: "Property p_clientlocationid is required" })
p_clientlocationid: number;
@ApiProperty({ required: true })
@Max(999999999, {
message: 'Property p_clientlocationid must not exceed 999999999',
})
@Min(0, { message: 'Property p_clientlocationid must be at least 0 or more' })
@IsInt({ message: 'Property p_clientlocationid allows only whole numbers' })
@IsNumber({}, { message: 'Property p_clientlocationid must be a number' })
@IsDefined({ message: 'Property p_clientlocationid is required' })
p_clientlocationid: number;
@ApiProperty({ required: true })
@Length(0, 15, { message: "Property p_holderno must be between 0 to 15 characters" })
@IsString({ message: "Property p_holderno must be a string" })
@IsDefined({ message: "Property p_holderno is required" })
p_holderno: string;
@ApiProperty({ required: true })
@Length(0, 15, {
message: 'Property p_holderno must be between 0 to 15 characters',
})
@IsString({ message: 'Property p_holderno must be a string' })
@IsDefined({ message: 'Property p_holderno is required' })
p_holderno: string;
@ApiProperty({ required: true })
@Length(0, 3, { message: "Property p_holdertype must be between 0 to 3 characters" })
@IsString({ message: "Property p_holdertype must be a string" })
@IsDefined({ message: "Property p_holdertype is required" })
p_holdertype: string;
@ApiProperty({ required: true })
@Length(0, 3, {
message: 'Property p_holdertype must be between 0 to 3 characters',
})
@IsString({ message: 'Property p_holdertype must be a string' })
@IsDefined({ message: 'Property p_holdertype is required' })
p_holdertype: string;
@ApiProperty({ required: true })
@Length(0, 1, { message: "Property p_uscibmemberflag must be between 0 to 1 character" })
@IsString({ message: "Property p_uscibmemberflag must be a string" })
@IsDefined({ message: "Property p_uscibmemberflag is required" })
p_uscibmemberflag: string;
@ApiProperty({ required: true })
@Length(0, 1, {
message: 'Property p_uscibmemberflag must be between 0 to 1 character',
})
@IsString({ message: 'Property p_uscibmemberflag must be a string' })
@IsDefined({ message: 'Property p_uscibmemberflag is required' })
p_uscibmemberflag: string;
@ApiProperty({ required: true })
@Length(0, 1, { message: "Property p_govagencyflag must be between 0 to 1 character" })
@IsString({ message: "Property p_govagencyflag must be a string" })
@IsDefined({ message: "Property p_govagencyflag is required" })
p_govagencyflag: string;
@ApiProperty({ required: true })
@Length(0, 1, {
message: 'Property p_govagencyflag must be between 0 to 1 character',
})
@IsString({ message: 'Property p_govagencyflag must be a string' })
@IsDefined({ message: 'Property p_govagencyflag is required' })
p_govagencyflag: string;
@ApiProperty({ required: true })
@Length(0, 50, { message: "Property p_holdername must be between 0 to 50 characters" })
@IsString({ message: "Property p_holdername must be a string" })
@IsDefined({ message: "Property p_holdername is required" })
p_holdername: string;
@ApiProperty({ required: true })
@Length(0, 50, {
message: 'Property p_holdername must be between 0 to 50 characters',
})
@IsString({ message: 'Property p_holdername must be a string' })
@IsDefined({ message: 'Property p_holdername is required' })
p_holdername: string;
@ApiProperty({ required: false })
@Length(0, 10, { message: "Property p_namequalifier must be between 0 to 10 characters" })
@IsString({ message: "Property p_namequalifier must be a string" })
@IsOptional()
p_namequalifier?: string;
@ApiProperty({ required: false })
@Length(0, 10, {
message: 'Property p_namequalifier must be between 0 to 10 characters',
})
@IsString({ message: 'Property p_namequalifier must be a string' })
@IsOptional()
p_namequalifier?: string;
@ApiProperty({ required: false })
@Length(0, 50, { message: "Property p_addlname must be between 0 to 50 characters" })
@IsString({ message: "Property p_addlname must be a string" })
@IsOptional()
p_addlname?: string;
@ApiProperty({ required: false })
@Length(0, 50, {
message: 'Property p_addlname must be between 0 to 50 characters',
})
@IsString({ message: 'Property p_addlname must be a string' })
@IsOptional()
p_addlname?: string;
@ApiProperty({ required: true })
@Length(0, 50, { message: "Property p_address1 must be between 0 to 50 characters" })
@IsString({ message: "Property p_address1 must be a string" })
@IsDefined({ message: "Property p_address1 is required" })
p_address1: string;
@ApiProperty({ required: true })
@Length(0, 50, {
message: 'Property p_address1 must be between 0 to 50 characters',
})
@IsString({ message: 'Property p_address1 must be a string' })
@IsDefined({ message: 'Property p_address1 is required' })
p_address1: string;
@ApiProperty({ required: false })
@Length(0, 50, { message: "Property p_address2 must be between 0 to 50 characters" })
@IsString({ message: "Property p_address2 must be a string" })
@IsOptional()
p_address2?: string;
@ApiProperty({ required: false })
@Length(0, 50, {
message: 'Property p_address2 must be between 0 to 50 characters',
})
@IsString({ message: 'Property p_address2 must be a string' })
@IsOptional()
p_address2?: string;
@ApiProperty({ required: true })
@Length(0, 30, { message: "Property p_city must be between 0 to 30 characters" })
@IsString({ message: "Property p_city must be a string" })
@IsDefined({ message: "Property p_city is required" })
p_city: string;
@ApiProperty({ required: true })
@Length(0, 30, {
message: 'Property p_city must be between 0 to 30 characters',
})
@IsString({ message: 'Property p_city must be a string' })
@IsDefined({ message: 'Property p_city is required' })
p_city: string;
@ApiProperty({ required: true })
@Length(0, 2, { message: "Property p_state must be between 0 to 2 characters" })
@IsString({ message: "Property p_state must be a string" })
@IsDefined({ message: "Property p_state is required" })
p_state: string;
@ApiProperty({ required: true })
@Length(0, 2, {
message: 'Property p_state must be between 0 to 2 characters',
})
@IsString({ message: 'Property p_state must be a string' })
@IsDefined({ message: 'Property p_state is required' })
p_state: string;
@ApiProperty({ required: true })
@Length(0, 10, { message: "Property p_zip must be between 0 to 10 characters" })
@IsString({ message: "Property p_zip must be a string" })
@IsDefined({ message: "Property p_zip is required" })
p_zip: string;
@ApiProperty({ required: true })
@Length(0, 10, {
message: 'Property p_zip must be between 0 to 10 characters',
})
@IsString({ message: 'Property p_zip must be a string' })
@IsDefined({ message: 'Property p_zip is required' })
p_zip: string;
@ApiProperty({ required: true })
@Length(0, 50, { message: "Property p_country must be between 0 to 50 characters" })
@IsString({ message: "Property p_country must be a string" })
@IsDefined({ message: "Property p_country is required" })
p_country: string;
@ApiProperty({ required: true })
@Length(0, 50, {
message: 'Property p_country must be between 0 to 50 characters',
})
@IsString({ message: 'Property p_country must be a string' })
@IsDefined({ message: 'Property p_country is required' })
p_country: string;
@ApiProperty({ required: true })
@Length(0, 50, { message: "Property p_userid must be between 0 to 50 characters" })
@IsString({ message: "Property p_userid must be a string" })
@IsDefined({ message: "Property p_userid is required" })
p_userid: string;
@ApiProperty({ required: true })
@Length(0, 50, {
message: 'Property p_userid must be between 0 to 50 characters',
})
@IsString({ message: 'Property p_userid must be a string' })
@IsDefined({ message: 'Property p_userid is required' })
p_userid: string;
@ApiProperty({ required: false, type: () => [p_contactstableDTO] })
@Type(() => p_contactstableDTO)
@ValidateNested({ each: true })
@IsArray({ message: "Property p_contactstable allows only array type" })
@IsOptional()
p_contactstable?: p_contactstableDTO[];
@ApiProperty({ required: false, type: () => [p_contactstableDTO] })
@Type(() => p_contactstableDTO)
@ValidateNested({ each: true })
@IsArray({ message: 'Property p_contactstable allows only array type' })
@IsOptional()
p_contactstable?: p_contactstableDTO[];
}
export class UpdateHolderDTO {
@ApiProperty({ required: true })
@Max(999999999, { message: "Property p_holderid must not exceed 999999999" })
@Min(0, { message: "Property p_holderid must be at least 0 or more" })
@IsInt({ message: "Property p_holderid allows only whole numbers" })
@IsNumber({}, { message: "Property p_holderid must be a number" })
@IsDefined({ message: "Property p_holderid is required" })
p_holderid: number;
@ApiProperty({ required: true })
@Max(999999999, { message: 'Property p_holderid must not exceed 999999999' })
@Min(0, { message: 'Property p_holderid must be at least 0 or more' })
@IsInt({ message: 'Property p_holderid allows only whole numbers' })
@IsNumber({}, { message: 'Property p_holderid must be a number' })
@IsDefined({ message: 'Property p_holderid is required' })
p_holderid: number;
@ApiProperty({ required: true })
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
@Min(0, { message: "Property p_spid must be at least 0 or more" })
@IsInt({ message: "Property p_spid allows only whole numbers" })
@IsNumber({}, { message: "Property p_spid must be a number" })
@IsDefined({ message: "Property p_spid is required" })
p_spid: number;
@ApiProperty({ required: true })
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
@IsInt({ message: 'Property p_spid allows only whole numbers' })
@IsNumber({}, { message: 'Property p_spid must be a number' })
@IsDefined({ message: 'Property p_spid is required' })
p_spid: number;
@ApiProperty({ required: true })
@Max(999999999, { message: "Property p_locationid must not exceed 999999999" })
@Min(0, { message: "Property p_locationid must be at least 0 or more" })
@IsInt({ message: "Property p_locationid allows only whole numbers" })
@IsNumber({}, { message: "Property p_locationid must be a number" })
@IsDefined({ message: "Property p_locationid is required" })
p_locationid: number;
@ApiProperty({ required: true })
@Max(999999999, {
message: 'Property p_locationid must not exceed 999999999',
})
@Min(0, { message: 'Property p_locationid must be at least 0 or more' })
@IsInt({ message: 'Property p_locationid allows only whole numbers' })
@IsNumber({}, { message: 'Property p_locationid must be a number' })
@IsDefined({ message: 'Property p_locationid is required' })
p_locationid: number;
@ApiProperty({ required: true })
@Length(0, 15, { message: "Property p_holderno must be between 0 to 15 characters" })
@IsString({ message: "Property p_holderno must be a string" })
@IsDefined({ message: "Property p_holderno is required" })
p_holderno: string;
@ApiProperty({ required: true })
@Length(0, 15, {
message: 'Property p_holderno must be between 0 to 15 characters',
})
@IsString({ message: 'Property p_holderno must be a string' })
@IsDefined({ message: 'Property p_holderno is required' })
p_holderno: string;
@ApiProperty({ required: true })
@Length(0, 3, { message: "Property p_holdertype must be between 0 to 3 characters" })
@IsString({ message: "Property p_holdertype must be a string" })
@IsDefined({ message: "Property p_holdertype is required" })
p_holdertype: string;
@ApiProperty({ required: true })
@Length(0, 3, {
message: 'Property p_holdertype must be between 0 to 3 characters',
})
@IsString({ message: 'Property p_holdertype must be a string' })
@IsDefined({ message: 'Property p_holdertype is required' })
p_holdertype: string;
@ApiProperty({ required: true })
@Length(0, 1, { message: "Property p_uscibmemberflag must be between 0 to 1 character" })
@IsString({ message: "Property p_uscibmemberflag must be a string" })
@IsDefined({ message: "Property p_uscibmemberflag is required" })
p_uscibmemberflag: string;
@ApiProperty({ required: true })
@Length(0, 1, {
message: 'Property p_uscibmemberflag must be between 0 to 1 character',
})
@IsString({ message: 'Property p_uscibmemberflag must be a string' })
@IsDefined({ message: 'Property p_uscibmemberflag is required' })
p_uscibmemberflag: string;
@ApiProperty({ required: true })
@Length(0, 1, { message: "Property p_govagencyflag must be between 0 to 1 character" })
@IsString({ message: "Property p_govagencyflag must be a string" })
@IsDefined({ message: "Property p_govagencyflag is required" })
p_govagencyflag: string;
@ApiProperty({ required: true })
@Length(0, 1, {
message: 'Property p_govagencyflag must be between 0 to 1 character',
})
@IsString({ message: 'Property p_govagencyflag must be a string' })
@IsDefined({ message: 'Property p_govagencyflag is required' })
p_govagencyflag: string;
@ApiProperty({ required: true })
@Length(0, 50, { message: "Property p_holdername must be between 0 to 50 characters" })
@IsString({ message: "Property p_holdername must be a string" })
@IsDefined({ message: "Property p_holdername is required" })
p_holdername: string;
@ApiProperty({ required: true })
@Length(0, 50, {
message: 'Property p_holdername must be between 0 to 50 characters',
})
@IsString({ message: 'Property p_holdername must be a string' })
@IsDefined({ message: 'Property p_holdername is required' })
p_holdername: string;
@ApiProperty({ required: false })
@Length(0, 10, { message: "Property p_namequalifier must be between 0 to 10 characters" })
@IsString({ message: "Property p_namequalifier must be a string" })
@IsOptional()
p_namequalifier?: string;
@ApiProperty({ required: false })
@Length(0, 10, {
message: 'Property p_namequalifier must be between 0 to 10 characters',
})
@IsString({ message: 'Property p_namequalifier must be a string' })
@IsOptional()
p_namequalifier?: string;
@ApiProperty({ required: false })
@Length(0, 50, { message: "Property p_addlname must be between 0 to 50 characters" })
@IsString({ message: "Property p_addlname must be a string" })
@IsOptional()
p_addlname?: string;
@ApiProperty({ required: false })
@Length(0, 50, {
message: 'Property p_addlname must be between 0 to 50 characters',
})
@IsString({ message: 'Property p_addlname must be a string' })
@IsOptional()
p_addlname?: string;
@ApiProperty({ required: true })
@Length(0, 50, { message: "Property p_address1 must be between 0 to 50 characters" })
@IsString({ message: "Property p_address1 must be a string" })
@IsDefined({ message: "Property p_address1 is required" })
p_address1: string;
@ApiProperty({ required: true })
@Length(0, 50, {
message: 'Property p_address1 must be between 0 to 50 characters',
})
@IsString({ message: 'Property p_address1 must be a string' })
@IsDefined({ message: 'Property p_address1 is required' })
p_address1: string;
@ApiProperty({ required: false })
@Length(0, 50, { message: "Property p_address2 must be between 0 to 50 characters" })
@IsString({ message: "Property p_address2 must be a string" })
@IsOptional()
p_address2?: string;
@ApiProperty({ required: false })
@Length(0, 50, {
message: 'Property p_address2 must be between 0 to 50 characters',
})
@IsString({ message: 'Property p_address2 must be a string' })
@IsOptional()
p_address2?: string;
@ApiProperty({ required: true })
@Length(0, 30, { message: "Property p_city must be between 0 to 30 characters" })
@IsString({ message: "Property p_city must be a string" })
@IsDefined({ message: "Property p_city is required" })
p_city: string;
@ApiProperty({ required: true })
@Length(0, 30, {
message: 'Property p_city must be between 0 to 30 characters',
})
@IsString({ message: 'Property p_city must be a string' })
@IsDefined({ message: 'Property p_city is required' })
p_city: string;
@ApiProperty({ required: true })
@Length(0, 2, { message: "Property p_state must be between 0 to 2 characters" })
@IsString({ message: "Property p_state must be a string" })
@IsDefined({ message: "Property p_state is required" })
p_state: string;
@ApiProperty({ required: true })
@Length(0, 2, {
message: 'Property p_state must be between 0 to 2 characters',
})
@IsString({ message: 'Property p_state must be a string' })
@IsDefined({ message: 'Property p_state is required' })
p_state: string;
@ApiProperty({ required: true })
@Length(0, 10, { message: "Property p_zip must be between 0 to 10 characters" })
@IsString({ message: "Property p_zip must be a string" })
@IsDefined({ message: "Property p_zip is required" })
p_zip: string;
@ApiProperty({ required: true })
@Length(0, 10, {
message: 'Property p_zip must be between 0 to 10 characters',
})
@IsString({ message: 'Property p_zip must be a string' })
@IsDefined({ message: 'Property p_zip is required' })
p_zip: string;
@ApiProperty({ required: true })
@Length(0, 2, { message: "Property p_country must be between 0 to 2 characters" })
@IsString({ message: "Property p_country must be a string" })
@IsDefined({ message: "Property p_country is required" })
p_country: string;
@ApiProperty({ required: true })
@Length(0, 2, {
message: 'Property p_country must be between 0 to 2 characters',
})
@IsString({ message: 'Property p_country must be a string' })
@IsDefined({ message: 'Property p_country is required' })
p_country: string;
@ApiProperty({ required: true })
@Length(0, 100, { message: "Property p_userid must be between 0 to 100 characters" })
@IsString({ message: "Property p_userid must be a string" })
@IsDefined({ message: "Property p_userid is required" })
p_userid: string;
@ApiProperty({ required: true })
@Length(0, 100, {
message: 'Property p_userid must be between 0 to 100 characters',
})
@IsString({ message: 'Property p_userid must be a string' })
@IsDefined({ message: 'Property p_userid is required' })
p_userid: string;
}
export class UpdateHolderContactDTO {
@ApiProperty({ required: true })
@Max(999999999, { message: "Property p_holdercontactid must not exceed 999999999" })
@Min(0, { message: "Property p_holdercontactid must be at least 0 or more" })
@IsInt({ message: "Property p_holdercontactid allows only whole numbers" })
@IsNumber({}, { message: "Property p_holdercontactid must be a number" })
@IsDefined({ message: "Property p_holdercontactid is required" })
p_holdercontactid: number;
@ApiProperty({ required: true })
@Max(999999999, {
message: 'Property p_holdercontactid must not exceed 999999999',
})
@Min(0, { message: 'Property p_holdercontactid must be at least 0 or more' })
@IsInt({ message: 'Property p_holdercontactid allows only whole numbers' })
@IsNumber({}, { message: 'Property p_holdercontactid must be a number' })
@IsDefined({ message: 'Property p_holdercontactid is required' })
p_holdercontactid: number;
@ApiProperty({ required: true })
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
@Min(0, { message: "Property p_spid must be at least 0 or more" })
@IsInt({ message: "Property p_spid allows only whole numbers" })
@IsNumber({}, { message: "Property p_spid must be a number" })
@IsDefined({ message: "Property p_spid is required" })
p_spid: number;
@ApiProperty({ required: true })
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
@IsInt({ message: 'Property p_spid allows only whole numbers' })
@IsNumber({}, { message: 'Property p_spid must be a number' })
@IsDefined({ message: 'Property p_spid is required' })
p_spid: number;
@ApiProperty({ required: true })
@Length(0, 50, { message: "Property p_firstname must be between 0 to 50 characters" })
@IsString({ message: "Property p_firstname must be a string" })
@IsDefined({ message: "Property p_firstname is required" })
p_firstname: string;
@ApiProperty({ required: true })
@Length(0, 50, {
message: 'Property p_firstname must be between 0 to 50 characters',
})
@IsString({ message: 'Property p_firstname must be a string' })
@IsDefined({ message: 'Property p_firstname is required' })
p_firstname: string;
@ApiProperty({ required: true })
@Length(0, 50, { message: "Property p_lastname must be between 0 to 50 characters" })
@IsString({ message: "Property p_lastname must be a string" })
@IsDefined({ message: "Property p_lastname is required" })
p_lastname: string;
@ApiProperty({ required: true })
@Length(0, 50, {
message: 'Property p_lastname must be between 0 to 50 characters',
})
@IsString({ message: 'Property p_lastname must be a string' })
@IsDefined({ message: 'Property p_lastname is required' })
p_lastname: string;
@ApiProperty({ required: false })
@Length(0, 3, { message: "Property p_middleinitial must be between 0 to 3 characters" })
@IsString({ message: "Property p_middleinitial must be a string" })
@IsOptional()
p_middleinitial?: string;
@ApiProperty({ required: false })
@Length(0, 3, {
message: 'Property p_middleinitial must be between 0 to 3 characters',
})
@IsString({ message: 'Property p_middleinitial must be a string' })
@IsOptional()
p_middleinitial?: string;
@ApiProperty({ required: false })
@Length(0, 50, { message: "Property p_title must be between 0 to 50 characters" })
@IsString({ message: "Property p_title must be a string" })
@IsOptional()
p_title?: string;
@ApiProperty({ required: false })
@Length(0, 50, {
message: 'Property p_title must be between 0 to 50 characters',
})
@IsString({ message: 'Property p_title must be a string' })
@IsOptional()
p_title?: string;
@ApiProperty({ required: true })
@Length(0, 20, { message: "Property p_phone must be between 0 to 20 characters" })
@IsString({ message: "Property p_phone must be a string" })
@IsDefined({ message: "Property p_phone is required" })
p_phone: string;
@ApiProperty({ required: true })
@Length(0, 20, {
message: 'Property p_phone must be between 0 to 20 characters',
})
@IsString({ message: 'Property p_phone must be a string' })
@IsDefined({ message: 'Property p_phone is required' })
p_phone: string;
@ApiProperty({ required: true })
@Length(0, 20, { message: "Property p_mobile must be between 0 to 20 characters" })
@IsString({ message: "Property p_mobile must be a string" })
@IsDefined({ message: "Property p_mobile is required" })
p_mobile: string;
@ApiProperty({ required: true })
@Length(0, 20, {
message: 'Property p_mobile must be between 0 to 20 characters',
})
@IsString({ message: 'Property p_mobile must be a string' })
@IsDefined({ message: 'Property p_mobile is required' })
p_mobile: string;
@ApiProperty({ required: false })
@Length(0, 20, { message: "Property p_fax must be between 0 to 20 characters" })
@IsString({ message: "Property p_fax must be a string" })
@IsOptional()
p_fax?: string;
@ApiProperty({ required: false })
@Length(0, 20, {
message: 'Property p_fax must be between 0 to 20 characters',
})
@IsString({ message: 'Property p_fax must be a string' })
@IsOptional()
p_fax?: string;
@ApiProperty({ required: true })
@Length(0, 100, { message: "Property p_emailaddress must be between 0 to 100 characters" })
@IsString({ message: "Property p_emailaddress must be a string" })
@IsDefined({ message: "Property p_emailaddress is required" })
p_emailaddress: string;
@ApiProperty({ required: true })
@Length(0, 100, {
message: 'Property p_emailaddress must be between 0 to 100 characters',
})
@IsString({ message: 'Property p_emailaddress must be a string' })
@IsDefined({ message: 'Property p_emailaddress is required' })
p_emailaddress: string;
@ApiProperty({ required: true })
@Length(0, 100, { message: "Property p_userid must be between 0 to 100 characters" })
@IsString({ message: "Property p_userid must be a string" })
@IsDefined({ message: "Property p_userid is required" })
p_userid: string;
@ApiProperty({ required: true })
@Length(0, 100, {
message: 'Property p_userid must be between 0 to 100 characters',
})
@IsString({ message: 'Property p_userid must be a string' })
@IsDefined({ message: 'Property p_userid is required' })
p_userid: string;
}
export class GetHolderOrContactDTO {
@ApiProperty({ required: true })
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
@Min(0, { message: "Property p_spid must be at least 0 or more" })
@IsInt({ message: "Property p_spid allows only whole numbers" })
@IsNumber({}, { message: "Property p_spid must be a number" })
@IsDefined({ message: "Property p_spid is required" })
p_spid: number;
@ApiProperty({ required: true })
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
@IsInt({ message: 'Property p_spid allows only whole numbers' })
@IsNumber({}, { message: 'Property p_spid must be a number' })
@IsDefined({ message: 'Property p_spid is required' })
p_spid: number;
@ApiProperty({ required: true })
@Max(999999999, { message: "Property p_holderid must not exceed 999999999" })
@Min(0, { message: "Property p_holderid must be at least 0 or more" })
@IsInt({ message: "Property p_holderid allows only whole numbers" })
@IsNumber({}, { message: "Property p_holderid must be a number" })
@IsDefined({ message: "Property p_holderid is required" })
p_holderid: number;
@ApiProperty({ required: true })
@Max(999999999, { message: 'Property p_holderid must not exceed 999999999' })
@Min(0, { message: 'Property p_holderid must be at least 0 or more' })
@IsInt({ message: 'Property p_holderid allows only whole numbers' })
@IsNumber({}, { message: 'Property p_holderid must be a number' })
@IsDefined({ message: 'Property p_holderid is required' })
p_holderid: number;
}
export class GetHolderContactActivateOrInactivateDTO {
@ApiProperty({ required: true })
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
@Min(0, { message: "Property p_spid must be at least 0 or more" })
@IsInt({ message: "Property p_spid allows only whole numbers" })
@IsNumber({}, { message: "Property p_spid must be a number" })
@IsDefined({ message: "Property p_spid is required" })
p_spid: number;
@ApiProperty({ required: true })
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
@IsInt({ message: 'Property p_spid allows only whole numbers' })
@IsNumber({}, { message: 'Property p_spid must be a number' })
@IsDefined({ message: 'Property p_spid is required' })
p_spid: number;
@ApiProperty({ required: true })
@Max(999999999, { message: "Property p_holderid must not exceed 999999999" })
@Min(0, { message: "Property p_holderid must be at least 0 or more" })
@IsInt({ message: "Property p_holderid allows only whole numbers" })
@IsNumber({}, { message: "Property p_holderid must be a number" })
@IsDefined({ message: "Property p_holderid is required" })
p_holderContactid: number;
@ApiProperty({ required: true })
@Max(999999999, { message: 'Property p_holderid must not exceed 999999999' })
@Min(0, { message: 'Property p_holderid must be at least 0 or more' })
@IsInt({ message: 'Property p_holderid allows only whole numbers' })
@IsNumber({}, { message: 'Property p_holderid must be a number' })
@IsDefined({ message: 'Property p_holderid is required' })
p_holderContactid: number;
}

View File

@ -4,8 +4,8 @@ import { ManageHoldersController } from './manage-holders.controller';
import { DbModule } from 'src/db/db.module';
@Module({
imports:[DbModule],
imports: [DbModule],
providers: [ManageHoldersService],
controllers: [ManageHoldersController]
controllers: [ManageHoldersController],
})
export class ManageHoldersModule {}

File diff suppressed because it is too large Load Diff

View File

@ -1,37 +0,0 @@
import { ApiProperty } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import { IsArray, IsDefined, IsEmail, IsNumber, IsOptional, IsString, ValidateNested } from 'class-validator';
//--------------------------------
export class UserDTO {
@ApiProperty({ required: true })
@IsNumber()
id: number;
@ApiProperty({ required: true })
@IsDefined({ message: "Property name is required" })
@IsString({ message: "property name is required" })
name: string;
}
export class TestDTO {
@ApiProperty({ required: true })
@IsNumber()
ItemNo: number;
@ApiProperty({ required: true, type: () => [UserDTO] })
@Type(() => UserDTO)
@ValidateNested({ each: true })
@IsArray()
user: UserDTO[];
}

View File

@ -8,9 +8,17 @@ import { ManageFeeModule } from './manage-fee/manage-fee.module';
import { ManageClientsModule } from './manage-clients/manage-clients.module';
@Module({
imports:[DbModule, HomePageModule, UscibManagedSpModule, ParamTableModule, ManageFeeModule, ManageHoldersModule, ManageClientsModule],
imports: [
DbModule,
HomePageModule,
UscibManagedSpModule,
ParamTableModule,
ManageFeeModule,
ManageHoldersModule,
ManageClientsModule,
],
providers: [],
controllers: [],
exports:[]
exports: [],
})
export class OracleModule {}

View File

@ -1,48 +1,63 @@
import { Body, Controller, Get, Patch, Post, Put, Query, UsePipes } from '@nestjs/common';
import { Body, Controller, Get, Patch, Post, Put, Query } 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';
import {
ActivateOrInactivateParamRecordDTO,
CreateParamRecordDTO,
CreateTableRecordDTO,
getParamValuesDTO,
UpdateParamRecordDTO,
} from './param-table.dto';
@Controller('param-table')
export class ParamTableController {
constructor(private readonly paramTableService: ParamTableService) {}
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')
@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('/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')
@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')
@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('/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)
}
@ApiTags('Param Table - Oracle')
@Put('/ReActivateParamRecord')
reActivateParamRecord(@Body() body: ActivateOrInactivateParamRecordDTO) {
return this.paramTableService.REACTIVATEPARAMRECORD(body);
}
}

View File

@ -1,140 +1,147 @@
import { ApiProperty } from "@nestjs/swagger";
import { Transform } from "class-transformer";
import { IsDefined, IsInt, IsNumber, IsOptional, IsString, Min, ValidateIf } from "class-validator";
import { ApiProperty } from '@nestjs/swagger';
import { Transform } from 'class-transformer';
import {
IsDefined,
IsInt,
IsNumber,
IsOptional,
IsString,
Min,
} 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_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;
@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: false })
@IsOptional()
@IsNumber()
P_SPID?: number;
@ApiProperty({ required: true })
@IsString()
P_PARAMTYPE: string;
@ApiProperty({ required: true })
@IsString()
P_PARAMTYPE: string;
@ApiProperty({ required: true })
@IsString()
P_PARAMDESC: string;
@ApiProperty({ required: true })
@IsString()
P_PARAMDESC: string;
@ApiProperty({ required: true })
@IsString()
P_PARAMVALUE: string;
@ApiProperty({ required: true })
@IsString()
P_PARAMVALUE: string;
@ApiProperty({ required: false })
@IsOptional()
@IsString()
P_ADDLPARAMVALUE1?: string;
@ApiProperty({ required: false })
@IsOptional()
@IsString()
P_ADDLPARAMVALUE1?: string;
@ApiProperty({ required: false })
@IsOptional()
@IsString()
P_ADDLPARAMVALUE2?: string;
@ApiProperty({ required: false })
@IsOptional()
@IsString()
P_ADDLPARAMVALUE2?: string;
@ApiProperty({ required: false })
@IsOptional()
@IsString()
P_ADDLPARAMVALUE3?: string;
@ApiProperty({ required: false })
@IsOptional()
@IsString()
P_ADDLPARAMVALUE3?: string;
@ApiProperty({ required: false })
@IsOptional()
@IsString()
P_ADDLPARAMVALUE4?: string;
@ApiProperty({ required: false })
@IsOptional()
@IsString()
P_ADDLPARAMVALUE4?: string;
@ApiProperty({ required: false })
@IsOptional()
@IsString()
P_ADDLPARAMVALUE5?: string;
@ApiProperty({ required: false })
@IsOptional()
@IsString()
P_ADDLPARAMVALUE5?: string;
@ApiProperty({ required: true })
@IsNumber()
P_SORTSEQ: number;
@ApiProperty({ required: true })
@IsNumber()
P_SORTSEQ: number;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
}
export class UpdateParamRecordDTO {
@ApiProperty({ required: false })
@IsOptional()
@IsNumber()
P_SPID?: number;
@ApiProperty({ required: false })
@IsOptional()
@IsNumber()
P_SPID?: number;
@ApiProperty({ required: true })
@IsNumber()
P_PARAMID: number;
@ApiProperty({ required: true })
@IsNumber()
P_PARAMID: number;
@ApiProperty({ required: true })
@IsString()
P_PARAMDESC: string;
@ApiProperty({ required: true })
@IsString()
P_PARAMDESC: string;
@ApiProperty({ required: false })
@IsOptional()
@IsString()
P_ADDLPARAMVALUE1?: string;
@ApiProperty({ required: false })
@IsOptional()
@IsString()
P_ADDLPARAMVALUE1?: string;
@ApiProperty({ required: false })
@IsOptional()
@IsString()
P_ADDLPARAMVALUE2?: string;
@ApiProperty({ required: false })
@IsOptional()
@IsString()
P_ADDLPARAMVALUE2?: string;
@ApiProperty({ required: false })
@IsOptional()
@IsString()
P_ADDLPARAMVALUE3?: string;
@ApiProperty({ required: false })
@IsOptional()
@IsString()
P_ADDLPARAMVALUE3?: string;
@ApiProperty({ required: false })
@IsOptional()
@IsString()
P_ADDLPARAMVALUE4?: string;
@ApiProperty({ required: false })
@IsOptional()
@IsString()
P_ADDLPARAMVALUE4?: string;
@ApiProperty({ required: false })
@IsOptional()
@IsString()
P_ADDLPARAMVALUE5?: string;
@ApiProperty({ required: false })
@IsOptional()
@IsString()
P_ADDLPARAMVALUE5?: string;
@ApiProperty({ required: true })
@IsNumber()
P_SORTSEQ: number;
@ApiProperty({ required: true })
@IsNumber()
P_SORTSEQ: number;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
@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;
@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;
@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 })
@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;
}
@ApiProperty({ required: true })
@IsString({ message: 'Property P_USERID must be a string' })
@IsDefined({ message: 'Property P_USERID is required' })
P_USERID: string;
}

View File

@ -4,6 +4,6 @@ import { ParamTableService } from './param-table.service';
@Module({
controllers: [ParamTableController],
providers: [ParamTableService]
providers: [ParamTableService],
})
export class ParamTableModule {}

View File

@ -1,128 +1,134 @@
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';
import * as oracledb from 'oracledb';
import {
ActivateOrInactivateParamRecordDTO,
CreateParamRecordDTO,
CreateTableRecordDTO,
getParamValuesDTO,
UpdateParamRecordDTO,
} from './param-table.dto';
@Injectable()
export class ParamTableService {
constructor(private readonly oracleDBService: OracleDBService) { }
constructor(private readonly oracleDBService: OracleDBService) {}
async GETPARAMVALUES(body:getParamValuesDTO) {
async GETPARAMVALUES(body: getParamValuesDTO) {
const finalBody = {
P_SPID: body.P_SPID ? body.P_SPID : null,
P_PARAMTYPE: body.P_PARAMTYPE ? body.P_PARAMTYPE : null,
};
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');
}
let connection;
let rows = [];
try {
connection = await this.oracleDBService.getConnection()
if (!connection) {
throw new Error('No DB Connected')
}
const result = await connection.execute(
`BEGIN
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
}
);
{
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;
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);
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');
}
await cursor.close();
} else {
throw new Error('No cursor returned from the stored procedure');
}
return rows;
} catch (err) {
return { error: err.message }
} finally { }
return rows;
} catch (err) {
if (err instanceof Error) {
return { error: err.message };
} else {
return { error: 'An unknown error occurred' };
}
}
}
async CREATETABLERECORD(body: CreateTableRecordDTO) {
let connection;
try {
connection = await this.oracleDBService.getConnection()
if (!connection) {
throw new Error('No DB Connected')
}
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
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_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();
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();
const fres = await result.outBinds.p_cursor.getRows();
return fres
} catch (err) {
return { error: err.message }
} finally { }
return fres;
} catch (err) {
if (err instanceof Error) {
return { error: err.message };
} else {
return { error: 'An unknown error occurred' };
}
}
}
async CREATEPARAMRECORD(body: CreateParamRecordDTO) {
let connection;
try {
connection = await this.oracleDBService.getConnection()
if (!connection) {
throw new Error('No DB Connected')
}
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
const result = await connection.execute(
`BEGIN
MANAGEPARAMTABLE_PKG.CREATEPARAMRECORD(
:P_SPID,
:P_PARAMTYPE,
@ -137,84 +143,85 @@ export class ParamTableService {
: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_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();
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();
const fres = await result.outBinds.p_cursor.getRows();
return fres
} catch (err) {
return { error: err.message }
} finally { }
return fres;
} catch (err) {
if (err instanceof Error) {
return { error: err.message };
} else {
return { error: 'An unknown error occurred' };
}
}
}
async UPDATEPARAMRECORD(body: UpdateParamRecordDTO) {
let connection;
try {
connection = await this.oracleDBService.getConnection()
if (!connection) {
throw new Error('No DB Connected')
}
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
const result = await connection.execute(
`BEGIN
MANAGEPARAMTABLE_PKG.UPDATEPARAMRECORD(
:P_SPID,
:P_PARAMID,
@ -228,140 +235,142 @@ export class ParamTableService {
: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_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();
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();
const fres = await result.outBinds.p_cursor.getRows();
return fres
} catch (err) {
return { error: err.message }
} finally { }
return fres;
} catch (err) {
if (err instanceof Error) {
return { error: err.message };
} else {
return { error: 'An unknown error occurred' };
}
}
}
async INACTIVATEPARAMRECORD(body: ActivateOrInactivateParamRecordDTO) {
let connection;
try {
connection = await this.oracleDBService.getConnection()
if (!connection) {
throw new Error('No DB Connected')
}
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
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();
{
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 { }
return 'SP Executed Successfully';
} catch (err) {
if (err instanceof Error) {
return { error: err.message };
} else {
return { error: 'An unknown error occurred' };
}
}
}
async REACTIVATEPARAMRECORD(body: ActivateOrInactivateParamRecordDTO) {
let connection;
try {
connection = await this.oracleDBService.getConnection()
if (!connection) {
throw new Error('No DB Connected')
}
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
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();
{
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 { }
return 'SP Executed Successfully';
} catch (err) {
if (err instanceof Error) {
return { error: err.message };
} else {
return { error: 'An unknown error occurred' };
}
}
}
}

View File

@ -1,22 +1,24 @@
import { Body, Controller, Get, Param, ParseIntPipe, Post, Query } from '@nestjs/common';
import { CreateCarnetSequenceDTO, GetCarnetSequenceDTO } from './carnet-sequence.dto';
import { Body, Controller, Get, 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')
export class CarnetSequenceController {
constructor(private readonly carnetSequenceService: CarnetSequenceService) {}
constructor(private readonly carnetSequenceService:CarnetSequenceService){}
@ApiTags('Carnet Sequence - Oracle')
@Post('/CreateCarnetSequence/')
createCarnetSequence(@Body() body: CreateCarnetSequenceDTO) {
return this.carnetSequenceService.createCarnetSequence(body)
}
@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)
}
@ApiTags('Carnet Sequence - Oracle')
@Get('/GetCarnetSequence')
getCarnetSequence(@Query() body: GetCarnetSequenceDTO) {
return this.carnetSequenceService.getCarnetSequence(body);
}
}

View File

@ -1,42 +1,42 @@
import { ApiProperty } from "@nestjs/swagger";
import { Transform } from "class-transformer";
import { IsDefined, IsInt, IsNumber, IsString, Min } from "class-validator";
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_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_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_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 })
@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;
@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;
}
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;
}

View File

@ -4,6 +4,6 @@ import { CarnetSequenceService } from './carnet-sequence.service';
@Module({
controllers: [CarnetSequenceController],
providers: [CarnetSequenceService]
providers: [CarnetSequenceService],
})
export class CarnetSequenceModule {}

View File

@ -1,23 +1,25 @@
import { Injectable } from '@nestjs/common';
import * as oracledb from 'oracledb';
import { OracleDBService } from 'src/db/db.service';
import { CreateCarnetSequenceDTO, GetCarnetSequenceDTO } from './carnet-sequence.dto';
import {
CreateCarnetSequenceDTO,
GetCarnetSequenceDTO,
} from './carnet-sequence.dto';
@Injectable()
export class CarnetSequenceService {
constructor(private readonly oracleDBService: OracleDBService) {}
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');
}
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
const result = await connection.execute(
`BEGIN
USCIB_Managed_Pkg.CreateCarnetSequence(
:p_spid,
:p_regionid,
@ -25,99 +27,104 @@ export class CarnetSequenceService {
: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
}
);
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();
await connection.commit();
let fres = await result.outBinds.p_cursor.getRows();
const fres = await result.outBinds.p_cursor.getRows();
await result.outBinds.p_cursor.close()
await result.outBinds.p_cursor.close();
return fres
} catch (err) {
return { error: err.message }
} finally { }
return fres;
} catch (err) {
if (err instanceof Error) {
return { error: err.message };
} else {
return { error: 'An unknown error occurred' };
}
}
}
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')
}
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
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
}
);
{
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;
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);
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');
}
await cursor.close();
} else {
throw new Error('No cursor returned from the stored procedure');
}
return rows;
} catch (err) {
return { error: err.message }
} finally { }
return rows;
} catch (err) {
if (err instanceof Error) {
return { error: err.message };
} else {
return { error: 'An unknown error occurred' };
}
}
}
}

View File

@ -1,38 +1,29 @@
import { RegionService } from './region.service';
import {
Get,
Post,
Body,
Controller,
Patch,
} from '@nestjs/common';
import { Get, Post, Body, Controller, Patch } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger';
import { InsertRegionsDto, UpdateRegionDto } from './region.dto';
@Controller('oracle')
export class RegionController {
constructor(private readonly regionService: RegionService) {}
constructor(
private readonly regionService: RegionService
) { }
@ApiTags('Regions - Oracle')
@Post('/InsertRegions')
insertRegions(@Body() body: InsertRegionsDto) {
return this.regionService.insertRegions(body);
}
@ApiTags('Regions - Oracle')
@Post('/InsertRegions')
insertRegions(@Body() body: InsertRegionsDto) {
return this.regionService.insertRegions(body);
}
@ApiTags('Regions - Oracle')
@Patch('/UpdateRegion')
updateRegions(@Body() body: UpdateRegionDto) {
return this.regionService.updateRegions(body);
}
@ApiTags('Regions - Oracle')
@Patch('/UpdateRegion')
updateRegions(@Body() body: UpdateRegionDto) {
return this.regionService.updateRegions(body);
}
@ApiTags('Regions - Oracle')
@Get('/GetRegions')
getRegions() {
return this.regionService.getRegions();
}
@ApiTags('Regions - Oracle')
@Get('/GetRegions')
getRegions() {
return this.regionService.getRegions();
}
}

View File

@ -1,26 +1,26 @@
import { IsDefined, IsNumber,IsString } from "class-validator";
import { ApiProperty } from "@nestjs/swagger";
import { IsDefined, IsNumber, IsString } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';
export class InsertRegionsDto {
@ApiProperty({ required: true })
@IsString({ message: "Property p_region must be a string" })
@IsDefined({ message: "Property p_region is required" })
p_region: string;
@ApiProperty({ required: true })
@IsString({ message: 'Property p_region must be a string' })
@IsDefined({ message: 'Property p_region is required' })
p_region: string;
@ApiProperty({ required: true })
@IsString({ message: "Property p_name must be a string" })
@IsDefined({ message: "Property p_name is required" })
p_name: string;
@ApiProperty({ required: true })
@IsString({ message: 'Property p_name must be a string' })
@IsDefined({ message: 'Property p_name is required' })
p_name: string;
}
export class UpdateRegionDto {
@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_regionID must be a number' })
@IsDefined({ message: 'Property p_regionID is required' })
p_regionID: number;
@ApiProperty({ required: true })
@IsString({ message: "Property p_name must be a string" })
@IsDefined({ message: "Property p_name is required" })
p_name: string;
}
@ApiProperty({ required: true })
@IsString({ message: 'Property p_name must be a string' })
@IsDefined({ message: 'Property p_name is required' })
p_name: string;
}

View File

@ -4,6 +4,6 @@ import { RegionService } from './region.service';
@Module({
controllers: [RegionController],
providers: [RegionService]
})
providers: [RegionService],
})
export class RegionModule {}

View File

@ -1,142 +1,148 @@
import { Injectable } from '@nestjs/common';
import { OracleDBService } from 'src/db/db.service';
import * as oracledb from 'oracledb'
import * as oracledb from 'oracledb';
import { InsertRegionsDto, UpdateRegionDto } from './region.dto';
@Injectable()
export class RegionService {
constructor(private readonly oracleDBService: OracleDBService) {}
constructor(private readonly oracleDBService: OracleDBService) { }
async insertRegions(body: InsertRegionsDto) {
let connection;
try {
connection = await this.oracleDBService.getConnection();
if (!connection) {
throw new Error('No DB Connected');
}
async insertRegions(body: InsertRegionsDto) {
let connection;
try {
connection = await this.oracleDBService.getConnection()
if (!connection) {
throw new Error('No DB Connected')
}
const result = await connection.execute(
`BEGIN
const result = await connection.execute(
`BEGIN
USCIB_Managed_Pkg.InsertNewRegion(:p_region,:p_name,:p_cursor);
END;`, {
p_region: {
val: body.p_region,
type: oracledb.DB_TYPE_VARCHAR
},
p_name: {
val: body.p_name,
type: oracledb.DB_TYPE_VARCHAR
},
p_cursor: {
type: oracledb.CURSOR,
dir: oracledb.BIND_OUT
}
}, {
outFormat: oracledb.OUT_FORMAT_OBJECT
}
);
END;`,
{
p_region: {
val: body.p_region,
type: oracledb.DB_TYPE_VARCHAR,
},
p_name: {
val: body.p_name,
type: oracledb.DB_TYPE_VARCHAR,
},
p_cursor: {
type: oracledb.CURSOR,
dir: oracledb.BIND_OUT,
},
},
{
outFormat: oracledb.OUT_FORMAT_OBJECT,
},
);
await connection.commit();
await connection.commit();
let fres = await result.outBinds.p_cursor.getRows();
const fres = await result.outBinds.p_cursor.getRows();
return fres
} catch (err) {
return { error: err.message }
} finally { }
return fres;
} catch (err) {
if (err instanceof Error) {
return { error: err.message };
} else {
return { error: 'An unknown error occurred' };
}
}
}
async updateRegions(body: UpdateRegionDto) {
let connection;
try {
connection = await this.oracleDBService.getConnection()
if (!connection) {
throw new Error('No DB Connected')
}
async updateRegions(body: UpdateRegionDto) {
let connection;
try {
connection = await this.oracleDBService.getConnection();
if (!connection) {
throw new Error('No DB Connected');
}
const result = await connection.execute(
`BEGIN
const result = await connection.execute(
`BEGIN
USCIB_Managed_Pkg.UpdateRegion(:p_regionID,:p_name,:p_cursor);
END;`, {
p_regionID: {
val: body.p_regionID,
type: oracledb.DB_TYPE_NUMBER
},
p_name: {
val: body.p_name,
type: oracledb.DB_TYPE_VARCHAR
},
p_cursor: {
type: oracledb.CURSOR,
dir: oracledb.BIND_OUT
}
}, {
outFormat: oracledb.OUT_FORMAT_OBJECT
}
);
END;`,
{
p_regionID: {
val: body.p_regionID,
type: oracledb.DB_TYPE_NUMBER,
},
p_name: {
val: body.p_name,
type: oracledb.DB_TYPE_VARCHAR,
},
p_cursor: {
type: oracledb.CURSOR,
dir: oracledb.BIND_OUT,
},
},
{
outFormat: oracledb.OUT_FORMAT_OBJECT,
},
);
await connection.commit();
await connection.commit();
let fres = await result.outBinds.p_cursor.getRows();
const fres = await result.outBinds.p_cursor.getRows();
return fres
} catch (err) {
return { error: err.message }
} finally { }
return fres;
} catch (err) {
if (err instanceof Error) {
return { error: err.message };
} else {
return { error: 'An unknown error occurred' };
}
}
}
async getRegions() {
let connection;
let rows = [];
try {
try {
connection = await this.oracleDBService.getConnection()
}
catch (err) {
console.log("DB ERROR: ", err);
return { error: "Error while connecting to DB" }
}
const result = await connection.execute(
`BEGIN
async getRegions() {
let connection;
let rows = [];
try {
try {
connection = await this.oracleDBService.getConnection();
} catch (err) {
console.log('DB ERROR: ', err);
return { error: 'Error while connecting to DB' };
}
const result = await connection.execute(
`BEGIN
USCIB_Managed_Pkg.GetRegions(:p_cursor);
END;`,
{
p_cursor: {
type: oracledb.CURSOR,
dir: oracledb.BIND_OUT
}
},
{
outFormat: oracledb.OUT_FORMAT_OBJECT
}
);
{
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;
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);
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');
}
await cursor.close();
} else {
throw new Error('No cursor returned from the stored procedure');
}
return rows;
} catch (err) {
return { error: err.message }
} finally { }
return rows;
} catch (err) {
if (err instanceof Error) {
return { error: err.message };
} else {
return { error: 'An unknown error occurred' };
}
}
}
}

View File

@ -1,47 +1,50 @@
import { SpContactsService } from './sp-contacts.service';
import { Body, Controller, Get, Param, ParseIntPipe, Post, Put, Query } from '@nestjs/common';
import { getSPDefaultcontactDTO, inactivateSPContactDTO, InsertSPContactsDTO, setSPDefaultcontactDTO, UpdateSPContactsDTO } from './sp-contacts.dto';
import { Body, Controller, Get, Post, Put, Query } from '@nestjs/common';
import {
getSPDefaultcontactDTO,
inactivateSPContactDTO,
InsertSPContactsDTO,
setSPDefaultcontactDTO,
UpdateSPContactsDTO,
} from './sp-contacts.dto';
import { ApiTags } from '@nestjs/swagger';
@Controller('oracle')
export class SpContactsController {
constructor(private readonly spContactsService: SpContactsService) {}
constructor(
private readonly spContactsService: SpContactsService,
) { }
@ApiTags('SPContacts - Oracle')
@Post('/InsertSPContacts')
insertSPContacts(@Body() body: InsertSPContactsDTO) {
return this.spContactsService.insertSPContacts(body);
}
@ApiTags('SPContacts - Oracle')
@Post('/InsertSPContacts')
insertSPContacts(@Body() body: InsertSPContactsDTO) {
return this.spContactsService.insertSPContacts(body)
}
@ApiTags('SPContacts - Oracle')
@Post('/SetSPDefaultcontact')
setSPDefaultcontact(@Query() body: setSPDefaultcontactDTO) {
return this.spContactsService.setSPDefaultcontact(body);
}
@ApiTags('SPContacts - Oracle')
@Post('/SetSPDefaultcontact')
setSPDefaultcontact(@Query() body:setSPDefaultcontactDTO) {
return this.spContactsService.setSPDefaultcontact(body)
}
@ApiTags('SPContacts - Oracle')
@Put('/UpdateSPContacts')
updateSPContacts(@Body() body: UpdateSPContactsDTO) {
return this.spContactsService.updateSPContacts(body);
}
@ApiTags('SPContacts - Oracle')
@Put('/UpdateSPContacts')
updateSPContacts(@Body() body: UpdateSPContactsDTO) {
return this.spContactsService.updateSPContacts(body)
}
@ApiTags('SPContacts - Oracle')
@Post('/InactivateSPContact')
inactivateSPContact(@Query() body: inactivateSPContactDTO) {
return this.spContactsService.inactivateSPContact(body);
}
@ApiTags('SPContacts - Oracle')
@Post('/InactivateSPContact')
inactivateSPContact(@Query() body:inactivateSPContactDTO) {
return this.spContactsService.inactivateSPContact(body)
}
@ApiTags('SPContacts - Oracle')
@Get('/GetSPDefaultcontact')
getSPDefaultcontact(@Query() body: getSPDefaultcontactDTO) {
return this.spContactsService.getSPDefaultcontacts(body);
}
@ApiTags('SPContacts - Oracle')
@Get('/GetSPDefaultcontact')
getSPDefaultcontact(@Query() body:getSPDefaultcontactDTO) {
return this.spContactsService.getSPDefaultcontacts(body)
}
// @Get('/GetAllSPcontacts')
// getSPcontacts() {
// return this.oarcleService.getSPcontacts();
// }
// @Get('/GetAllSPcontacts')
// getSPcontacts() {
// return this.oarcleService.getSPcontacts();
// }
}

View File

@ -1,112 +1,119 @@
import { ApiProperty } from '@nestjs/swagger';
import { Transform } from 'class-transformer';
import { IsDefined, IsEmail, IsInt, IsNumber, IsString, Min } from 'class-validator';
import {
IsDefined,
IsEmail,
IsInt,
IsNumber,
IsString,
Min,
} from 'class-validator';
export class InsertSPContactsDTO {
@ApiProperty({ required: true })
@IsNumber()
p_spid: number;
@ApiProperty({ required: true })
@IsNumber()
p_spid: number;
@ApiProperty({ required: true })
@IsString()
p_defcontactflag: string;
@ApiProperty({ required: true })
@IsString()
p_defcontactflag: string;
@ApiProperty({ required: true })
@IsString()
p_firstname: string;
@ApiProperty({ required: true })
@IsString()
p_firstname: string;
@ApiProperty({ required: true })
@IsString()
p_lastname: string;
@ApiProperty({ required: true })
@IsString()
p_lastname: string;
@ApiProperty({ required: false })
@IsString()
P_MIDDLEINITIAL: string;
@ApiProperty({ required: false })
@IsString()
P_MIDDLEINITIAL: string;
@ApiProperty({ required: true })
@IsString()
p_title: string;
@ApiProperty({ required: true })
@IsString()
p_title: string;
@ApiProperty({ required: true })
@IsString()
p_phoneno: string;
@ApiProperty({ required: true })
@IsString()
p_phoneno: string;
@ApiProperty({ required: true })
@IsString()
p_mobileno: string;
@ApiProperty({ required: true })
@IsString()
p_mobileno: string;
@ApiProperty({ required: true })
@IsString()
p_faxno: string;
@ApiProperty({ required: true })
@IsString()
p_faxno: string;
@ApiProperty({ required: true })
@IsEmail()
p_emailaddress: string;
@ApiProperty({ required: true })
@IsEmail()
p_emailaddress: string;
@ApiProperty({ required: true })
@IsString()
p_user_id: string;
@ApiProperty({ required: true })
@IsString()
p_user_id: string;
}
export class UpdateSPContactsDTO {
@ApiProperty({ required: true })
@IsNumber()
p_spcontactid: number;
@ApiProperty({ required: true })
@IsNumber()
p_spcontactid: number;
@ApiProperty({ required: true })
@IsString()
p_firstname: string;
@ApiProperty({ required: true })
@IsString()
p_firstname: string;
@ApiProperty({ required: true })
@IsString()
p_lastname: string;
@ApiProperty({ required: true })
@IsString()
p_lastname: string;
@ApiProperty({ required: false })
@IsString()
P_MIDDLEINITIAL: string;
@ApiProperty({ required: false })
@IsString()
P_MIDDLEINITIAL: string;
@ApiProperty({ required: true })
@IsString()
p_title: string;
@ApiProperty({ required: true })
@IsString()
p_title: string;
@ApiProperty({ required: true })
@IsString()
p_phoneno: string;
@ApiProperty({ required: true })
@IsString()
p_phoneno: string;
@ApiProperty({ required: true })
@IsString()
p_mobileno: string;
@ApiProperty({ required: true })
@IsString()
p_mobileno: string;
@ApiProperty({ required: true })
@IsString()
p_faxno: string;
@ApiProperty({ required: true })
@IsString()
p_faxno: string;
@ApiProperty({ required: true })
@IsEmail()
p_emailaddress: string;
@ApiProperty({ required: true })
@IsEmail()
p_emailaddress: string;
@ApiProperty({ required: true })
@IsString()
p_user_id: string;
@ApiProperty({ required: true })
@IsString()
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 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 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;
}
@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;
}

View File

@ -4,8 +4,8 @@ import { SpContactsController } from './sp-contacts.controller';
import { DbModule } from 'src/db/db.module';
@Module({
imports:[DbModule],
imports: [DbModule],
providers: [SpContactsService],
controllers: [SpContactsController]
controllers: [SpContactsController],
})
export class SpContactsModule {}

View File

@ -1,30 +1,28 @@
import { Injectable } from '@nestjs/common';
import { OracleDBService } from 'src/db/db.service';
import * as oracledb from 'oracledb'
import * as oracledb from 'oracledb';
import {
getSPDefaultcontactDTO,
inactivateSPContactDTO,
InsertSPContactsDTO,
setSPDefaultcontactDTO,
UpdateSPContactsDTO
getSPDefaultcontactDTO,
inactivateSPContactDTO,
InsertSPContactsDTO,
setSPDefaultcontactDTO,
UpdateSPContactsDTO,
} from './sp-contacts.dto';
@Injectable()
export class SpContactsService {
constructor(private readonly oracleDBService: OracleDBService) {}
constructor(private readonly oracleDBService: OracleDBService) { }
async insertSPContacts(body: InsertSPContactsDTO) {
let connection;
try {
connection = await this.oracleDBService.getConnection();
if (!connection) {
throw new Error('No DB Connected');
}
async insertSPContacts(body: InsertSPContactsDTO) {
let connection;
try {
connection = await this.oracleDBService.getConnection()
if (!connection) {
throw new Error('No DB Connected')
}
const result = await connection.execute(
`BEGIN
const result = await connection.execute(
`BEGIN
USCIB_Managed_Pkg.InsertSPContacts(
:p_spid,
:p_defcontactflag,
@ -38,116 +36,118 @@ export class SpContactsService {
:p_emailaddress,
:p_user_id,
:p_cursor);
END;`, {
p_spid: {
val: body.p_spid,
type: oracledb.DB_TYPE_NUMBER
},
p_defcontactflag: {
val: body.p_defcontactflag,
type: oracledb.DB_TYPE_VARCHAR
},
p_firstname: {
val: body.p_firstname,
type: oracledb.DB_TYPE_VARCHAR
},
p_lastname: {
val: body.p_lastname,
type: oracledb.DB_TYPE_VARCHAR
},
P_MIDDLEINITIAL: {
val: body.P_MIDDLEINITIAL,
type: oracledb.DB_TYPE_VARCHAR
},
p_title: {
val: body.p_title,
type: oracledb.DB_TYPE_VARCHAR
},
p_phoneno: {
val: body.p_phoneno,
type: oracledb.DB_TYPE_VARCHAR
},
p_mobileno: {
val: body.p_mobileno,
type: oracledb.DB_TYPE_VARCHAR
},
p_faxno: {
val: body.p_faxno,
type: oracledb.DB_TYPE_VARCHAR
},
p_emailaddress: {
val: body.p_emailaddress,
type: oracledb.DB_TYPE_VARCHAR
},
p_user_id: {
val: body.p_user_id,
type: oracledb.DB_TYPE_VARCHAR
},
p_cursor: {
type: oracledb.CURSOR,
dir: oracledb.BIND_OUT
}
}, {
outFormat: oracledb.OUT_FORMAT_OBJECT
}
);
END;`,
{
p_spid: {
val: body.p_spid,
type: oracledb.DB_TYPE_NUMBER,
},
p_defcontactflag: {
val: body.p_defcontactflag,
type: oracledb.DB_TYPE_VARCHAR,
},
p_firstname: {
val: body.p_firstname,
type: oracledb.DB_TYPE_VARCHAR,
},
p_lastname: {
val: body.p_lastname,
type: oracledb.DB_TYPE_VARCHAR,
},
P_MIDDLEINITIAL: {
val: body.P_MIDDLEINITIAL,
type: oracledb.DB_TYPE_VARCHAR,
},
p_title: {
val: body.p_title,
type: oracledb.DB_TYPE_VARCHAR,
},
p_phoneno: {
val: body.p_phoneno,
type: oracledb.DB_TYPE_VARCHAR,
},
p_mobileno: {
val: body.p_mobileno,
type: oracledb.DB_TYPE_VARCHAR,
},
p_faxno: {
val: body.p_faxno,
type: oracledb.DB_TYPE_VARCHAR,
},
p_emailaddress: {
val: body.p_emailaddress,
type: oracledb.DB_TYPE_VARCHAR,
},
p_user_id: {
val: body.p_user_id,
type: oracledb.DB_TYPE_VARCHAR,
},
p_cursor: {
type: oracledb.CURSOR,
dir: oracledb.BIND_OUT,
},
},
{
outFormat: oracledb.OUT_FORMAT_OBJECT,
},
);
await connection.commit();
await connection.commit();
let fres = await result.outBinds.p_cursor.getRows();
const fres = await result.outBinds.p_cursor.getRows();
return fres
} catch (err) {
return { error: err.message }
} finally { }
return fres;
} catch (err) {
if (err instanceof Error) {
return { error: err.message };
} else {
return { error: 'An unknown error occurred' };
}
}
}
async setSPDefaultcontact(body: setSPDefaultcontactDTO) {
async setSPDefaultcontact(body: setSPDefaultcontactDTO) {
let connection;
try {
connection = await this.oracleDBService.getConnection();
if (!connection) {
throw new Error('No DB Connected');
}
let connection;
try {
connection = await this.oracleDBService.getConnection()
if (!connection) {
throw new Error('No DB Connected')
}
const result = await connection.execute(
`BEGIN
const result = await connection.execute(
`BEGIN
USCIB_Managed_Pkg.SetDefaultContact(:p_spcontactid);
END;`,
{
p_spcontactid: {
val: body.p_spcontactid,
type: oracledb.DB_TYPE_NUMBER
},
}
);
{
p_spcontactid: {
val: body.p_spcontactid,
type: oracledb.DB_TYPE_NUMBER,
},
},
);
await connection.commit();
return "SP executed successfully"
} catch (err) {
return { error: err.message }
} finally { }
await connection.commit();
return 'SP executed successfully';
} catch (err) {
if (err instanceof Error) {
return { error: err.message };
} else {
return { error: 'An unknown error occurred' };
}
}
}
async updateSPContacts(body: UpdateSPContactsDTO) {
let connection;
try {
async updateSPContacts(body: UpdateSPContactsDTO) {
let connection;
try {
connection = await this.oracleDBService.getConnection();
if (!connection) {
throw new Error('No DB Connected');
}
connection = await this.oracleDBService.getConnection()
if (!connection) {
throw new Error('No DB Connected')
}
const result = await connection.execute(
`BEGIN
const result = await connection.execute(
`BEGIN
USCIB_Managed_Pkg.UpdateSPContacts(
:p_spcontactid,
:p_firstname,
@ -160,201 +160,201 @@ export class SpContactsService {
:p_emailaddress,
:p_user_id,
:p_cursor);
END;`, {
p_spcontactid: {
val: body.p_spcontactid,
type: oracledb.DB_TYPE_NUMBER
},
p_firstname: {
val: body.p_firstname,
type: oracledb.DB_TYPE_VARCHAR
},
p_lastname: {
val: body.p_lastname,
type: oracledb.DB_TYPE_VARCHAR
},
P_MIDDLEINITIAL: {
val: body.P_MIDDLEINITIAL,
type: oracledb.DB_TYPE_VARCHAR
},
p_title: {
val: body.p_title,
type: oracledb.DB_TYPE_VARCHAR
},
p_phoneno: {
val: body.p_phoneno,
type: oracledb.DB_TYPE_VARCHAR
},
p_mobileno: {
val: body.p_mobileno,
type: oracledb.DB_TYPE_VARCHAR
},
p_faxno: {
val: body.p_faxno,
type: oracledb.DB_TYPE_VARCHAR
},
p_emailaddress: {
val: body.p_emailaddress,
type: oracledb.DB_TYPE_VARCHAR
},
p_user_id: {
val: body.p_user_id,
type: oracledb.DB_TYPE_VARCHAR
},
p_cursor: {
type: oracledb.CURSOR,
dir: oracledb.BIND_OUT
}
}, {
outFormat: oracledb.OUT_FORMAT_OBJECT
}
);
END;`,
{
p_spcontactid: {
val: body.p_spcontactid,
type: oracledb.DB_TYPE_NUMBER,
},
p_firstname: {
val: body.p_firstname,
type: oracledb.DB_TYPE_VARCHAR,
},
p_lastname: {
val: body.p_lastname,
type: oracledb.DB_TYPE_VARCHAR,
},
P_MIDDLEINITIAL: {
val: body.P_MIDDLEINITIAL,
type: oracledb.DB_TYPE_VARCHAR,
},
p_title: {
val: body.p_title,
type: oracledb.DB_TYPE_VARCHAR,
},
p_phoneno: {
val: body.p_phoneno,
type: oracledb.DB_TYPE_VARCHAR,
},
p_mobileno: {
val: body.p_mobileno,
type: oracledb.DB_TYPE_VARCHAR,
},
p_faxno: {
val: body.p_faxno,
type: oracledb.DB_TYPE_VARCHAR,
},
p_emailaddress: {
val: body.p_emailaddress,
type: oracledb.DB_TYPE_VARCHAR,
},
p_user_id: {
val: body.p_user_id,
type: oracledb.DB_TYPE_VARCHAR,
},
p_cursor: {
type: oracledb.CURSOR,
dir: oracledb.BIND_OUT,
},
},
{
outFormat: oracledb.OUT_FORMAT_OBJECT,
},
);
await connection.commit();
await connection.commit();
let fres = await result.outBinds.p_cursor.getRows();
const fres = await result.outBinds.p_cursor.getRows();
return fres
} catch (err) {
return { error: err.message }
} finally { }
return fres;
} catch (err) {
if (err instanceof Error) {
return { error: err.message };
} else {
return { error: 'An unknown error occurred' };
}
}
}
async inactivateSPContact(body: inactivateSPContactDTO) {
async inactivateSPContact(body: inactivateSPContactDTO) {
let connection;
try {
connection = await this.oracleDBService.getConnection();
if (!connection) {
throw new Error('No DB Connected');
}
let connection;
try {
connection = await this.oracleDBService.getConnection()
if (!connection) {
throw new Error('No DB Connected')
}
const result = await connection.execute(
`BEGIN
const result = await connection.execute(
`BEGIN
USCIB_Managed_Pkg.InActivateSPContacts(:p_spcontactid);
END;`, {
p_spcontactid: {
val: body.p_spcontactid,
type: oracledb.DB_TYPE_NUMBER
}
}
);
END;`,
{
p_spcontactid: {
val: body.p_spcontactid,
type: oracledb.DB_TYPE_NUMBER,
},
},
);
await connection.commit();
return "SP executed successfully"
} catch (err) {
return { error: err.message }
} finally { }
await connection.commit();
return 'SP executed successfully';
} catch (err) {
if (err instanceof Error) {
return { error: err.message };
} else {
return { error: 'An unknown error occurred' };
}
}
}
async getSPDefaultcontacts(body: getSPDefaultcontactDTO) {
async getSPDefaultcontacts(body: getSPDefaultcontactDTO) {
let connection;
let rows = [];
try {
connection = await this.oracleDBService.getConnection();
if (!connection) {
throw new Error('No DB Connected');
}
let connection;
let rows = [];
try {
connection = await this.oracleDBService.getConnection()
if (!connection) {
throw new Error('No DB Connected')
}
const result = await connection.execute(
`BEGIN
const result = await connection.execute(
`BEGIN
USCIB_Managed_Pkg.GetSPDefaultContacts(: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
}
);
{
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;
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);
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');
}
await cursor.close();
} else {
throw new Error('No cursor returned from the stored procedure');
}
return rows;
} catch (err) {
return { error: err.message }
} finally { }
return rows;
} catch (err) {
if (err instanceof Error) {
return { error: err.message };
} else {
return { error: 'An unknown error occurred' };
}
}
}
async getSPcontacts() {
let connection;
let rows = [];
try {
async getSPcontacts() {
let connection;
let rows = [];
try {
connection = await this.oracleDBService.getConnection();
if (!connection) {
throw new Error('No DB Connected');
}
connection = await this.oracleDBService.getConnection()
if (!connection) {
throw new Error('No DB Connected')
}
const result = await connection.execute(
`BEGIN
const result = await connection.execute(
`BEGIN
USCIB_Managed_Pkg.GetSPAllContacts(:p_cursor);
END;`,
{
p_cursor: {
type: oracledb.CURSOR,
dir: oracledb.BIND_OUT
}
},
{
outFormat: oracledb.OUT_FORMAT_OBJECT
}
);
{
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;
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);
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');
}
await cursor.close();
} else {
throw new Error('No cursor returned from the stored procedure');
}
return rows;
} catch (err) {
return { error: err.message }
} finally { }
return rows;
} catch (err) {
if (err instanceof Error) {
return { error: err.message };
} else {
return { error: 'An unknown error occurred' };
}
}
}
}

View File

@ -1,36 +1,37 @@
import { Body, Controller, Get, Param, ParseIntPipe, Post, Put, Query } from '@nestjs/common';
import { Body, Controller, Get, Post, Put, Query } from '@nestjs/common';
import { SpService } from './sp.service';
import { ApiTags } from '@nestjs/swagger';
import { getSelectedServiceproviderDTO, InsertNewServiceProviderDTO, UpdateServiceProviderDTO } from './sp.dto';
import { ApiTags } from '@nestjs/swagger';
import {
getSelectedServiceproviderDTO,
InsertNewServiceProviderDTO,
UpdateServiceProviderDTO,
} from './sp.dto';
@Controller('oracle')
export class SpController {
constructor(private readonly spService: SpService) {}
constructor(
private readonly spService: SpService
) { }
@ApiTags('SP - Oracle')
@Post('/InsertNewServiceProvider')
insertNewServiceProvider(@Body() body: InsertNewServiceProviderDTO) {
return this.spService.insertNewServiceProvider(body);
}
@ApiTags('SP - Oracle')
@Post('/InsertNewServiceProvider')
insertNewServiceProvider(@Body() body: InsertNewServiceProviderDTO) {
return this.spService.insertNewServiceProvider(body)
}
@ApiTags('SP - Oracle')
@Put('/UpdateServiceProvider')
updateServiceProider(@Body() body: UpdateServiceProviderDTO) {
return this.spService.updateServiceProvider(body);
}
@ApiTags('SP - Oracle')
@Put('/UpdateServiceProvider')
updateServiceProider(@Body() body: UpdateServiceProviderDTO) {
return this.spService.updateServiceProvider(body)
}
@ApiTags('SP - Oracle')
@Get('/GetAllServiceproviders')
getAllServiceproviders() {
return this.spService.getAllServiceproviders();
}
@ApiTags('SP - Oracle')
@Get('/GetAllServiceproviders')
getAllServiceproviders() {
return this.spService.getAllServiceproviders();
}
@ApiTags('SP - Oracle')
@Get('/GetSelectedServiceprovider')
getSelectedServiceprovider(@Query() body:getSelectedServiceproviderDTO) {
return this.spService.getServiceproviderByID(body);
}
@ApiTags('SP - Oracle')
@Get('/GetSelectedServiceprovider')
getSelectedServiceprovider(@Query() body: getSelectedServiceproviderDTO) {
return this.spService.getServiceproviderByID(body);
}
}

View File

@ -1,183 +1,189 @@
import { ApiProperty } from '@nestjs/swagger';
import { Transform } from 'class-transformer';
import { IsDefined, IsInt, IsNumber, IsOptional, IsString, Min } from 'class-validator';
import {
IsDefined,
IsInt,
IsNumber,
IsOptional,
IsString,
Min,
} from 'class-validator';
export class InsertNewServiceProviderDTO {
@ApiProperty({ required: true })
@IsString({ message: "Property p_name must be a string" })
@IsDefined({ message: "Property p_name is required" })
p_name: string;
@ApiProperty({ required: true })
@IsString({ message: 'Property p_name must be a string' })
@IsDefined({ message: 'Property p_name is required' })
p_name: string;
@ApiProperty({ required: true })
@IsString({ message: "Property p_lookupcode must be a string" })
@IsDefined({ message: "Property p_lookupcode is required" })
p_lookupcode: string;
@ApiProperty({ required: true })
@IsString({ message: 'Property p_lookupcode must be a string' })
@IsDefined({ message: 'Property p_lookupcode is required' })
p_lookupcode: string;
@ApiProperty({ required: true })
@IsString({ message: "Property p_address1 must be a string" })
@IsDefined({ message: "Property p_address1 is required" })
p_address1: string;
@ApiProperty({ required: true })
@IsString({ message: 'Property p_address1 must be a string' })
@IsDefined({ message: 'Property p_address1 is required' })
p_address1: string;
@ApiProperty({ required: false })
@IsString({ message: "Property p_address2 must be a string" })
@IsOptional()
p_address2?: string;
@ApiProperty({ required: false })
@IsString({ message: 'Property p_address2 must be a string' })
@IsOptional()
p_address2?: string;
@ApiProperty({ required: true })
@IsString({ message: "Property p_city must be a string" })
@IsDefined({ message: "Property p_city is required" })
p_city: string;
@ApiProperty({ required: true })
@IsString({ message: 'Property p_city must be a string' })
@IsDefined({ message: 'Property p_city is required' })
p_city: string;
@ApiProperty({ required: true })
@IsString({ message: "Property p_state must be a string" })
@IsDefined({ message: "Property p_state is required" })
p_state: string;
@ApiProperty({ required: true })
@IsString({ message: 'Property p_state must be a string' })
@IsDefined({ message: 'Property p_state is required' })
p_state: string;
@ApiProperty({ required: true })
@IsString({ message: "Property p_zip must be a string" })
@IsDefined({ message: "Property p_zip is required" })
p_zip: string;
@ApiProperty({ required: true })
@IsString({ message: 'Property p_zip must be a string' })
@IsDefined({ message: 'Property p_zip is required' })
p_zip: string;
@ApiProperty({ required: true })
@IsString({ message: "Property p_country must be a string" })
@IsDefined({ message: "Property p_country is required" })
p_country: string;
@ApiProperty({ required: true })
@IsString({ message: 'Property p_country must be a string' })
@IsDefined({ message: 'Property p_country is required' })
p_country: string;
@ApiProperty({ required: true })
@IsString({ message: "Property p_issuingregion must be a string" })
@IsDefined({ message: "Property p_issuingregion is required" })
p_issuingregion: string;
@ApiProperty({ required: true })
@IsString({ message: 'Property p_issuingregion must be a string' })
@IsDefined({ message: 'Property p_issuingregion is required' })
p_issuingregion: string;
@ApiProperty({ required: true })
@IsString({ message: "Property p_replacementregion must be a string" })
@IsDefined({ message: "Property p_replacementregion is required" })
p_replacementregion: string;
@ApiProperty({ required: true })
@IsString({ message: 'Property p_replacementregion must be a string' })
@IsDefined({ message: 'Property p_replacementregion is required' })
p_replacementregion: string;
@ApiProperty({ required: true })
@IsString({ message: "Property p_bondsurety must be a string" })
@IsDefined({ message: "Property p_bondsurety is required" })
p_bondsurety: string;
@ApiProperty({ required: true })
@IsString({ message: 'Property p_bondsurety must be a string' })
@IsDefined({ message: 'Property p_bondsurety is required' })
p_bondsurety: string;
@ApiProperty({ required: true })
@IsString({ message: "Property p_cargopolicyno must be a string" })
@IsDefined({ message: "Property p_cargopolicyno is required" })
p_cargopolicyno: string;
@ApiProperty({ required: true })
@IsString({ message: 'Property p_cargopolicyno must be a string' })
@IsDefined({ message: 'Property p_cargopolicyno is required' })
p_cargopolicyno: string;
@ApiProperty({ required: true })
@IsString({ message: "Property p_cargosurety must be a string" })
@IsDefined({ message: "Property p_cargosurety is required" })
p_cargosurety: string;
@ApiProperty({ required: true })
@IsString({ message: 'Property p_cargosurety must be a string' })
@IsDefined({ message: 'Property p_cargosurety is required' })
p_cargosurety: string;
@ApiProperty({ required: true })
@IsString({ message: "Property p_user_id must be a string" })
@IsDefined({ message: "Property p_user_id is required" })
p_user_id: string;
@ApiProperty({ required: true })
@IsString({ message: 'Property p_user_id must be a string' })
@IsDefined({ message: 'Property p_user_id is required' })
p_user_id: string;
@ApiProperty({ required: false })
@IsString({ message: "Property P_NOTES must be a string" })
@IsOptional()
P_NOTES?: string;
@ApiProperty({ required: false })
@IsString({ message: 'Property P_NOTES must be a string' })
@IsOptional()
P_NOTES?: string;
@ApiProperty({ required: false })
@IsString({ message: "Property P_FILEIDS must be a string" })
@IsOptional()
P_FILEIDS?: string;
@ApiProperty({ required: false })
@IsString({ message: 'Property P_FILEIDS must be a string' })
@IsOptional()
P_FILEIDS?: string;
}
export class UpdateServiceProviderDTO {
@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_spid must be a number' })
@IsDefined({ message: 'Property p_spid is required' })
p_spid: number;
@ApiProperty({ required: true })
@IsString({ message: "Property p_name must be a string" })
@IsDefined({ message: "Property p_name is required" })
p_name: string;
@ApiProperty({ required: true })
@IsString({ message: 'Property p_name must be a string' })
@IsDefined({ message: 'Property p_name is required' })
p_name: string;
@ApiProperty({ required: true })
@IsString({ message: "Property p_lookupcode must be a string" })
@IsDefined({ message: "Property p_lookupcode is required" })
p_lookupcode: string;
@ApiProperty({ required: true })
@IsString({ message: 'Property p_lookupcode must be a string' })
@IsDefined({ message: 'Property p_lookupcode is required' })
p_lookupcode: string;
@ApiProperty({ required: true })
@IsString({ message: "Property p_address1 must be a string" })
@IsDefined({ message: "Property p_address1 is required" })
p_address1: string;
@ApiProperty({ required: true })
@IsString({ message: 'Property p_address1 must be a string' })
@IsDefined({ message: 'Property p_address1 is required' })
p_address1: string;
@ApiProperty({ required: false })
@IsString({ message: "Property p_address2 must be a string" })
@IsOptional()
p_address2?: string;
@ApiProperty({ required: false })
@IsString({ message: 'Property p_address2 must be a string' })
@IsOptional()
p_address2?: string;
@ApiProperty({ required: true })
@IsString({ message: "Property p_city must be a string" })
@IsDefined({ message: "Property p_city is required" })
p_city: string;
@ApiProperty({ required: true })
@IsString({ message: 'Property p_city must be a string' })
@IsDefined({ message: 'Property p_city is required' })
p_city: string;
@ApiProperty({ required: true })
@IsString({ message: "Property p_state must be a string" })
@IsDefined({ message: "Property p_state is required" })
p_state: string;
@ApiProperty({ required: true })
@IsString({ message: 'Property p_state must be a string' })
@IsDefined({ message: 'Property p_state is required' })
p_state: string;
@ApiProperty({ required: true })
@IsString({ message: "Property p_zip must be a string" })
@IsDefined({ message: "Property p_zip is required" })
p_zip: string;
@ApiProperty({ required: true })
@IsString({ message: 'Property p_zip must be a string' })
@IsDefined({ message: 'Property p_zip is required' })
p_zip: string;
@ApiProperty({ required: true })
@IsString({ message: "Property p_country must be a string" })
@IsDefined({ message: "Property p_country is required" })
p_country: string;
@ApiProperty({ required: true })
@IsString({ message: 'Property p_country must be a string' })
@IsDefined({ message: 'Property p_country is required' })
p_country: string;
@ApiProperty({ required: true })
@IsString({ message: "Property p_issuingregion must be a string" })
@IsDefined({ message: "Property p_issuingregion is required" })
p_issuingregion: string;
@ApiProperty({ required: true })
@IsString({ message: 'Property p_issuingregion must be a string' })
@IsDefined({ message: 'Property p_issuingregion is required' })
p_issuingregion: string;
@ApiProperty({ required: true })
@IsString({ message: "Property p_replacementregion must be a string" })
@IsDefined({ message: "Property p_replacementregion is required" })
p_replacementregion: string;
@ApiProperty({ required: true })
@IsString({ message: 'Property p_replacementregion must be a string' })
@IsDefined({ message: 'Property p_replacementregion is required' })
p_replacementregion: string;
@ApiProperty({ required: true })
@IsString({ message: "Property p_bondsurety must be a string" })
@IsDefined({ message: "Property p_bondsurety is required" })
p_bondsurety: string;
@ApiProperty({ required: true })
@IsString({ message: 'Property p_bondsurety must be a string' })
@IsDefined({ message: 'Property p_bondsurety is required' })
p_bondsurety: string;
@ApiProperty({ required: true })
@IsString({ message: "Property p_cargopolicyno must be a string" })
@IsDefined({ message: "Property p_cargopolicyno is required" })
p_cargopolicyno: string;
@ApiProperty({ required: true })
@IsString({ message: 'Property p_cargopolicyno must be a string' })
@IsDefined({ message: 'Property p_cargopolicyno is required' })
p_cargopolicyno: string;
@ApiProperty({ required: true })
@IsString({ message: "Property p_cargosurety must be a string" })
@IsDefined({ message: "Property p_cargosurety is required" })
p_cargosurety: string;
@ApiProperty({ required: true })
@IsString({ message: 'Property p_cargosurety must be a string' })
@IsDefined({ message: 'Property p_cargosurety is required' })
p_cargosurety: string;
@ApiProperty({ required: true })
@IsString({ message: "Property p_user_id must be a string" })
@IsDefined({ message: "Property p_user_id is required" })
p_user_id: string;
@ApiProperty({ required: true })
@IsString({ message: 'Property p_user_id must be a string' })
@IsDefined({ message: 'Property p_user_id is required' })
p_user_id: string;
@ApiProperty({ required: false })
@IsString({ message: "Property P_NOTES must be a string" })
@IsOptional()
P_NOTES?: string;
@ApiProperty({ required: false })
@IsString({ message: 'Property P_NOTES must be a string' })
@IsOptional()
P_NOTES?: string;
@ApiProperty({ required: false })
@IsString({ message: "Property P_FILEIDS must be a string" })
@IsOptional()
P_FILEIDS?: string;
@ApiProperty({ required: false })
@IsString({ message: 'Property P_FILEIDS must be a string' })
@IsOptional()
P_FILEIDS?: string;
}
export class getSelectedServiceproviderDTO{
@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;
export class getSelectedServiceproviderDTO {
@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;
}

View File

@ -4,6 +4,6 @@ import { SpService } from './sp.service';
@Module({
controllers: [SpController],
providers: [SpService]
providers: [SpService],
})
export class SpModule {}

View File

@ -1,25 +1,26 @@
import { Injectable } from '@nestjs/common';
import { OracleDBService } from 'src/db/db.service';
import * as oracledb from 'oracledb'
import { getSelectedServiceproviderDTO, InsertNewServiceProviderDTO, UpdateServiceProviderDTO } from './sp.dto';
import * as oracledb from 'oracledb';
import {
getSelectedServiceproviderDTO,
InsertNewServiceProviderDTO,
UpdateServiceProviderDTO,
} from './sp.dto';
@Injectable()
export class SpService {
constructor(private readonly oracleDBService: OracleDBService) {}
constructor(private readonly oracleDBService: OracleDBService) { }
async insertNewServiceProvider(body: InsertNewServiceProviderDTO) {
let connection;
try {
connection = await this.oracleDBService.getConnection();
if (!connection) {
throw new Error('No DB Connected');
}
async insertNewServiceProvider(body: InsertNewServiceProviderDTO) {
let connection;
try {
connection = await this.oracleDBService.getConnection()
if (!connection) {
throw new Error('No DB Connected')
}
const result = await connection.execute(
`BEGIN
const result = await connection.execute(
`BEGIN
USCIB_Managed_Pkg.InsertNewSP(
:p_name,
:p_lookupcode,
@ -38,105 +39,106 @@ export class SpService {
:P_NOTES,
:P_FILEIDS,
:p_cursor);
END;`, {
p_name: {
val: body.p_name,
type: oracledb.DB_TYPE_VARCHAR
},
p_lookupcode: {
val: body.p_lookupcode,
type: oracledb.DB_TYPE_VARCHAR
},
p_address1: {
val: body.p_address1,
type: oracledb.DB_TYPE_VARCHAR
},
p_address2: {
val: body.p_address2,
type: oracledb.DB_TYPE_VARCHAR
},
p_city: {
val: body.p_city,
type: oracledb.DB_TYPE_VARCHAR
},
p_state: {
val: body.p_state,
type: oracledb.DB_TYPE_VARCHAR
},
p_zip: {
val: body.p_zip,
type: oracledb.DB_TYPE_VARCHAR
},
p_country: {
val: body.p_country,
type: oracledb.DB_TYPE_VARCHAR
},
p_issuingregion: {
val: body.p_issuingregion,
type: oracledb.DB_TYPE_VARCHAR
},
p_replacementregion: {
val: body.p_replacementregion,
type: oracledb.DB_TYPE_VARCHAR
},
p_bondsurety: {
val: body.p_bondsurety,
type: oracledb.DB_TYPE_VARCHAR
},
p_cargopolicyno: {
val: body.p_cargopolicyno,
type: oracledb.DB_TYPE_VARCHAR
},
p_cargosurety: {
val: body.p_cargosurety,
type: oracledb.DB_TYPE_VARCHAR
},
p_user_id: {
val: body.p_user_id,
type: oracledb.DB_TYPE_VARCHAR
},
P_NOTES: {
val: body.P_NOTES,
type: oracledb.DB_TYPE_VARCHAR
},
P_FILEIDS: {
val: body.P_FILEIDS,
type: oracledb.DB_TYPE_VARCHAR
},
END;`,
{
p_name: {
val: body.p_name,
type: oracledb.DB_TYPE_VARCHAR,
},
p_lookupcode: {
val: body.p_lookupcode,
type: oracledb.DB_TYPE_VARCHAR,
},
p_address1: {
val: body.p_address1,
type: oracledb.DB_TYPE_VARCHAR,
},
p_address2: {
val: body.p_address2,
type: oracledb.DB_TYPE_VARCHAR,
},
p_city: {
val: body.p_city,
type: oracledb.DB_TYPE_VARCHAR,
},
p_state: {
val: body.p_state,
type: oracledb.DB_TYPE_VARCHAR,
},
p_zip: {
val: body.p_zip,
type: oracledb.DB_TYPE_VARCHAR,
},
p_country: {
val: body.p_country,
type: oracledb.DB_TYPE_VARCHAR,
},
p_issuingregion: {
val: body.p_issuingregion,
type: oracledb.DB_TYPE_VARCHAR,
},
p_replacementregion: {
val: body.p_replacementregion,
type: oracledb.DB_TYPE_VARCHAR,
},
p_bondsurety: {
val: body.p_bondsurety,
type: oracledb.DB_TYPE_VARCHAR,
},
p_cargopolicyno: {
val: body.p_cargopolicyno,
type: oracledb.DB_TYPE_VARCHAR,
},
p_cargosurety: {
val: body.p_cargosurety,
type: oracledb.DB_TYPE_VARCHAR,
},
p_user_id: {
val: body.p_user_id,
type: oracledb.DB_TYPE_VARCHAR,
},
P_NOTES: {
val: body.P_NOTES,
type: oracledb.DB_TYPE_VARCHAR,
},
P_FILEIDS: {
val: body.P_FILEIDS,
type: oracledb.DB_TYPE_VARCHAR,
},
p_cursor: {
type: oracledb.CURSOR,
dir: oracledb.BIND_OUT
}
}, {
outFormat: oracledb.OUT_FORMAT_OBJECT
}
);
await connection.commit();
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 { }
const fres = await result.outBinds.p_cursor.getRows();
return fres;
} catch (err) {
if (err instanceof Error) {
return { error: err.message };
} else {
return { error: 'An unknown error occurred' };
}
}
}
async updateServiceProvider(body: UpdateServiceProviderDTO) {
async updateServiceProvider(body: UpdateServiceProviderDTO) {
let connection;
try {
connection = await this.oracleDBService.getConnection();
if (!connection) {
throw new Error('No DB Connected');
}
let connection;
try {
connection = await this.oracleDBService.getConnection()
if (!connection) {
throw new Error('No DB Connected')
}
const result = await connection.execute(
`BEGIN
const result = await connection.execute(
`BEGIN
USCIB_Managed_Pkg.UpdateSP(
:p_spid,
:p_name,
@ -156,197 +158,197 @@ export class SpService {
:P_NOTES,
:P_FILEIDS,
:p_cursor);
END;`, {
p_spid: {
val: body.p_spid,
type: oracledb.DB_TYPE_NUMBER
},
p_name: {
val: body.p_name,
type: oracledb.DB_TYPE_VARCHAR
},
p_lookupcode: {
val: body.p_lookupcode,
type: oracledb.DB_TYPE_VARCHAR
},
p_address1: {
val: body.p_address1,
type: oracledb.DB_TYPE_VARCHAR
},
p_address2: {
val: body.p_address2,
type: oracledb.DB_TYPE_VARCHAR
},
p_city: {
val: body.p_city,
type: oracledb.DB_TYPE_VARCHAR
},
p_state: {
val: body.p_state,
type: oracledb.DB_TYPE_VARCHAR
},
p_zip: {
val: body.p_zip,
type: oracledb.DB_TYPE_VARCHAR
},
p_country: {
val: body.p_country,
type: oracledb.DB_TYPE_VARCHAR
},
p_issuingregion: {
val: body.p_issuingregion,
type: oracledb.DB_TYPE_VARCHAR
},
p_replacementregion: {
val: body.p_replacementregion,
type: oracledb.DB_TYPE_VARCHAR
},
p_bondsurety: {
val: body.p_bondsurety,
type: oracledb.DB_TYPE_VARCHAR
},
p_cargopolicyno: {
val: body.p_cargopolicyno,
type: oracledb.DB_TYPE_VARCHAR
},
p_cargosurety: {
val: body.p_cargosurety,
type: oracledb.DB_TYPE_VARCHAR
},
p_user_id: {
val: body.p_user_id,
type: oracledb.DB_TYPE_VARCHAR
},
P_NOTES: {
val: body.P_NOTES,
type: oracledb.DB_TYPE_VARCHAR
},
P_FILEIDS: {
val: body.P_FILEIDS,
type: oracledb.DB_TYPE_VARCHAR
},
p_cursor: {
type: oracledb.CURSOR,
dir: oracledb.BIND_OUT
}
}, {
outFormat: oracledb.OUT_FORMAT_OBJECT
}
);
END;`,
{
p_spid: {
val: body.p_spid,
type: oracledb.DB_TYPE_NUMBER,
},
p_name: {
val: body.p_name,
type: oracledb.DB_TYPE_VARCHAR,
},
p_lookupcode: {
val: body.p_lookupcode,
type: oracledb.DB_TYPE_VARCHAR,
},
p_address1: {
val: body.p_address1,
type: oracledb.DB_TYPE_VARCHAR,
},
p_address2: {
val: body.p_address2,
type: oracledb.DB_TYPE_VARCHAR,
},
p_city: {
val: body.p_city,
type: oracledb.DB_TYPE_VARCHAR,
},
p_state: {
val: body.p_state,
type: oracledb.DB_TYPE_VARCHAR,
},
p_zip: {
val: body.p_zip,
type: oracledb.DB_TYPE_VARCHAR,
},
p_country: {
val: body.p_country,
type: oracledb.DB_TYPE_VARCHAR,
},
p_issuingregion: {
val: body.p_issuingregion,
type: oracledb.DB_TYPE_VARCHAR,
},
p_replacementregion: {
val: body.p_replacementregion,
type: oracledb.DB_TYPE_VARCHAR,
},
p_bondsurety: {
val: body.p_bondsurety,
type: oracledb.DB_TYPE_VARCHAR,
},
p_cargopolicyno: {
val: body.p_cargopolicyno,
type: oracledb.DB_TYPE_VARCHAR,
},
p_cargosurety: {
val: body.p_cargosurety,
type: oracledb.DB_TYPE_VARCHAR,
},
p_user_id: {
val: body.p_user_id,
type: oracledb.DB_TYPE_VARCHAR,
},
P_NOTES: {
val: body.P_NOTES,
type: oracledb.DB_TYPE_VARCHAR,
},
P_FILEIDS: {
val: body.P_FILEIDS,
type: oracledb.DB_TYPE_VARCHAR,
},
p_cursor: {
type: oracledb.CURSOR,
dir: oracledb.BIND_OUT,
},
},
{
outFormat: oracledb.OUT_FORMAT_OBJECT,
},
);
await connection.commit();
await connection.commit();
let fres = await result.outBinds.p_cursor.getRows();
return fres
} catch (err) {
return { error: err.message }
} finally { }
const fres = await result.outBinds.p_cursor.getRows();
return fres;
} catch (err) {
if (err instanceof Error) {
return { error: err.message };
} else {
return { error: 'An unknown error occurred' };
}
}
}
async getAllServiceproviders() {
async getAllServiceproviders() {
let connection;
let rows = [];
try {
connection = await this.oracleDBService.getConnection();
if (!connection) {
throw new Error('No DB Connected');
}
let connection;
let rows = [];
try {
connection = await this.oracleDBService.getConnection()
if (!connection) {
throw new Error('No DB Connected')
}
const result = await connection.execute(
`BEGIN
const result = await connection.execute(
`BEGIN
USCIB_Managed_Pkg.GetAllSPs(:p_cursor);
END;`,
{
p_cursor: {
type: oracledb.CURSOR,
dir: oracledb.BIND_OUT
}
},
{
outFormat: oracledb.OUT_FORMAT_OBJECT
}
);
{
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;
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);
do {
rowsBatch = await cursor.getRows(100);
rows = rows.concat(rowsBatch);
} while (rowsBatch.length > 0);
await cursor.close();
return rows;
} else {
throw new Error('No cursor returned from the stored procedure');
}
} catch (err) {
return { error: err.message }
} finally { }
await cursor.close();
return rows;
} else {
throw new Error('No cursor returned from the stored procedure');
}
} catch (err) {
if (err instanceof Error) {
return { error: err.message };
} else {
return { error: 'An unknown error occurred' };
}
}
}
async getServiceproviderByID(body:getSelectedServiceproviderDTO) {
async getServiceproviderByID(body: getSelectedServiceproviderDTO) {
let connection;
let rows = [];
try {
connection = await this.oracleDBService.getConnection();
if (!connection) {
throw new Error('No DB Connected');
}
let connection;
let rows = [];
try {
connection = await this.oracleDBService.getConnection()
if (!connection) {
throw new Error('No DB Connected')
}
const result = await connection.execute(
`BEGIN
const result = await connection.execute(
`BEGIN
USCIB_Managed_Pkg.GetSPbySPID(: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
}
);
{
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;
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);
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 { }
await cursor.close();
} else {
throw new Error('No cursor returned from the stored procedure');
}
return rows;
} catch (err) {
if (err instanceof Error) {
return { error: err.message };
} else {
return { error: 'An unknown error occurred' };
}
}
}
}

View File

@ -7,6 +7,6 @@ import { CarnetSequenceModule } from './carnet-sequence/carnet-sequence.module';
@Module({
controllers: [],
providers: [],
imports: [RegionModule, SpModule, SpContactsModule, CarnetSequenceModule]
imports: [RegionModule, SpModule, SpContactsModule, CarnetSequenceModule],
})
export class UscibManagedSpModule {}