removed unused code
This commit is contained in:
parent
2f1fca47c8
commit
cfa37000e9
@ -4,7 +4,7 @@ import { OracleModule } from './oracle/oracle.module';
|
|||||||
import { AuthModule } from './auth/auth.module';
|
import { AuthModule } from './auth/auth.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [ AuthModule, DbModule, OracleModule],
|
imports: [AuthModule, DbModule, OracleModule],
|
||||||
controllers: [],
|
controllers: [],
|
||||||
providers: [],
|
providers: [],
|
||||||
})
|
})
|
||||||
|
|||||||
@ -5,12 +5,11 @@ import { AuthLoginDTO } from './auth.dto';
|
|||||||
|
|
||||||
@Controller()
|
@Controller()
|
||||||
export class AuthController {
|
export class AuthController {
|
||||||
|
constructor(private readonly authService: AuthService) {}
|
||||||
constructor(private readonly authService:AuthService){}
|
|
||||||
|
|
||||||
@ApiTags('Auth')
|
@ApiTags('Auth')
|
||||||
@Post('/login')
|
@Post('/login')
|
||||||
login(@Body() body:AuthLoginDTO){
|
login(@Body() body: AuthLoginDTO) {
|
||||||
return this.authService.login(body);
|
return this.authService.login(body);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,13 +1,12 @@
|
|||||||
import { ApiProperty } from "@nestjs/swagger";
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
import { IsString } from "class-validator";
|
import { IsString } from 'class-validator';
|
||||||
|
|
||||||
export class AuthLoginDTO{
|
export class AuthLoginDTO {
|
||||||
|
@ApiProperty({ required: true })
|
||||||
@ApiProperty({required:true})
|
|
||||||
@IsString()
|
@IsString()
|
||||||
p_emailaddr:string;
|
p_emailaddr: string;
|
||||||
|
|
||||||
@ApiProperty({required:true})
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
p_password:string;
|
p_password: string;
|
||||||
}
|
}
|
||||||
@ -1,12 +1,11 @@
|
|||||||
import { Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { AuthService } from './auth.service';
|
import { AuthService } from './auth.service';
|
||||||
import { AuthController } from './auth.controller';
|
import { AuthController } from './auth.controller';
|
||||||
import { OracleDBService } from 'src/db/db.service';
|
|
||||||
import { DbModule } from 'src/db/db.module';
|
import { DbModule } from 'src/db/db.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports:[DbModule],
|
imports: [DbModule],
|
||||||
providers: [AuthService],
|
providers: [AuthService],
|
||||||
controllers: [AuthController]
|
controllers: [AuthController],
|
||||||
})
|
})
|
||||||
export class AuthModule {}
|
export class AuthModule {}
|
||||||
|
|||||||
@ -1,21 +1,19 @@
|
|||||||
import { BadRequestException, Injectable } from '@nestjs/common';
|
import { BadRequestException, Injectable } from '@nestjs/common';
|
||||||
import { OracleDBService } from 'src/db/db.service';
|
import { OracleDBService } from 'src/db/db.service';
|
||||||
import { AuthLoginDTO } from './auth.dto';
|
import { AuthLoginDTO } from './auth.dto';
|
||||||
import * as oracledb from 'oracledb'
|
import * as oracledb from 'oracledb';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AuthService {
|
export class AuthService {
|
||||||
|
constructor(private readonly oracleDBService: OracleDBService) {}
|
||||||
|
|
||||||
constructor(private readonly oracleDBService: OracleDBService) { }
|
async login(body: AuthLoginDTO) {
|
||||||
|
|
||||||
async login(body:AuthLoginDTO) {
|
|
||||||
let connection;
|
let connection;
|
||||||
let rows = [];
|
let rows = [];
|
||||||
let crows:any = [];
|
|
||||||
try {
|
try {
|
||||||
connection = await this.oracleDBService.getConnection()
|
connection = await this.oracleDBService.getConnection();
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected');
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
@ -25,20 +23,20 @@ export class AuthService {
|
|||||||
{
|
{
|
||||||
p_emailaddr: {
|
p_emailaddr: {
|
||||||
val: body.p_emailaddr,
|
val: body.p_emailaddr,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_password: {
|
p_password: {
|
||||||
val: body.p_password,
|
val: body.p_password,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_login_cursor: {
|
p_login_cursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result.outBinds && result.outBinds.p_login_cursor) {
|
if (result.outBinds && result.outBinds.p_login_cursor) {
|
||||||
@ -52,19 +50,18 @@ export class AuthService {
|
|||||||
|
|
||||||
await cursor.close();
|
await cursor.close();
|
||||||
} else {
|
} else {
|
||||||
return new BadRequestException({Error:"Error executing request try after some time!"});
|
return new BadRequestException({
|
||||||
|
Error: 'Error executing request try after some time!',
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if(rows[0]["ERRORMESG"]){
|
if (rows[0]['ERRORMESG']) {
|
||||||
return {error:"Invalid username or password!"}
|
return { error: 'Invalid username or password!' };
|
||||||
}
|
}
|
||||||
return {msg:"Logged in successfully"}
|
return { msg: 'Logged in successfully' };
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching users: ', err.message);
|
console.error('Error fetching users: ', err.message);
|
||||||
return {error:"Invalid username or password"}
|
return { error: 'Invalid username or password' };
|
||||||
} finally { }
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import { MssqlDBService, OracleDBService } from './db.service';
|
|||||||
|
|
||||||
@Global()
|
@Global()
|
||||||
@Module({
|
@Module({
|
||||||
providers: [OracleDBService,MssqlDBService],
|
providers: [OracleDBService, MssqlDBService],
|
||||||
exports:[OracleDBService,MssqlDBService]
|
exports: [OracleDBService, MssqlDBService],
|
||||||
})
|
})
|
||||||
export class DbModule {}
|
export class DbModule {}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { MssqlConfig , OracleConfig} from 'ormconfig';
|
import { MssqlConfig, OracleConfig } from 'ormconfig';
|
||||||
import { createPool, Pool, Connection as cob, } from 'oracledb';
|
import { createPool, Pool, Connection as cob } from 'oracledb';
|
||||||
import { Connection, ConnectionPool } from 'mssql';
|
import { Connection, ConnectionPool } from 'mssql';
|
||||||
import { Global, Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class OracleDBService {
|
export class OracleDBService {
|
||||||
@ -32,7 +32,7 @@ export class MssqlDBService {
|
|||||||
private pool: ConnectionPool;
|
private pool: ConnectionPool;
|
||||||
private readonly config = {
|
private readonly config = {
|
||||||
...MssqlConfig,
|
...MssqlConfig,
|
||||||
server: "localhost",
|
server: 'localhost',
|
||||||
pool: {
|
pool: {
|
||||||
max: 10,
|
max: 10,
|
||||||
min: 0,
|
min: 0,
|
||||||
@ -44,7 +44,7 @@ export class MssqlDBService {
|
|||||||
this.initializePool();
|
this.initializePool();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async initializePool() {
|
private initializePool() {
|
||||||
this.pool = new ConnectionPool(this.config);
|
this.pool = new ConnectionPool(this.config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
46
src/main.ts
46
src/main.ts
@ -1,17 +1,21 @@
|
|||||||
import { NestFactory } from '@nestjs/core';
|
import { NestFactory } from '@nestjs/core';
|
||||||
import { AppModule } from './app.module';
|
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 { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
|
||||||
import { SwaggerDocumentOptions } from '@nestjs/swagger';
|
import { SwaggerDocumentOptions } from '@nestjs/swagger';
|
||||||
|
|
||||||
async function bootstrap() {
|
async function bootstrap() {
|
||||||
const app = await NestFactory.create(AppModule, {
|
const app = await NestFactory.create(AppModule, {
|
||||||
cors: {
|
cors: {
|
||||||
"origin": "*",
|
origin: '*',
|
||||||
"methods": "GET,HEAD,PUT,PATCH,POST,DELETE",
|
methods: 'GET,HEAD,PUT,PATCH,POST,DELETE',
|
||||||
"preflightContinue": false,
|
preflightContinue: false,
|
||||||
"optionsSuccessStatus": 204
|
optionsSuccessStatus: 204,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
function extractConstraints(validationErrors: ValidationError[]) {
|
function extractConstraints(validationErrors: ValidationError[]) {
|
||||||
@ -41,39 +45,49 @@ async function bootstrap() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const customExceptionFactory = (validationErrors: ValidationError[]) => {
|
const customExceptionFactory = (validationErrors: ValidationError[]) => {
|
||||||
|
const res = extractConstraints(validationErrors);
|
||||||
|
|
||||||
let res = extractConstraints(validationErrors);
|
const newResult = res
|
||||||
|
.map((x) => {
|
||||||
let newResult = res.map(x => {
|
|
||||||
const errorMessage = x[Object.keys(x)[0]];
|
const errorMessage = x[Object.keys(x)[0]];
|
||||||
|
|
||||||
return { message: errorMessage };
|
return { message: errorMessage };
|
||||||
}).filter(Boolean);
|
})
|
||||||
|
.filter(Boolean);
|
||||||
|
|
||||||
return new BadRequestException({ message: 'Validation failed', errors: newResult });
|
return new BadRequestException({
|
||||||
|
message: 'Validation failed',
|
||||||
|
errors: newResult,
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
app.useGlobalPipes(new ValidationPipe({
|
app.useGlobalPipes(
|
||||||
|
new ValidationPipe({
|
||||||
transform: true,
|
transform: true,
|
||||||
exceptionFactory: customExceptionFactory,
|
exceptionFactory: customExceptionFactory,
|
||||||
whitelist: true,
|
whitelist: true,
|
||||||
stopAtFirstError: true,
|
stopAtFirstError: true,
|
||||||
forbidNonWhitelisted: true,
|
forbidNonWhitelisted: true,
|
||||||
}));
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
// app.useGlobalPipes(new ValidationPipe({ exceptionFactory:customExceptionFactory, whitelist: true, forbidNonWhitelisted: true, transform: true }));
|
// app.useGlobalPipes(new ValidationPipe({ exceptionFactory:customExceptionFactory, whitelist: true, forbidNonWhitelisted: true, transform: true }));
|
||||||
const config = new DocumentBuilder()
|
const config = new DocumentBuilder()
|
||||||
.setTitle('API')
|
.setTitle('API')
|
||||||
.setDescription('API description')
|
.setDescription('API description')
|
||||||
.setVersion('1.0')
|
.setVersion('1.0')
|
||||||
.addServer("http://localhost:3000", "Development Server 1")
|
.addServer('http://localhost:3000', 'Development Server 1')
|
||||||
.addServer("https://dev.alphaomegainfosys.com/test-api", "Development Server 2")
|
.addServer(
|
||||||
|
'https://dev.alphaomegainfosys.com/test-api',
|
||||||
|
'Development Server 2',
|
||||||
|
)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
const options: SwaggerDocumentOptions = {
|
const options: SwaggerDocumentOptions = {
|
||||||
autoTagControllers: false,
|
autoTagControllers: false,
|
||||||
};
|
};
|
||||||
const documentFactory = () => SwaggerModule.createDocument(app, config, options);
|
const documentFactory = () =>
|
||||||
|
SwaggerModule.createDocument(app, config, options);
|
||||||
SwaggerModule.setup('api', app, documentFactory);
|
SwaggerModule.setup('api', app, documentFactory);
|
||||||
|
|
||||||
await app.listen(process.env.PORT ?? 3000);
|
await app.listen(process.env.PORT ?? 3000);
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import {
|
|||||||
Param,
|
Param,
|
||||||
Controller,
|
Controller,
|
||||||
ParseIntPipe,
|
ParseIntPipe,
|
||||||
BadRequestException
|
BadRequestException,
|
||||||
} from '@nestjs/common';
|
} from '@nestjs/common';
|
||||||
|
|
||||||
import { HomePageService } from './home-page.service';
|
import { HomePageService } from './home-page.service';
|
||||||
@ -14,14 +14,12 @@ import { ApiTags } from '@nestjs/swagger';
|
|||||||
import {
|
import {
|
||||||
SaveCarnetApplicationDTO,
|
SaveCarnetApplicationDTO,
|
||||||
TransmitApplicationtoProcessDTO,
|
TransmitApplicationtoProcessDTO,
|
||||||
GetCarnetDetailsbyCarnetStatusDTO
|
GetCarnetDetailsbyCarnetStatusDTO,
|
||||||
} from './home-page.dto';
|
} from './home-page.dto';
|
||||||
|
|
||||||
@Controller()
|
@Controller()
|
||||||
export class HomePageController {
|
export class HomePageController {
|
||||||
constructor(
|
constructor(private readonly homePageService: HomePageService) {}
|
||||||
private readonly homePageService: HomePageService
|
|
||||||
) { }
|
|
||||||
|
|
||||||
@ApiTags('HomePage - Oracle')
|
@ApiTags('HomePage - Oracle')
|
||||||
@Get('/oracle/GetHomePageData/:id')
|
@Get('/oracle/GetHomePageData/:id')
|
||||||
@ -36,29 +34,36 @@ export class HomePageController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('HomePage - Oracle')
|
@ApiTags('HomePage - Oracle')
|
||||||
@Get('/oracle/GetCarnetDetailsbyCarnetStatus/:p_spid/:p_userid/:p_CarnetStatus')
|
@Get(
|
||||||
|
'/oracle/GetCarnetDetailsbyCarnetStatus/:p_spid/:p_userid/:p_CarnetStatus',
|
||||||
|
)
|
||||||
GetCarnetDetailsbyCarnetStatus(
|
GetCarnetDetailsbyCarnetStatus(
|
||||||
@Param('p_spid', ParseIntPipe) p_spid: number,
|
@Param('p_spid', ParseIntPipe) p_spid: number,
|
||||||
@Param('p_userid') p_userid: string,
|
@Param('p_userid') p_userid: string,
|
||||||
@Param('p_CarnetStatus') p_CarnetStatus: string
|
@Param('p_CarnetStatus') p_CarnetStatus: string,
|
||||||
) {
|
) {
|
||||||
if (!p_spid || !p_userid || !p_CarnetStatus) {
|
if (!p_spid || !p_userid || !p_CarnetStatus) {
|
||||||
throw new BadRequestException('spid, userid and Carnet Status are required');
|
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');
|
} else if (Number(p_userid) || Number(p_CarnetStatus)) {
|
||||||
|
throw new BadRequestException(
|
||||||
|
'Param p_userid and p_CarnetStatus should be string',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const body: GetCarnetDetailsbyCarnetStatusDTO = {
|
const body: GetCarnetDetailsbyCarnetStatusDTO = {
|
||||||
p_spid: p_spid,
|
p_spid: p_spid,
|
||||||
p_userid: p_userid,
|
p_userid: p_userid,
|
||||||
p_CarnetStatus: p_CarnetStatus
|
p_CarnetStatus: p_CarnetStatus,
|
||||||
};
|
};
|
||||||
|
|
||||||
return this.homePageService.GetCarnetDetailsbyCarnetStatus(body);
|
return this.homePageService.GetCarnetDetailsbyCarnetStatus(body);
|
||||||
}
|
} catch (err) {
|
||||||
catch (err) {
|
return new BadRequestException({
|
||||||
return new BadRequestException({ message: 'Validation faileda', error: err.message })
|
message: 'Validation faileda',
|
||||||
|
error: err.message,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,6 +78,4 @@ export class HomePageController {
|
|||||||
TransmitApplicationtoProcess(@Body() body: TransmitApplicationtoProcessDTO) {
|
TransmitApplicationtoProcess(@Body() body: TransmitApplicationtoProcessDTO) {
|
||||||
return this.homePageService.TransmitApplicationtoProcess(body);
|
return this.homePageService.TransmitApplicationtoProcess(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,33 +1,48 @@
|
|||||||
import { ApiProperty } from "@nestjs/swagger";
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
import { Type } from "class-transformer";
|
import { Type } from 'class-transformer';
|
||||||
import { IsArray, IsDefined, IsInt, IsNumber, IsOptional, IsString, Length, Max, Min, ValidateNested } from "class-validator";
|
import {
|
||||||
|
IsArray,
|
||||||
|
IsDefined,
|
||||||
|
IsInt,
|
||||||
|
IsNumber,
|
||||||
|
IsOptional,
|
||||||
|
IsString,
|
||||||
|
Length,
|
||||||
|
Max,
|
||||||
|
Min,
|
||||||
|
ValidateNested,
|
||||||
|
} from 'class-validator';
|
||||||
|
|
||||||
export class p_gltableDTO {
|
export class p_gltableDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property ItemNo must not exceed 999999999" })
|
@Max(999999999, { message: 'Property ItemNo must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property ItemNo must be at least 0 or more" })
|
@Min(0, { message: 'Property ItemNo must be at least 0 or more' })
|
||||||
@IsInt()
|
@IsInt()
|
||||||
@IsNumber({}, { message: "Property ItemNo must be a number" })
|
@IsNumber({}, { message: 'Property ItemNo must be a number' })
|
||||||
@IsDefined({ message: "Property ItemNo is required" })
|
@IsDefined({ message: 'Property ItemNo is required' })
|
||||||
ItemNo: number;
|
ItemNo: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 1000, { message: "Property ItemDescription must be between 1 and 1000 characters" })
|
@Length(0, 1000, {
|
||||||
@IsString({ message: "Property ItemDescription should be string" })
|
message: 'Property ItemDescription must be between 1 and 1000 characters',
|
||||||
@IsDefined({ message: "Property ItemDescription is required" })
|
})
|
||||||
|
@IsString({ message: 'Property ItemDescription should be string' })
|
||||||
|
@IsDefined({ message: 'Property ItemDescription is required' })
|
||||||
ItemDescription: string;
|
ItemDescription: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber({},{ message: "Property ItemValue should be number" })
|
@IsNumber({}, { message: 'Property ItemValue should be number' })
|
||||||
@IsDefined({ message: "Property ItemValue is required" })
|
@IsDefined({ message: 'Property ItemValue is required' })
|
||||||
ItemValue: number;
|
ItemValue: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(99999999999, { message: "Property Noofpieces must not exceed 99999999999" })
|
@Max(99999999999, {
|
||||||
@Min(0, { message: "Property Noofpieces must be at least 0 or more" })
|
message: 'Property Noofpieces must not exceed 99999999999',
|
||||||
|
})
|
||||||
|
@Min(0, { message: 'Property Noofpieces must be at least 0 or more' })
|
||||||
@IsInt()
|
@IsInt()
|
||||||
@IsNumber({}, { message: "Property Noofpieces must be a number" })
|
@IsNumber({}, { message: 'Property Noofpieces must be a number' })
|
||||||
@IsDefined({ message: "Property Noofpieces is required" })
|
@IsDefined({ message: 'Property Noofpieces is required' })
|
||||||
Noofpieces: number;
|
Noofpieces: number;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@ -36,120 +51,147 @@ export class p_gltableDTO {
|
|||||||
ItemWeight?: number;
|
ItemWeight?: number;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 10, { message: "Property ItemWeightUOM must be between 0 and 10 characters" })
|
@Length(0, 10, {
|
||||||
|
message: 'Property ItemWeightUOM must be between 0 and 10 characters',
|
||||||
|
})
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
ItemWeightUOM?: string;
|
ItemWeightUOM?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 2, { message: "Property GoodsOriginCountry must be between 0 and 2 characters" })
|
@Length(0, 2, {
|
||||||
@IsString({ message: "Property GoodsOriginCountry should be string" })
|
message: 'Property GoodsOriginCountry must be between 0 and 2 characters',
|
||||||
@IsDefined({ message: "Property name is required" })
|
})
|
||||||
|
@IsString({ message: 'Property GoodsOriginCountry should be string' })
|
||||||
|
@IsDefined({ message: 'Property name is required' })
|
||||||
GoodsOriginCountry: string;
|
GoodsOriginCountry: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class p_countrytableDTO {
|
export class p_countrytableDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 1, { message: "Property VisitTransitInd must be 0 to 1 characters" })
|
@Length(0, 1, {
|
||||||
|
message: 'Property VisitTransitInd must be 0 to 1 characters',
|
||||||
|
})
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsDefined({ message: "Property VisitTransitInd is required" })
|
@IsDefined({ message: 'Property VisitTransitInd is required' })
|
||||||
VisitTransitInd: string;
|
VisitTransitInd: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 2, { message: "Property CountryCode must be between 0 to 2 characters" })
|
@Length(0, 2, {
|
||||||
|
message: 'Property CountryCode must be between 0 to 2 characters',
|
||||||
|
})
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsDefined({ message: "Property CountryCode is required" })
|
@IsDefined({ message: 'Property CountryCode is required' })
|
||||||
CountryCode: string;
|
CountryCode: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999, { message: "Property NoOfTimesEntLeave must not exceed 999" })
|
@Max(999, { message: 'Property NoOfTimesEntLeave must not exceed 999' })
|
||||||
@Min(0, { message: "Property NoOfTimesEntLeave must be at least 0 or more" })
|
@Min(0, { message: 'Property NoOfTimesEntLeave must be at least 0 or more' })
|
||||||
@IsInt()
|
@IsInt()
|
||||||
@IsNumber({}, { message: "Property NoOfTimesEntLeave must be a number" })
|
@IsNumber({}, { message: 'Property NoOfTimesEntLeave must be a number' })
|
||||||
@IsDefined({ message: "Property NoOfTimesEntLeave is required" })
|
@IsDefined({ message: 'Property NoOfTimesEntLeave is required' })
|
||||||
NoOfTimesEntLeave: number;
|
NoOfTimesEntLeave: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SaveCarnetApplicationDTO {
|
export class SaveCarnetApplicationDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||||
@IsInt()
|
@IsInt()
|
||||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||||
p_spid: number;
|
p_spid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_clientid must not exceed 999999999" })
|
@Max(999999999, { message: 'Property p_clientid must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property p_clientid must be at least 0 or more" })
|
@Min(0, { message: 'Property p_clientid must be at least 0 or more' })
|
||||||
@IsInt()
|
@IsInt()
|
||||||
@IsNumber({}, { message: "Property p_clientid must be a number" })
|
@IsNumber({}, { message: 'Property p_clientid must be a number' })
|
||||||
p_clientid: number;
|
p_clientid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_locationid must not exceed 999999999" })
|
@Max(999999999, {
|
||||||
@Min(0, { message: "Property p_locationid must be at least 0 or more" })
|
message: 'Property p_locationid must not exceed 999999999',
|
||||||
|
})
|
||||||
|
@Min(0, { message: 'Property p_locationid must be at least 0 or more' })
|
||||||
@IsInt()
|
@IsInt()
|
||||||
@IsNumber({}, { message: "Property p_locationid must be a number" })
|
@IsNumber({}, { message: 'Property p_locationid must be a number' })
|
||||||
p_locationid: number;
|
p_locationid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 50, { message: "Property p_userid must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
|
message: 'Property p_userid must be between 0 to 50 characters',
|
||||||
|
})
|
||||||
@IsString()
|
@IsString()
|
||||||
p_userid: string;
|
p_userid: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Max(999999999, { message: "Property p_headerid must not exceed 999999999" })
|
@Max(999999999, { message: 'Property p_headerid must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property p_headerid must be at least 0 or more" })
|
@Min(0, { message: 'Property p_headerid must be at least 0 or more' })
|
||||||
@IsInt()
|
@IsInt()
|
||||||
@IsNumber({}, { message: "Property p_headerid must be a number" })
|
@IsNumber({}, { message: 'Property p_headerid must be a number' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_headerid?: number;
|
p_headerid?: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 50, { message: "Property p_applicationname must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
|
message: 'Property p_applicationname must be between 0 to 50 characters',
|
||||||
|
})
|
||||||
@IsString()
|
@IsString()
|
||||||
p_applicationname: string;
|
p_applicationname: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Max(999999999, { message: "Property p_holderid must not exceed 999999999" })
|
@Max(999999999, { message: 'Property p_holderid must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property p_holderid must be at least 0 or more" })
|
@Min(0, { message: 'Property p_holderid must be at least 0 or more' })
|
||||||
@IsInt()
|
@IsInt()
|
||||||
@IsNumber({}, { message: "Property p_holderid must be a number" })
|
@IsNumber({}, { message: 'Property p_holderid must be a number' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_holderid?: number;
|
p_holderid?: number;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 1, { message: "Property p_commercialsampleflag must be between 0 to 1 characters" })
|
@Length(0, 1, {
|
||||||
|
message:
|
||||||
|
'Property p_commercialsampleflag must be between 0 to 1 characters',
|
||||||
|
})
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_commercialsampleflag?: string;
|
p_commercialsampleflag?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 1, { message: "Property p_profequipmentflag must be between 0 to 1 characters" })
|
@Length(0, 1, {
|
||||||
|
message: 'Property p_profequipmentflag must be between 0 to 1 characters',
|
||||||
|
})
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_profequipmentflag?: string;
|
p_profequipmentflag?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 1, { message: "Property p_exhibitionsfairflag must be between 0 to 1 characters" })
|
@Length(0, 1, {
|
||||||
|
message: 'Property p_exhibitionsfairflag must be between 0 to 1 characters',
|
||||||
|
})
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_exhibitionsfairflag?: string;
|
p_exhibitionsfairflag?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 1, { message: "Property p_autoflag must be between 0 to 1 characters" })
|
@Length(0, 1, {
|
||||||
|
message: 'Property p_autoflag must be between 0 to 1 characters',
|
||||||
|
})
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_autoflag?: string;
|
p_autoflag?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 1, { message: "Property p_horseflag must be between 0 to 1 characters" })
|
@Length(0, 1, {
|
||||||
|
message: 'Property p_horseflag must be between 0 to 1 characters',
|
||||||
|
})
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_horseflag?: string;
|
p_horseflag?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 200, { message: "Property p_authrep must be between 0 to 200 characters" })
|
@Length(0, 200, {
|
||||||
|
message: 'Property p_authrep must be between 0 to 200 characters',
|
||||||
|
})
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_authrep?: string;
|
p_authrep?: string;
|
||||||
@ -163,10 +205,10 @@ export class SaveCarnetApplicationDTO {
|
|||||||
p_gltable?: p_gltableDTO[];
|
p_gltable?: p_gltableDTO[];
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Max(99999, { message: "Property p_ussets must not exceed 99999" })
|
@Max(99999, { message: 'Property p_ussets must not exceed 99999' })
|
||||||
@Min(0, { message: "Property p_ussets must be at least 0 or more" })
|
@Min(0, { message: 'Property p_ussets must be at least 0 or more' })
|
||||||
@IsInt()
|
@IsInt()
|
||||||
@IsNumber({}, { message: "Property p_ussets must be a number" })
|
@IsNumber({}, { message: 'Property p_ussets must be a number' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_ussets?: number;
|
p_ussets?: number;
|
||||||
|
|
||||||
@ -178,69 +220,91 @@ export class SaveCarnetApplicationDTO {
|
|||||||
p_countrytable?: p_countrytableDTO[];
|
p_countrytable?: p_countrytableDTO[];
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 10, { message: "Property p_shiptotype must be between 0 to 10 characters" })
|
@Length(0, 10, {
|
||||||
|
message: 'Property p_shiptotype must be between 0 to 10 characters',
|
||||||
|
})
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_shiptotype?: string;
|
p_shiptotype?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Max(999999999, { message: "Property p_shipaddrid must not exceed 999999999" })
|
@Max(999999999, {
|
||||||
@Min(0, { message: "Property p_shipaddrid must be at least 0 or more" })
|
message: 'Property p_shipaddrid must not exceed 999999999',
|
||||||
|
})
|
||||||
|
@Min(0, { message: 'Property p_shipaddrid must be at least 0 or more' })
|
||||||
@IsInt()
|
@IsInt()
|
||||||
@IsNumber({}, { message: "Property p_shipaddrid must be a number" })
|
@IsNumber({}, { message: 'Property p_shipaddrid must be a number' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_shipaddrid?: number;
|
p_shipaddrid?: number;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 1, { message: "Property p_formofsecurity must be between 0 to 1 characters" })
|
@Length(0, 1, {
|
||||||
|
message: 'Property p_formofsecurity must be between 0 to 1 characters',
|
||||||
|
})
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_formofsecurity?: string;
|
p_formofsecurity?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 10, { message: "Property p_insprotection must be between 0 to 10 characters" })
|
@Length(0, 10, {
|
||||||
|
message: 'Property p_insprotection must be between 0 to 10 characters',
|
||||||
|
})
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_insprotection?: string;
|
p_insprotection?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 10, { message: "Property p_ldiprotection must be between 0 to 10 characters" })
|
@Length(0, 10, {
|
||||||
|
message: 'Property p_ldiprotection must be between 0 to 10 characters',
|
||||||
|
})
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_ldiprotection?: string;
|
p_ldiprotection?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 10, { message: "Property p_deliverytype must be between 0 to 10 characters" })
|
@Length(0, 10, {
|
||||||
|
message: 'Property p_deliverytype must be between 0 to 10 characters',
|
||||||
|
})
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_deliverytype?: string;
|
p_deliverytype?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 10, { message: "Property p_deliverymethod must be between 0 to 10 characters" })
|
@Length(0, 10, {
|
||||||
|
message: 'Property p_deliverymethod must be between 0 to 10 characters',
|
||||||
|
})
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_deliverymethod?: string;
|
p_deliverymethod?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 10, { message: "Property p_paymentmethod must be between 0 to 10 characters" })
|
@Length(0, 10, {
|
||||||
|
message: 'Property p_paymentmethod must be between 0 to 10 characters',
|
||||||
|
})
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_paymentmethod?: string;
|
p_paymentmethod?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 20, { message: "Property p_custcourierno must be between 0 to 20 characters" })
|
@Length(0, 20, {
|
||||||
|
message: 'Property p_custcourierno must be between 0 to 20 characters',
|
||||||
|
})
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_custcourierno?: string;
|
p_custcourierno?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 20, { message: "Property p_refno must be between 0 to 20 characters" })
|
@Length(0, 20, {
|
||||||
|
message: 'Property p_refno must be between 0 to 20 characters',
|
||||||
|
})
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_refno?: string;
|
p_refno?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 2000, { message: "Property p_notes must be between 0 to 2000 characters" })
|
@Length(0, 2000, {
|
||||||
|
message: 'Property p_notes must be between 0 to 2000 characters',
|
||||||
|
})
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_notes?: string;
|
p_notes?: string;
|
||||||
@ -248,46 +312,52 @@ export class SaveCarnetApplicationDTO {
|
|||||||
|
|
||||||
export class TransmitApplicationtoProcessDTO {
|
export class TransmitApplicationtoProcessDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||||
@IsInt()
|
@IsInt()
|
||||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||||
@IsDefined({message:"Property p_spid is required"})
|
@IsDefined({ message: 'Property p_spid is required' })
|
||||||
p_spid: number;
|
p_spid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 50, { message: "Property p_userid must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
|
message: 'Property p_userid must be between 0 to 50 characters',
|
||||||
|
})
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsDefined({message:"Property p_userid is required"})
|
@IsDefined({ message: 'Property p_userid is required' })
|
||||||
p_userid: string;
|
p_userid: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||||
@IsInt()
|
@IsInt()
|
||||||
@IsNumber({}, { message: "Property p_headerid must be a number" })
|
@IsNumber({}, { message: 'Property p_headerid must be a number' })
|
||||||
@IsDefined({message:"Property p_headerid is required"})
|
@IsDefined({ message: 'Property p_headerid is required' })
|
||||||
p_headerid: number;
|
p_headerid: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetCarnetDetailsbyCarnetStatusDTO {
|
export class GetCarnetDetailsbyCarnetStatusDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||||
@IsInt()
|
@IsInt()
|
||||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||||
@IsDefined({message:"Property p_spid is required"})
|
@IsDefined({ message: 'Property p_spid is required' })
|
||||||
p_spid: number;
|
p_spid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 50, { message: "Property p_userid must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property p_userid must be string" })
|
message: 'Property p_userid must be between 0 to 50 characters',
|
||||||
@IsDefined({message:"Property p_userid is required"})
|
})
|
||||||
|
@IsString({ message: 'Property p_userid must be string' })
|
||||||
|
@IsDefined({ message: 'Property p_userid is required' })
|
||||||
p_userid: string;
|
p_userid: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 20, { message: "Property p_CarnetStatus must be between 0 to 20 characters" })
|
@Length(0, 20, {
|
||||||
|
message: 'Property p_CarnetStatus must be between 0 to 20 characters',
|
||||||
|
})
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsDefined({message:"Property p_CarnetStatus is required"})
|
@IsDefined({ message: 'Property p_CarnetStatus is required' })
|
||||||
p_CarnetStatus: string;
|
p_CarnetStatus: string;
|
||||||
}
|
}
|
||||||
@ -4,8 +4,8 @@ import { HomePageController } from './home-page.controller';
|
|||||||
import { DbModule } from 'src/db/db.module';
|
import { DbModule } from 'src/db/db.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports:[DbModule],
|
imports: [DbModule],
|
||||||
providers: [ HomePageService],
|
providers: [HomePageService],
|
||||||
controllers: [HomePageController]
|
controllers: [HomePageController],
|
||||||
})
|
})
|
||||||
export class HomePageModule {}
|
export class HomePageModule {}
|
||||||
|
|||||||
@ -1,23 +1,21 @@
|
|||||||
import { Injectable } from "@nestjs/common";
|
import { Injectable } from '@nestjs/common';
|
||||||
import { OracleDBService } from "src/db/db.service";
|
import { OracleDBService } from 'src/db/db.service';
|
||||||
import * as oracledb from 'oracledb'
|
import * as oracledb from 'oracledb';
|
||||||
import {
|
import {
|
||||||
p_gltableDTO,
|
p_gltableDTO,
|
||||||
p_countrytableDTO,
|
|
||||||
SaveCarnetApplicationDTO,
|
SaveCarnetApplicationDTO,
|
||||||
TransmitApplicationtoProcessDTO,
|
TransmitApplicationtoProcessDTO,
|
||||||
GetCarnetDetailsbyCarnetStatusDTO,
|
GetCarnetDetailsbyCarnetStatusDTO,
|
||||||
} from "./home-page.dto";
|
} from './home-page.dto';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class HomePageService {
|
export class HomePageService {
|
||||||
|
constructor(private readonly oracleDBService: OracleDBService) {}
|
||||||
constructor(private readonly oracleDBService: OracleDBService) { }
|
|
||||||
|
|
||||||
async GetHomePageData(P_spid: number) {
|
async GetHomePageData(P_spid: number) {
|
||||||
let connection;
|
let connection;
|
||||||
let p_basic_details = [];
|
let p_basic_details = [];
|
||||||
let p_contacts = []
|
let p_contacts = [];
|
||||||
let p_sequence = [];
|
let p_sequence = [];
|
||||||
let p_fees_comm = [];
|
let p_fees_comm = [];
|
||||||
let p_bf_fee = [];
|
let p_bf_fee = [];
|
||||||
@ -29,9 +27,9 @@ export class HomePageService {
|
|||||||
let p_region = [];
|
let p_region = [];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
connection = await this.oracleDBService.getConnection()
|
connection = await this.oracleDBService.getConnection();
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected');
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
@ -58,52 +56,52 @@ export class HomePageService {
|
|||||||
},
|
},
|
||||||
p_basic_details_cur: {
|
p_basic_details_cur: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
},
|
},
|
||||||
p_contacts_cur: {
|
p_contacts_cur: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
},
|
},
|
||||||
p_sequence_cur: {
|
p_sequence_cur: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
},
|
},
|
||||||
p_fees_comm_cur: {
|
p_fees_comm_cur: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
},
|
},
|
||||||
p_bf_fee_cur: {
|
p_bf_fee_cur: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
},
|
},
|
||||||
p_cf_Fee_cur: {
|
p_cf_Fee_cur: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
},
|
},
|
||||||
p_cont_sheet_fee_cur: {
|
p_cont_sheet_fee_cur: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
},
|
},
|
||||||
p_ef_fee_cur: {
|
p_ef_fee_cur: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
},
|
},
|
||||||
p_security_deposit_cur: {
|
p_security_deposit_cur: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
},
|
},
|
||||||
p_param_cur: {
|
p_param_cur: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
},
|
},
|
||||||
p_region_cur: {
|
p_region_cur: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result.outBinds && result.outBinds.p_basic_details_cur) {
|
if (result.outBinds && result.outBinds.p_basic_details_cur) {
|
||||||
@ -115,7 +113,6 @@ export class HomePageService {
|
|||||||
p_basic_details = p_basic_details.concat(rowsBatch);
|
p_basic_details = p_basic_details.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
await cursor.close();
|
await cursor.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,7 +125,6 @@ export class HomePageService {
|
|||||||
p_contacts = p_contacts.concat(rowsBatch);
|
p_contacts = p_contacts.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
await cursor.close();
|
await cursor.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +137,6 @@ export class HomePageService {
|
|||||||
p_sequence = p_sequence.concat(rowsBatch);
|
p_sequence = p_sequence.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
await cursor.close();
|
await cursor.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,7 +149,6 @@ export class HomePageService {
|
|||||||
p_fees_comm = p_fees_comm.concat(rowsBatch);
|
p_fees_comm = p_fees_comm.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
await cursor.close();
|
await cursor.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,7 +161,6 @@ export class HomePageService {
|
|||||||
p_bf_fee = p_bf_fee.concat(rowsBatch);
|
p_bf_fee = p_bf_fee.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
await cursor.close();
|
await cursor.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,7 +173,6 @@ export class HomePageService {
|
|||||||
p_cf_Fee = p_cf_Fee.concat(rowsBatch);
|
p_cf_Fee = p_cf_Fee.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
await cursor.close();
|
await cursor.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,7 +185,6 @@ export class HomePageService {
|
|||||||
p_cont_sheet_fee = p_cont_sheet_fee.concat(rowsBatch);
|
p_cont_sheet_fee = p_cont_sheet_fee.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
await cursor.close();
|
await cursor.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,7 +197,6 @@ export class HomePageService {
|
|||||||
p_ef_fee = p_ef_fee.concat(rowsBatch);
|
p_ef_fee = p_ef_fee.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
await cursor.close();
|
await cursor.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,7 +209,6 @@ export class HomePageService {
|
|||||||
p_security_deposit = p_security_deposit.concat(rowsBatch);
|
p_security_deposit = p_security_deposit.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
await cursor.close();
|
await cursor.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,7 +221,6 @@ export class HomePageService {
|
|||||||
p_param = p_param.concat(rowsBatch);
|
p_param = p_param.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
await cursor.close();
|
await cursor.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,15 +233,12 @@ export class HomePageService {
|
|||||||
p_region = p_region.concat(rowsBatch);
|
p_region = p_region.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
await cursor.close();
|
await cursor.close();
|
||||||
}
|
} else {
|
||||||
|
|
||||||
else {
|
|
||||||
throw new Error('No cursor returned from the stored procedure');
|
throw new Error('No cursor returned from the stored procedure');
|
||||||
}
|
}
|
||||||
|
|
||||||
let tableData = {
|
const tableData = {
|
||||||
p_basic_details,
|
p_basic_details,
|
||||||
p_contacts,
|
p_contacts,
|
||||||
p_sequence,
|
p_sequence,
|
||||||
@ -267,16 +252,17 @@ export class HomePageService {
|
|||||||
p_region,
|
p_region,
|
||||||
};
|
};
|
||||||
|
|
||||||
let output = {}
|
const output = {};
|
||||||
|
|
||||||
for (const key in tableData) {
|
for (const key in tableData) {
|
||||||
// console.log(key);
|
// console.log(key);
|
||||||
|
|
||||||
output[key] = tableData[key].map(obj => {
|
output[key] = tableData[key].map((obj) => {
|
||||||
const newObj = { ...obj };
|
const newObj = { ...obj };
|
||||||
for (const innerKey in obj) {
|
for (const innerKey in obj) {
|
||||||
if (key === 'p_fees_comm') {
|
if (key === 'p_fees_comm') {
|
||||||
if (innerKey.includes(' ')) { // Check if the key has a space
|
if (innerKey.includes(' ')) {
|
||||||
|
// Check if the key has a space
|
||||||
const newKey = innerKey.replace(/ /g, '_').toUpperCase(); // Replace spaces and convert to uppercase
|
const newKey = innerKey.replace(/ /g, '_').toUpperCase(); // Replace spaces and convert to uppercase
|
||||||
newObj[newKey] = obj[innerKey]; // Add the new key
|
newObj[newKey] = obj[innerKey]; // Add the new key
|
||||||
delete newObj[innerKey]; // Remove the old key
|
delete newObj[innerKey]; // Remove the old key
|
||||||
@ -288,22 +274,22 @@ export class HomePageService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
return { error: err.message }
|
return { error: err.message };
|
||||||
} finally { }
|
} else {
|
||||||
|
return { error: 'An unknown error occurred' };
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async GetCarnetSummaryData(p_emailaddr: string) {
|
async GetCarnetSummaryData(p_emailaddr: string) {
|
||||||
|
|
||||||
let connection;
|
let connection;
|
||||||
let rows: any = [];
|
let rows: any = [];
|
||||||
try {
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
connection = await this.oracleDBService.getConnection()
|
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected');
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
@ -317,12 +303,12 @@ export class HomePageService {
|
|||||||
},
|
},
|
||||||
p_cursor: {
|
p_cursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result.outBinds && result.outBinds.p_cursor) {
|
if (result.outBinds && result.outBinds.p_cursor) {
|
||||||
@ -334,20 +320,19 @@ export class HomePageService {
|
|||||||
rows = rows.concat(rowsBatch);
|
rows = rows.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
await cursor.close();
|
await cursor.close();
|
||||||
} else {
|
} else {
|
||||||
throw new Error('No cursor returned from the stored procedure');
|
throw new Error('No cursor returned from the stored procedure');
|
||||||
}
|
}
|
||||||
|
|
||||||
rows = rows.map(obj => {
|
rows = rows.map((obj) => {
|
||||||
// Create a new object to hold the modified keys
|
// Create a new object to hold the modified keys
|
||||||
let newObj = {};
|
const newObj = {};
|
||||||
|
|
||||||
// Iterate over the keys of the current object
|
// Iterate over the keys of the current object
|
||||||
for (let key in obj) {
|
for (const key in obj) {
|
||||||
// Replace spaces with underscores in the key
|
// Replace spaces with underscores in the key
|
||||||
let newKey = key.replace(/ /g, "_");
|
const newKey = key.replace(/ /g, '_');
|
||||||
newObj[newKey] = obj[key];
|
newObj[newKey] = obj[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -356,19 +341,23 @@ export class HomePageService {
|
|||||||
|
|
||||||
rows = rows.reduce((acc, curr) => {
|
rows = rows.reduce((acc, curr) => {
|
||||||
// Find if the current item already exists in the accumulator
|
// Find if the current item already exists in the accumulator
|
||||||
let existing = acc.find(item => item["Service_Provider_Name"] === curr["Service_Provider_Name"] && item.SPID === curr.SPID);
|
const existing = acc.find(
|
||||||
|
(item) =>
|
||||||
|
item['Service_Provider_Name'] === curr['Service_Provider_Name'] &&
|
||||||
|
item.SPID === curr.SPID,
|
||||||
|
);
|
||||||
|
|
||||||
if (existing) {
|
if (existing) {
|
||||||
// If it exists, push the current "cs" and "c c" values into the arrays
|
// If it exists, push the current "cs" and "c c" values into the arrays
|
||||||
existing.CARNETSTATUS.push(curr.CARNETSTATUS);
|
existing.CARNETSTATUS.push(curr.CARNETSTATUS);
|
||||||
existing["Carnet_Count"].push(curr["Carnet_Count"]);
|
existing['Carnet_Count'].push(curr['Carnet_Count']);
|
||||||
} else {
|
} else {
|
||||||
// If it doesn't exist, create a new entry
|
// If it doesn't exist, create a new entry
|
||||||
acc.push({
|
acc.push({
|
||||||
"Service_Provider_Name": curr["Service_Provider_Name"],
|
Service_Provider_Name: curr['Service_Provider_Name'],
|
||||||
SPID: curr.SPID,
|
SPID: curr.SPID,
|
||||||
CARNETSTATUS: [curr.CARNETSTATUS],
|
CARNETSTATUS: [curr.CARNETSTATUS],
|
||||||
"Carnet_Count": [curr["Carnet_Count"]]
|
Carnet_Count: [curr['Carnet_Count']],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -376,48 +365,48 @@ export class HomePageService {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return rows;
|
return rows;
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
return { error: err.message }
|
return { error: err.message };
|
||||||
} finally { }
|
} else {
|
||||||
|
return { error: 'An unknown error occurred' };
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async SaveCarnetApplication(body: SaveCarnetApplicationDTO) {
|
async SaveCarnetApplication(body: SaveCarnetApplicationDTO) {
|
||||||
|
const newBody = {
|
||||||
|
p_headerid: null,
|
||||||
|
p_holderid: null,
|
||||||
|
p_commercialsampleflag: null,
|
||||||
|
p_profequipmentflag: null,
|
||||||
|
p_exhibitionsfairflag: null,
|
||||||
|
p_autoflag: null,
|
||||||
|
p_horseflag: null,
|
||||||
|
p_authrep: null,
|
||||||
|
p_gltable: null,
|
||||||
|
p_ussets: null,
|
||||||
|
p_countrytable: null,
|
||||||
|
p_shiptotype: null,
|
||||||
|
p_shipaddrid: null,
|
||||||
|
p_formofsecurity: null,
|
||||||
|
p_insprotection: null,
|
||||||
|
p_ldiprotection: null,
|
||||||
|
p_deliverytype: null,
|
||||||
|
p_deliverymethod: null,
|
||||||
|
p_paymentmethod: null,
|
||||||
|
p_custcourierno: null,
|
||||||
|
p_refno: null,
|
||||||
|
p_notes: null,
|
||||||
|
};
|
||||||
|
|
||||||
let newBody = {
|
const reqBody = JSON.parse(JSON.stringify(body));
|
||||||
"p_headerid": null,
|
|
||||||
"p_holderid": null,
|
|
||||||
"p_commercialsampleflag": null,
|
|
||||||
"p_profequipmentflag": null,
|
|
||||||
"p_exhibitionsfairflag": null,
|
|
||||||
"p_autoflag": null,
|
|
||||||
"p_horseflag": null,
|
|
||||||
"p_authrep": null,
|
|
||||||
"p_gltable": null,
|
|
||||||
"p_ussets": null,
|
|
||||||
"p_countrytable": null,
|
|
||||||
"p_shiptotype": null,
|
|
||||||
"p_shipaddrid": null,
|
|
||||||
"p_formofsecurity": null,
|
|
||||||
"p_insprotection": null,
|
|
||||||
"p_ldiprotection": null,
|
|
||||||
"p_deliverytype": null,
|
|
||||||
"p_deliverymethod": null,
|
|
||||||
"p_paymentmethod": null,
|
|
||||||
"p_custcourierno": null,
|
|
||||||
"p_refno": null,
|
|
||||||
"p_notes": null
|
|
||||||
}
|
|
||||||
|
|
||||||
let reqBody = JSON.parse(JSON.stringify(body));
|
|
||||||
|
|
||||||
function setEmptyStringsToNull(obj) {
|
function setEmptyStringsToNull(obj) {
|
||||||
Object.keys(obj).forEach(key => {
|
Object.keys(obj).forEach((key) => {
|
||||||
if (typeof obj[key] === 'object' && obj[key] !== null) {
|
if (typeof obj[key] === 'object' && obj[key] !== null) {
|
||||||
setEmptyStringsToNull(obj[key]);
|
setEmptyStringsToNull(obj[key]);
|
||||||
} else if (obj[key] === "") {
|
} else if (obj[key] === '') {
|
||||||
obj[key] = null;
|
obj[key] = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -430,17 +419,25 @@ export class HomePageService {
|
|||||||
let connection;
|
let connection;
|
||||||
let rows = [];
|
let rows = [];
|
||||||
try {
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
connection = await this.oracleDBService.getConnection()
|
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected');
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("here ------------ 1");
|
console.log('here ------------ 1');
|
||||||
|
|
||||||
// const res = await connection.execute(`SELECT CARNETSYS.GLARRAY(1, 'Description for itemno 1', 2500, 20, 12, 'LBS', 'US') FROM dual`);
|
// const res = await connection.execute(`SELECT CARNETSYS.GLARRAY(1, 'Description for itemno 1', 2500, 20, 12, 'LBS', 'US') FROM dual`);
|
||||||
|
|
||||||
async function createGLArrayInstance(connection, itemNo, itemDescription, itemValue, noOfPieces, itemWeight, itemWeightUOM, goodsOriginCountry) {
|
async function createGLArrayInstance(
|
||||||
|
connection,
|
||||||
|
itemNo,
|
||||||
|
itemDescription,
|
||||||
|
itemValue,
|
||||||
|
noOfPieces,
|
||||||
|
itemWeight,
|
||||||
|
itemWeightUOM,
|
||||||
|
goodsOriginCountry,
|
||||||
|
) {
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
`SELECT CARNETSYS.GLARRAY(:itemNo, :itemDescription, :itemValue, :noOfPieces, :itemWeight, :itemWeightUOM, :goodsOriginCountry) FROM dual`,
|
`SELECT CARNETSYS.GLARRAY(:itemNo, :itemDescription, :itemValue, :noOfPieces, :itemWeight, :itemWeightUOM, :goodsOriginCountry) FROM dual`,
|
||||||
{
|
{
|
||||||
@ -450,31 +447,37 @@ export class HomePageService {
|
|||||||
noOfPieces,
|
noOfPieces,
|
||||||
itemWeight,
|
itemWeight,
|
||||||
itemWeightUOM,
|
itemWeightUOM,
|
||||||
goodsOriginCountry
|
goodsOriginCountry,
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
return result.rows[0][0]; // Access the first row and first column to get the GLARRAY instance
|
return result.rows[0][0]; // Access the first row and first column to get the GLARRAY instance
|
||||||
}
|
}
|
||||||
|
|
||||||
async function createCarnetCountryArrayInstance(connection, visitTransitInd, countryCode, noOfTimesEntLeave) {
|
async function createCarnetCountryArrayInstance(
|
||||||
|
connection,
|
||||||
|
visitTransitInd,
|
||||||
|
countryCode,
|
||||||
|
noOfTimesEntLeave,
|
||||||
|
) {
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
`SELECT CARNETSYS.CARNETCOUNTRYARRAY(:visitTransitInd, :countryCode, :noOfTimesEntLeave) FROM dual`,
|
`SELECT CARNETSYS.CARNETCOUNTRYARRAY(:visitTransitInd, :countryCode, :noOfTimesEntLeave) FROM dual`,
|
||||||
{
|
{
|
||||||
visitTransitInd,
|
visitTransitInd,
|
||||||
countryCode,
|
countryCode,
|
||||||
noOfTimesEntLeave
|
noOfTimesEntLeave,
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
return result.rows[0][0]; // Access the first row and first column to get the CARNETCOUNTRYARRAY instance
|
return result.rows[0][0]; // Access the first row and first column to get the CARNETCOUNTRYARRAY instance
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// let res = await connection.execute(`SELECT owner, type_name FROM all_types WHERE type_name IN ('GLARRAY', 'GLTABLE')`)
|
// let res = await connection.execute(`SELECT owner, type_name FROM all_types WHERE type_name IN ('GLARRAY', 'GLTABLE')`)
|
||||||
|
|
||||||
// let GLARRAY = await connection.getDbObjectClass('CARNETSYS.GLARRAY');
|
// let GLARRAY = await connection.getDbObjectClass('CARNETSYS.GLARRAY');
|
||||||
const GLTABLE = await connection.getDbObjectClass('CARNETSYS.GLTABLE');
|
const GLTABLE = await connection.getDbObjectClass('CARNETSYS.GLTABLE');
|
||||||
// const CARNETCOUNTRYARRAY = await connection.getDbObjectClass('CARNETSYS.CARNETCOUNTRYARRAY');
|
// const CARNETCOUNTRYARRAY = await connection.getDbObjectClass('CARNETSYS.CARNETCOUNTRYARRAY');
|
||||||
const CARNETCOUNTRYTABLE = await connection.getDbObjectClass('CARNETSYS.CARNETCOUNTRYTABLE');
|
const CARNETCOUNTRYTABLE = await connection.getDbObjectClass(
|
||||||
|
'CARNETSYS.CARNETCOUNTRYTABLE',
|
||||||
|
);
|
||||||
|
|
||||||
// Check if GLTABLE is a constructor
|
// Check if GLTABLE is a constructor
|
||||||
if (typeof GLTABLE !== 'function') {
|
if (typeof GLTABLE !== 'function') {
|
||||||
@ -485,16 +488,40 @@ export class HomePageService {
|
|||||||
throw new Error('CARNETCOUNTRYTABLE is not a constructor');
|
throw new Error('CARNETCOUNTRYTABLE is not a constructor');
|
||||||
}
|
}
|
||||||
|
|
||||||
const GLTABLE_ARRAY = finalBody.p_gltable ? await Promise.all(finalBody.p_gltable.map(async (x:p_gltableDTO) => {
|
const GLTABLE_ARRAY = finalBody.p_gltable
|
||||||
return await createGLArrayInstance(connection, x.ItemNo, x.ItemDescription, x.ItemValue, x.Noofpieces, x.ItemWeight, x.ItemWeightUOM, x.GoodsOriginCountry);
|
? await Promise.all(
|
||||||
})) : [];
|
finalBody.p_gltable.map(async (x: p_gltableDTO) => {
|
||||||
|
return await createGLArrayInstance(
|
||||||
|
connection,
|
||||||
|
x.ItemNo,
|
||||||
|
x.ItemDescription,
|
||||||
|
x.ItemValue,
|
||||||
|
x.Noofpieces,
|
||||||
|
x.ItemWeight,
|
||||||
|
x.ItemWeightUOM,
|
||||||
|
x.GoodsOriginCountry,
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
: [];
|
||||||
|
|
||||||
const CARNETCOUNTRYTABLE_ARRAY = finalBody.p_countrytable ? await Promise.all(finalBody.p_countrytable.map(async (x) => {
|
const CARNETCOUNTRYTABLE_ARRAY = finalBody.p_countrytable
|
||||||
return await createCarnetCountryArrayInstance(connection, x.VisitTransitInd, x.CountryCode, x.NoOfTimesEntLeave);
|
? await Promise.all(
|
||||||
})) : [];
|
finalBody.p_countrytable.map(async (x) => {
|
||||||
|
return await createCarnetCountryArrayInstance(
|
||||||
|
connection,
|
||||||
|
x.VisitTransitInd,
|
||||||
|
x.CountryCode,
|
||||||
|
x.NoOfTimesEntLeave,
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
: [];
|
||||||
|
|
||||||
const GLTABLE_INSTANCE = new GLTABLE(GLTABLE_ARRAY);
|
const GLTABLE_INSTANCE = new GLTABLE(GLTABLE_ARRAY);
|
||||||
const CARNETCOUNTRYTABLE_INSTANCE = new CARNETCOUNTRYTABLE(CARNETCOUNTRYTABLE_ARRAY);
|
const CARNETCOUNTRYTABLE_INSTANCE = new CARNETCOUNTRYTABLE(
|
||||||
|
CARNETCOUNTRYTABLE_ARRAY,
|
||||||
|
);
|
||||||
|
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
`BEGIN
|
`BEGIN
|
||||||
@ -532,120 +559,129 @@ export class HomePageService {
|
|||||||
{
|
{
|
||||||
p_spid: {
|
p_spid: {
|
||||||
val: finalBody.p_spid ? finalBody.p_spid : null,
|
val: finalBody.p_spid ? finalBody.p_spid : null,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
p_clientid: {
|
p_clientid: {
|
||||||
val: finalBody.p_clientid ? finalBody.p_clientid : null,
|
val: finalBody.p_clientid ? finalBody.p_clientid : null,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
p_locationid: {
|
p_locationid: {
|
||||||
val: finalBody.p_locationid ? finalBody.p_locationid : null,
|
val: finalBody.p_locationid ? finalBody.p_locationid : null,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
p_userid: {
|
p_userid: {
|
||||||
val: finalBody.p_userid ? finalBody.p_userid : null,
|
val: finalBody.p_userid ? finalBody.p_userid : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_headerid: {
|
p_headerid: {
|
||||||
val: finalBody.p_headerid ? finalBody.p_headerid : null,
|
val: finalBody.p_headerid ? finalBody.p_headerid : null,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
p_applicationname: {
|
p_applicationname: {
|
||||||
val: finalBody.p_applicationname ? finalBody.p_applicationname : null,
|
val: finalBody.p_applicationname
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
? finalBody.p_applicationname
|
||||||
|
: null,
|
||||||
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_holderid: {
|
p_holderid: {
|
||||||
val: finalBody.p_holderid ? finalBody.p_holderid : null,
|
val: finalBody.p_holderid ? finalBody.p_holderid : null,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
p_commercialsampleflag: {
|
p_commercialsampleflag: {
|
||||||
val: finalBody.p_commercialsampleflag ? finalBody.p_commercialsampleflag : null,
|
val: finalBody.p_commercialsampleflag
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
? finalBody.p_commercialsampleflag
|
||||||
|
: null,
|
||||||
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_profequipmentflag: {
|
p_profequipmentflag: {
|
||||||
val: finalBody.p_profequipmentflag ? finalBody.p_profequipmentflag : null,
|
val: finalBody.p_profequipmentflag
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
? finalBody.p_profequipmentflag
|
||||||
|
: null,
|
||||||
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_exhibitionsfairflag: {
|
p_exhibitionsfairflag: {
|
||||||
val: finalBody.p_exhibitionsfairflag ? finalBody.p_exhibitionsfairflag : null,
|
val: finalBody.p_exhibitionsfairflag
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
? finalBody.p_exhibitionsfairflag
|
||||||
|
: null,
|
||||||
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_autoflag: {
|
p_autoflag: {
|
||||||
val: finalBody.p_autoflag ? finalBody.p_autoflag : null,
|
val: finalBody.p_autoflag ? finalBody.p_autoflag : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_horseflag: {
|
p_horseflag: {
|
||||||
val: finalBody.p_horseflag ? finalBody.p_horseflag : null,
|
val: finalBody.p_horseflag ? finalBody.p_horseflag : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_authrep: {
|
p_authrep: {
|
||||||
val: finalBody.p_authrep ? finalBody.p_authrep : null,
|
val: finalBody.p_authrep ? finalBody.p_authrep : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_gltable: {
|
p_gltable: {
|
||||||
val: GLTABLE_INSTANCE,
|
val: GLTABLE_INSTANCE,
|
||||||
type: oracledb.DB_TYPE_OBJECT
|
type: oracledb.DB_TYPE_OBJECT,
|
||||||
},
|
},
|
||||||
p_ussets: {
|
p_ussets: {
|
||||||
val: finalBody.p_ussets ? finalBody.p_ussets : null,
|
val: finalBody.p_ussets ? finalBody.p_ussets : null,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
p_countrytable: {
|
p_countrytable: {
|
||||||
val: CARNETCOUNTRYTABLE_INSTANCE,
|
val: CARNETCOUNTRYTABLE_INSTANCE,
|
||||||
type: oracledb.DB_TYPE_OBJECT
|
type: oracledb.DB_TYPE_OBJECT,
|
||||||
},
|
},
|
||||||
p_shiptotype: {
|
p_shiptotype: {
|
||||||
val: finalBody.p_shiptotype ? finalBody.p_shiptotype : null,
|
val: finalBody.p_shiptotype ? finalBody.p_shiptotype : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_shipaddrid: {
|
p_shipaddrid: {
|
||||||
val: finalBody.p_shipaddrid ? finalBody.p_shipaddrid : null,
|
val: finalBody.p_shipaddrid ? finalBody.p_shipaddrid : null,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
p_formofsecurity: {
|
p_formofsecurity: {
|
||||||
val: finalBody.p_formofsecurity ? finalBody.p_formofsecurity : null,
|
val: finalBody.p_formofsecurity ? finalBody.p_formofsecurity : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_insprotection: {
|
p_insprotection: {
|
||||||
val: finalBody.p_insprotection ? finalBody.p_insprotection : null,
|
val: finalBody.p_insprotection ? finalBody.p_insprotection : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_ldiprotection: {
|
p_ldiprotection: {
|
||||||
val: finalBody.p_ldiprotection ? finalBody.p_ldiprotection : null,
|
val: finalBody.p_ldiprotection ? finalBody.p_ldiprotection : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_deliverytype: {
|
p_deliverytype: {
|
||||||
val: finalBody.p_deliverytype ? finalBody.p_deliverytype : null,
|
val: finalBody.p_deliverytype ? finalBody.p_deliverytype : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_deliverymethod: {
|
p_deliverymethod: {
|
||||||
val: finalBody.p_deliverymethod ? finalBody.p_deliverymethod : null,
|
val: finalBody.p_deliverymethod ? finalBody.p_deliverymethod : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_paymentmethod: {
|
p_paymentmethod: {
|
||||||
val: finalBody.p_paymentmethod ? finalBody.p_paymentmethod : null,
|
val: finalBody.p_paymentmethod ? finalBody.p_paymentmethod : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_custcourierno: {
|
p_custcourierno: {
|
||||||
val: finalBody.p_custcourierno ? finalBody.p_custcourierno : null,
|
val: finalBody.p_custcourierno ? finalBody.p_custcourierno : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_refno: {
|
p_refno: {
|
||||||
val: finalBody.p_refno ? finalBody.p_refno : null,
|
val: finalBody.p_refno ? finalBody.p_refno : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_notes: {
|
p_notes: {
|
||||||
val: finalBody.p_notes ? finalBody.p_notes : null,
|
val: finalBody.p_notes ? finalBody.p_notes : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
|
|
||||||
P_cursor: {
|
P_cursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
}, {
|
},
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
{
|
||||||
}
|
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||||
|
},
|
||||||
);
|
);
|
||||||
await connection.commit();
|
await connection.commit();
|
||||||
|
|
||||||
@ -658,29 +694,28 @@ export class HomePageService {
|
|||||||
rows = rows.concat(rowsBatch);
|
rows = rows.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
await cursor.close();
|
await cursor.close();
|
||||||
} else {
|
} else {
|
||||||
throw new Error('No cursor returned from the stored procedure');
|
throw new Error('No cursor returned from the stored procedure');
|
||||||
}
|
}
|
||||||
|
|
||||||
return rows;
|
return rows;
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
return { error: err.message }
|
return { error: err.message };
|
||||||
} finally { }
|
} else {
|
||||||
|
return { error: 'An unknown error occurred' };
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async TransmitApplicationtoProcess(body: TransmitApplicationtoProcessDTO) {
|
async TransmitApplicationtoProcess(body: TransmitApplicationtoProcessDTO) {
|
||||||
|
|
||||||
let connection;
|
let connection;
|
||||||
let rows = [];
|
let rows = [];
|
||||||
try {
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
connection = await this.oracleDBService.getConnection()
|
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected');
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
@ -695,23 +730,24 @@ export class HomePageService {
|
|||||||
{
|
{
|
||||||
p_spid: {
|
p_spid: {
|
||||||
val: body.p_spid,
|
val: body.p_spid,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
p_userid: {
|
p_userid: {
|
||||||
val: body.p_userid,
|
val: body.p_userid,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_headerid: {
|
p_headerid: {
|
||||||
val: body.p_headerid,
|
val: body.p_headerid,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
P_cursor: {
|
P_cursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
}, {
|
},
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
{
|
||||||
}
|
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||||
|
},
|
||||||
);
|
);
|
||||||
await connection.commit();
|
await connection.commit();
|
||||||
|
|
||||||
@ -724,7 +760,6 @@ export class HomePageService {
|
|||||||
rows = rows.concat(rowsBatch);
|
rows = rows.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
await cursor.close();
|
await cursor.close();
|
||||||
} else {
|
} else {
|
||||||
throw new Error('No cursor returned from the stored procedure');
|
throw new Error('No cursor returned from the stored procedure');
|
||||||
@ -733,23 +768,24 @@ export class HomePageService {
|
|||||||
return rows;
|
return rows;
|
||||||
|
|
||||||
// return fres
|
// return fres
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
return { error: err.message }
|
return { error: err.message };
|
||||||
} finally { }
|
} else {
|
||||||
|
return { error: 'An unknown error occurred' };
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async GetCarnetDetailsbyCarnetStatus(body: GetCarnetDetailsbyCarnetStatusDTO) {
|
async GetCarnetDetailsbyCarnetStatus(
|
||||||
|
body: GetCarnetDetailsbyCarnetStatusDTO,
|
||||||
|
) {
|
||||||
let connection;
|
let connection;
|
||||||
let rows: any = [];
|
let rows: any = [];
|
||||||
try {
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
connection = await this.oracleDBService.getConnection()
|
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected');
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
@ -771,12 +807,12 @@ export class HomePageService {
|
|||||||
},
|
},
|
||||||
P_cursor: {
|
P_cursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result.outBinds && result.outBinds.P_cursor) {
|
if (result.outBinds && result.outBinds.P_cursor) {
|
||||||
@ -788,17 +824,18 @@ export class HomePageService {
|
|||||||
rows = rows.concat(rowsBatch);
|
rows = rows.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
await cursor.close();
|
await cursor.close();
|
||||||
} else {
|
} else {
|
||||||
throw new Error('No cursor returned from the stored procedure');
|
throw new Error('No cursor returned from the stored procedure');
|
||||||
}
|
}
|
||||||
|
|
||||||
return rows;
|
return rows;
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
return { error: err.message }
|
return { error: err.message };
|
||||||
} finally { }
|
} else {
|
||||||
|
return { error: 'An unknown error occurred' };
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,70 +1,84 @@
|
|||||||
import { Body, Controller, Get, Post, Put, Query } from '@nestjs/common';
|
import { Body, Controller, Get, Post, Put, Query } from '@nestjs/common';
|
||||||
import { ManageClientsService } from './manage-clients.service';
|
import { ManageClientsService } from './manage-clients.service';
|
||||||
import { CreateAdditionalClientContactsDTO, CreateAdditionalClientLocationsDTO, CreateClientDataDTO, 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';
|
import { ApiTags } from '@nestjs/swagger';
|
||||||
|
|
||||||
@Controller('oracle')
|
@Controller('oracle')
|
||||||
export class ManageClientsController {
|
export class ManageClientsController {
|
||||||
|
constructor(private readonly manageClientsService: ManageClientsService) {}
|
||||||
constructor(private readonly manageClientsService:ManageClientsService){}
|
|
||||||
|
|
||||||
@ApiTags('Manage Clients - Oracle')
|
@ApiTags('Manage Clients - Oracle')
|
||||||
@Post('CreateNewClients')
|
@Post('CreateNewClients')
|
||||||
async CreateClientData(@Body() body:CreateClientDataDTO){
|
async CreateClientData(@Body() body: CreateClientDataDTO) {
|
||||||
return this.manageClientsService.CreateClientData(body);
|
return this.manageClientsService.CreateClientData(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Clients - Oracle')
|
@ApiTags('Manage Clients - Oracle')
|
||||||
@Put('UpdateClient')
|
@Put('UpdateClient')
|
||||||
async UpdateClient(@Body() body:UpdateClientDTO){
|
async UpdateClient(@Body() body: UpdateClientDTO) {
|
||||||
return this.manageClientsService.UpdateClient(body);
|
return this.manageClientsService.UpdateClient(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Clients - Oracle')
|
@ApiTags('Manage Clients - Oracle')
|
||||||
@Put('UpdateClientContacts')
|
@Put('UpdateClientContacts')
|
||||||
UpdateClientContacts(@Body() body:UpdateClientContactsDTO){
|
UpdateClientContacts(@Body() body: UpdateClientContactsDTO) {
|
||||||
return this.manageClientsService.UpdateClientContacts(body);
|
return this.manageClientsService.UpdateClientContacts(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Clients - Oracle')
|
@ApiTags('Manage Clients - Oracle')
|
||||||
@Put('UpdateClientLocations')
|
@Put('UpdateClientLocations')
|
||||||
UpdateClientLocations(@Body() body:UpdateClientLocationsDTO){
|
UpdateClientLocations(@Body() body: UpdateClientLocationsDTO) {
|
||||||
return this.manageClientsService.UpdateClientLocations(body);
|
return this.manageClientsService.UpdateClientLocations(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Clients - Oracle')
|
@ApiTags('Manage Clients - Oracle')
|
||||||
@Post('CreateAdditionalClientContacts')
|
@Post('CreateAdditionalClientContacts')
|
||||||
CreateClientContact(@Body() body:CreateAdditionalClientContactsDTO){
|
CreateClientContact(@Body() body: CreateAdditionalClientContactsDTO) {
|
||||||
return this.manageClientsService.CreateClientContact(body);
|
return this.manageClientsService.CreateClientContact(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Clients - Oracle')
|
@ApiTags('Manage Clients - Oracle')
|
||||||
@Post('CreateAdditionalClientLocations')
|
@Post('CreateAdditionalClientLocations')
|
||||||
CreateClientLocation(@Body() body:CreateAdditionalClientLocationsDTO){
|
CreateClientLocation(@Body() body: CreateAdditionalClientLocationsDTO) {
|
||||||
return this.manageClientsService.CreateClientLocation(body);
|
return this.manageClientsService.CreateClientLocation(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Clients - Oracle')
|
@ApiTags('Manage Clients - Oracle')
|
||||||
@Get('GetPreparers')
|
@Get('GetPreparers')
|
||||||
async GetPreparers(@Query() query:GetPreparersDTO) {
|
async GetPreparers(@Query() query: GetPreparersDTO) {
|
||||||
return await this.manageClientsService.GetPreparers(query)
|
return await this.manageClientsService.GetPreparers(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Clients - Oracle')
|
@ApiTags('Manage Clients - Oracle')
|
||||||
@Get('GetPreparerByClientid')
|
@Get('GetPreparerByClientid')
|
||||||
GetPreparerByClientid(@Query() body:GetPreparerByClientidContactsByClientidLocByClientidDTO){
|
GetPreparerByClientid(
|
||||||
|
@Query() body: GetPreparerByClientidContactsByClientidLocByClientidDTO,
|
||||||
|
) {
|
||||||
return this.manageClientsService.GetPreparerByClientid(body);
|
return this.manageClientsService.GetPreparerByClientid(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Clients - Oracle')
|
@ApiTags('Manage Clients - Oracle')
|
||||||
@Get('GetPreparerContactsByClientid')
|
@Get('GetPreparerContactsByClientid')
|
||||||
GetPreparerContactsByClientid(@Query() body:GetPreparerByClientidContactsByClientidLocByClientidDTO){
|
GetPreparerContactsByClientid(
|
||||||
|
@Query() body: GetPreparerByClientidContactsByClientidLocByClientidDTO,
|
||||||
|
) {
|
||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Clients - Oracle')
|
@ApiTags('Manage Clients - Oracle')
|
||||||
@Get('GetPreparerLocByClientid')
|
@Get('GetPreparerLocByClientid')
|
||||||
GetPreparerLocByClientid(@Query() body:GetPreparerByClientidContactsByClientidLocByClientidDTO){
|
GetPreparerLocByClientid(
|
||||||
|
@Query() body: GetPreparerByClientidContactsByClientidLocByClientidDTO,
|
||||||
|
) {
|
||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,60 +1,81 @@
|
|||||||
import { ApiProperty } from '@nestjs/swagger';
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
import { IsDefined, IsInt, IsNumber, IsOptional, IsString, Length, Max, Min, ValidateNested, IsArray, IsEmail } from 'class-validator';
|
import {
|
||||||
|
IsDefined,
|
||||||
|
IsInt,
|
||||||
|
IsNumber,
|
||||||
|
IsOptional,
|
||||||
|
IsString,
|
||||||
|
Length,
|
||||||
|
Max,
|
||||||
|
Min,
|
||||||
|
ValidateNested,
|
||||||
|
IsArray,
|
||||||
|
IsEmail,
|
||||||
|
} from 'class-validator';
|
||||||
import { Transform, Type } from 'class-transformer';
|
import { Transform, Type } from 'class-transformer';
|
||||||
import { p_contactstableDTO } from '../manage-holders/manage-holders.dto';
|
import { p_contactstableDTO } from '../manage-holders/manage-holders.dto';
|
||||||
|
|
||||||
|
|
||||||
export class p_clientlocaddresstableDTO {
|
export class p_clientlocaddresstableDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 50, { message: "Property Nameof must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property Nameof must be a string" })
|
message: 'Property Nameof must be between 0 to 50 characters',
|
||||||
@IsDefined({ message: "Property Nameof is required" })
|
})
|
||||||
|
@IsString({ message: 'Property Nameof must be a string' })
|
||||||
|
@IsDefined({ message: 'Property Nameof is required' })
|
||||||
Nameof: string;
|
Nameof: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 50, { message: "Property Address1 must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property Address1 must be a string" })
|
message: 'Property Address1 must be between 0 to 50 characters',
|
||||||
@IsDefined({ message: "Property Address1 is required" })
|
})
|
||||||
|
@IsString({ message: 'Property Address1 must be a string' })
|
||||||
|
@IsDefined({ message: 'Property Address1 is required' })
|
||||||
Address1: string;
|
Address1: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 50, { message: "Property Address2 must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property Address2 must be a string" })
|
message: 'Property Address2 must be between 0 to 50 characters',
|
||||||
|
})
|
||||||
|
@IsString({ message: 'Property Address2 must be a string' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
Address2?: string;
|
Address2?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 30, { message: "Property City must be between 0 to 30 characters" })
|
@Length(0, 30, {
|
||||||
@IsString({ message: "Property City must be a string" })
|
message: 'Property City must be between 0 to 30 characters',
|
||||||
@IsDefined({ message: "Property City is required" })
|
})
|
||||||
|
@IsString({ message: 'Property City must be a string' })
|
||||||
|
@IsDefined({ message: 'Property City is required' })
|
||||||
City: string;
|
City: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 2, { message: "Property State must be between 0 to 2 characters" })
|
@Length(0, 2, { message: 'Property State must be between 0 to 2 characters' })
|
||||||
@IsString({ message: "Property State must be a string" })
|
@IsString({ message: 'Property State must be a string' })
|
||||||
@IsDefined({ message: "Property State is required" })
|
@IsDefined({ message: 'Property State is required' })
|
||||||
State: string;
|
State: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 10, { message: "Property Zip must be between 0 to 10 characters" })
|
@Length(0, 10, { message: 'Property Zip must be between 0 to 10 characters' })
|
||||||
@IsString({ message: "Property Zip must be a string" })
|
@IsString({ message: 'Property Zip must be a string' })
|
||||||
@IsDefined({ message: "Property Zip is required" })
|
@IsDefined({ message: 'Property Zip is required' })
|
||||||
Zip: string;
|
Zip: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 2, { message: "Property Country must be between 0 to 2 characters" })
|
@Length(0, 2, {
|
||||||
@IsString({ message: "Property Country must be a string" })
|
message: 'Property Country must be between 0 to 2 characters',
|
||||||
@IsDefined({ message: "Property Country is required" })
|
})
|
||||||
|
@IsString({ message: 'Property Country must be a string' })
|
||||||
|
@IsDefined({ message: 'Property Country is required' })
|
||||||
Country: string;
|
Country: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CreateClientDataDTO {
|
export class CreateClientDataDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||||
@IsInt({ message: "Property p_spid allows only whole numbers" })
|
@IsInt({ message: 'Property p_spid allows only whole numbers' })
|
||||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||||
@IsDefined({ message: "Property p_spid is required" })
|
@IsDefined({ message: 'Property p_spid is required' })
|
||||||
p_spid: number;
|
p_spid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@ -63,427 +84,530 @@ export class CreateClientDataDTO {
|
|||||||
// @IsInt({ message: "Property p_clientname allows only whole numbers" })
|
// @IsInt({ message: "Property p_clientname allows only whole numbers" })
|
||||||
// @IsNumber({}, { message: "Property p_clientname must be a number" })
|
// @IsNumber({}, { message: "Property p_clientname must be a number" })
|
||||||
// @IsDefined({ message: "Property p_clientname is required" })
|
// @IsDefined({ message: "Property p_clientname is required" })
|
||||||
@Length(0, 50, { message: "Property p_clientname must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property p_clientname must be a string" })
|
message: 'Property p_clientname must be between 0 to 50 characters',
|
||||||
@IsDefined({ message: "Property p_clientname is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_clientname must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_clientname is required' })
|
||||||
p_clientname: string;
|
p_clientname: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 20, { message: "Property p_lookupcode must be between 0 to 20 characters" })
|
@Length(0, 20, {
|
||||||
@IsString({ message: "Property p_lookupcode must be a string" })
|
message: 'Property p_lookupcode must be between 0 to 20 characters',
|
||||||
@IsDefined({ message: "Property p_lookupcode is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_lookupcode must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_lookupcode is required' })
|
||||||
p_lookupcode: string;
|
p_lookupcode: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 50, { message: "Property p_address1 must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property p_address1 must be a string" })
|
message: 'Property p_address1 must be between 0 to 50 characters',
|
||||||
@IsDefined({ message: "Property p_address1 is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_address1 must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_address1 is required' })
|
||||||
p_address1: string;
|
p_address1: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 50, { message: "Property p_address2 must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property p_address2 must be a string" })
|
message: 'Property p_address2 must be between 0 to 50 characters',
|
||||||
|
})
|
||||||
|
@IsString({ message: 'Property p_address2 must be a string' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_address2?: string;
|
p_address2?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 30, { message: "Property p_city must be between 0 to 30 characters" })
|
@Length(0, 30, {
|
||||||
@IsString({ message: "Property p_city must be a string" })
|
message: 'Property p_city must be between 0 to 30 characters',
|
||||||
@IsDefined({ message: "Property p_city is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_city must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_city is required' })
|
||||||
p_city: string;
|
p_city: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 2, { message: "Property p_state must be between 0 to 2 characters" })
|
@Length(0, 2, {
|
||||||
@IsString({ message: "Property p_state must be a string" })
|
message: 'Property p_state must be between 0 to 2 characters',
|
||||||
@IsDefined({ message: "Property p_state is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_state must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_state is required' })
|
||||||
p_state: string;
|
p_state: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 10, { message: "Property p_zip must be between 0 to 10 characters" })
|
@Length(0, 10, {
|
||||||
@IsString({ message: "Property p_zip must be a string" })
|
message: 'Property p_zip must be between 0 to 10 characters',
|
||||||
|
})
|
||||||
|
@IsString({ message: 'Property p_zip must be a string' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_zip?: string;
|
p_zip?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 2, { message: "Property p_country must be between 0 to 2 characters" })
|
@Length(0, 2, {
|
||||||
@IsString({ message: "Property p_country must be a string" })
|
message: 'Property p_country must be between 0 to 2 characters',
|
||||||
|
})
|
||||||
|
@IsString({ message: 'Property p_country must be a string' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_country?: string;
|
p_country?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 2, { message: "Property p_issuingregion must be between 0 to 2 characters" })
|
@Length(0, 2, {
|
||||||
@IsString({ message: "Property p_issuingregion must be a string" })
|
message: 'Property p_issuingregion must be between 0 to 2 characters',
|
||||||
@IsDefined({ message: "Property p_issuingregion is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_issuingregion must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_issuingregion is required' })
|
||||||
p_issuingregion: string;
|
p_issuingregion: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 2, { message: "Property p_revenuelocation must be between 0 to 2 characters" })
|
@Length(0, 2, {
|
||||||
@IsString({ message: "Property p_revenuelocation must be a string" })
|
message: 'Property p_revenuelocation must be between 0 to 2 characters',
|
||||||
@IsDefined({ message: "Property p_revenuelocation is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_revenuelocation must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_revenuelocation is required' })
|
||||||
p_revenuelocation: string;
|
p_revenuelocation: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 100, { message: "Property p_userid must be between 0 to 100 characters" })
|
@Length(0, 100, {
|
||||||
@IsString({ message: "Property p_userid must be a string" })
|
message: 'Property p_userid must be between 0 to 100 characters',
|
||||||
@IsDefined({ message: "Property p_userid is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_userid must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_userid is required' })
|
||||||
p_userid: string;
|
p_userid: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true, type: () => [p_contactstableDTO] })
|
@ApiProperty({ required: true, type: () => [p_contactstableDTO] })
|
||||||
@Type(() => p_contactstableDTO)
|
@Type(() => p_contactstableDTO)
|
||||||
@ValidateNested({ each: true })
|
@ValidateNested({ each: true })
|
||||||
@IsArray({ message: "Property p_contactstable allows only array type" })
|
@IsArray({ message: 'Property p_contactstable allows only array type' })
|
||||||
@IsDefined({ message: "Property p_contactstable is required" })
|
@IsDefined({ message: 'Property p_contactstable is required' })
|
||||||
p_contactstable: p_contactstableDTO[];
|
p_contactstable: p_contactstableDTO[];
|
||||||
|
|
||||||
@ApiProperty({ required: true, type: () => [p_clientlocaddresstableDTO] })
|
@ApiProperty({ required: true, type: () => [p_clientlocaddresstableDTO] })
|
||||||
@Type(() => p_clientlocaddresstableDTO)
|
@Type(() => p_clientlocaddresstableDTO)
|
||||||
@ValidateNested({ each: true })
|
@ValidateNested({ each: true })
|
||||||
@IsArray({ message: "Property p_clientlocaddresstable allows only array type" })
|
@IsArray({
|
||||||
@IsDefined({ message: "Property p_clientlocaddresstable is required" })
|
message: 'Property p_clientlocaddresstable allows only array type',
|
||||||
|
})
|
||||||
|
@IsDefined({ message: 'Property p_clientlocaddresstable is required' })
|
||||||
p_clientlocaddresstable: p_clientlocaddresstableDTO[];
|
p_clientlocaddresstable: p_clientlocaddresstableDTO[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export class UpdateClientDTO {
|
export class UpdateClientDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||||
@IsInt({ message: "Property p_spid allows only whole numbers" })
|
@IsInt({ message: 'Property p_spid allows only whole numbers' })
|
||||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||||
@IsDefined({ message: "Property p_spid is required" })
|
@IsDefined({ message: 'Property p_spid is required' })
|
||||||
p_spid: number;
|
p_spid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_clientid must not exceed 999999999" })
|
@Max(999999999, { message: 'Property p_clientid must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property p_clientid must be at least 0 or more" })
|
@Min(0, { message: 'Property p_clientid must be at least 0 or more' })
|
||||||
@IsInt({ message: "Property p_clientid allows only whole numbers" })
|
@IsInt({ message: 'Property p_clientid allows only whole numbers' })
|
||||||
@IsNumber({}, { message: "Property p_clientid must be a number" })
|
@IsNumber({}, { message: 'Property p_clientid must be a number' })
|
||||||
@IsDefined({ message: "Property p_clientid is required" })
|
@IsDefined({ message: 'Property p_clientid is required' })
|
||||||
p_clientid: number;
|
p_clientid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 50, { message: "Property p_preparername must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property p_preparername must be a string" })
|
message: 'Property p_preparername must be between 0 to 50 characters',
|
||||||
@IsDefined({ message: "Property p_preparername is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_preparername must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_preparername is required' })
|
||||||
p_preparername: string;
|
p_preparername: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 50, { message: "Property p_address1 must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property p_address1 must be a string" })
|
message: 'Property p_address1 must be between 0 to 50 characters',
|
||||||
@IsDefined({ message: "Property p_address1 is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_address1 must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_address1 is required' })
|
||||||
p_address1: string;
|
p_address1: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 50, { message: "Property p_address2 must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property p_address2 must be a string" })
|
message: 'Property p_address2 must be between 0 to 50 characters',
|
||||||
|
})
|
||||||
|
@IsString({ message: 'Property p_address2 must be a string' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_address2?: string;
|
p_address2?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 30, { message: "Property p_city must be between 0 to 30 characters" })
|
@Length(0, 30, {
|
||||||
@IsString({ message: "Property p_city must be a string" })
|
message: 'Property p_city must be between 0 to 30 characters',
|
||||||
@IsDefined({ message: "Property p_city is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_city must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_city is required' })
|
||||||
p_city: string;
|
p_city: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 2, { message: "Property p_state must be between 0 to 2 characters" })
|
@Length(0, 2, {
|
||||||
@IsString({ message: "Property p_state must be a string" })
|
message: 'Property p_state must be between 0 to 2 characters',
|
||||||
@IsDefined({ message: "Property p_state is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_state must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_state is required' })
|
||||||
p_state: string;
|
p_state: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 10, { message: "Property p_zip must be between 0 to 10 characters" })
|
@Length(0, 10, {
|
||||||
@IsString({ message: "Property p_zip must be a string" })
|
message: 'Property p_zip must be between 0 to 10 characters',
|
||||||
@IsDefined({ message: "Property p_zip is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_zip must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_zip is required' })
|
||||||
p_zip: string;
|
p_zip: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 2, { message: "Property p_country must be between 0 to 2 characters" })
|
@Length(0, 2, {
|
||||||
@IsString({ message: "Property p_country must be a string" })
|
message: 'Property p_country must be between 0 to 2 characters',
|
||||||
@IsDefined({ message: "Property p_country is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_country must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_country is required' })
|
||||||
p_country: string;
|
p_country: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 2, { message: "Property p_revenuelocation must be between 0 to 2 characters" })
|
@Length(0, 2, {
|
||||||
@IsString({ message: "Property p_revenuelocation must be a string" })
|
message: 'Property p_revenuelocation must be between 0 to 2 characters',
|
||||||
@IsDefined({ message: "Property p_revenuelocation is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_revenuelocation must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_revenuelocation is required' })
|
||||||
p_revenuelocation: string;
|
p_revenuelocation: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 100, { message: "Property p_userid must be between 0 to 100 characters" })
|
@Length(0, 100, {
|
||||||
@IsString({ message: "Property p_userid must be a string" })
|
message: 'Property p_userid must be between 0 to 100 characters',
|
||||||
@IsDefined({ message: "Property p_userid is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_userid must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_userid is required' })
|
||||||
p_userid: string;
|
p_userid: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class UpdateClientContactsDTO {
|
export class UpdateClientContactsDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||||
@IsInt({ message: "Property p_spid allows only whole numbers" })
|
@IsInt({ message: 'Property p_spid allows only whole numbers' })
|
||||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||||
@IsDefined({ message: "Property p_spid is required" })
|
@IsDefined({ message: 'Property p_spid is required' })
|
||||||
p_spid: number;
|
p_spid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_clientcontactid must not exceed 999999999" })
|
@Max(999999999, {
|
||||||
@Min(0, { message: "Property p_clientcontactid must be at least 0 or more" })
|
message: 'Property p_clientcontactid must not exceed 999999999',
|
||||||
@IsInt({ message: "Property p_clientcontactid allows only whole numbers" })
|
})
|
||||||
@IsNumber({}, { message: "Property p_clientcontactid must be a number" })
|
@Min(0, { message: 'Property p_clientcontactid must be at least 0 or more' })
|
||||||
@IsDefined({ message: "Property p_clientcontactid is required" })
|
@IsInt({ message: 'Property p_clientcontactid allows only whole numbers' })
|
||||||
|
@IsNumber({}, { message: 'Property p_clientcontactid must be a number' })
|
||||||
|
@IsDefined({ message: 'Property p_clientcontactid is required' })
|
||||||
p_clientcontactid: number;
|
p_clientcontactid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 50, { message: "Property p_firstname must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property p_firstname must be a string" })
|
message: 'Property p_firstname must be between 0 to 50 characters',
|
||||||
@IsDefined({ message: "Property p_firstname is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_firstname must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_firstname is required' })
|
||||||
p_firstname: string;
|
p_firstname: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 50, { message: "Property p_lastname must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property p_lastname must be a string" })
|
message: 'Property p_lastname must be between 0 to 50 characters',
|
||||||
@IsDefined({ message: "Property p_lastname is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_lastname must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_lastname is required' })
|
||||||
p_lastname: string;
|
p_lastname: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 3, { message: "Property p_middleinitial must be between 0 to 3 characters" })
|
@Length(0, 3, {
|
||||||
@IsString({ message: "Property p_middleinitial must be a string" })
|
message: 'Property p_middleinitial must be between 0 to 3 characters',
|
||||||
|
})
|
||||||
|
@IsString({ message: 'Property p_middleinitial must be a string' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_middleinitial?: string;
|
p_middleinitial?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 50, { message: "Property p_title must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property p_title must be a string" })
|
message: 'Property p_title must be between 0 to 50 characters',
|
||||||
|
})
|
||||||
|
@IsString({ message: 'Property p_title must be a string' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_title?: string;
|
p_title?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 20, { message: "Property p_phone must be between 0 to 20 characters" })
|
@Length(0, 20, {
|
||||||
@IsString({ message: "Property p_phone must be a string" })
|
message: 'Property p_phone must be between 0 to 20 characters',
|
||||||
@IsDefined({ message: "Property p_phone is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_phone must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_phone is required' })
|
||||||
p_phone: string;
|
p_phone: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 20, { message: "Property p_fax must be between 0 to 20 characters" })
|
@Length(0, 20, {
|
||||||
@IsString({ message: "Property p_fax must be a string" })
|
message: 'Property p_fax must be between 0 to 20 characters',
|
||||||
@IsDefined({ message: "Property p_fax is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_fax must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_fax is required' })
|
||||||
p_fax: string;
|
p_fax: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 20, { message: "Property p_mobileno must be between 0 to 20 characters" })
|
@Length(0, 20, {
|
||||||
@IsString({ message: "Property p_mobileno must be a string" })
|
message: 'Property p_mobileno must be between 0 to 20 characters',
|
||||||
|
})
|
||||||
|
@IsString({ message: 'Property p_mobileno must be a string' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_mobileno?: string;
|
p_mobileno?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 100, { message: "Property p_emailaddress must be between 0 to 100 characters" })
|
@Length(0, 100, {
|
||||||
@IsEmail({}, { message: "Property p_emailaddress must be a valid email address" })
|
message: 'Property p_emailaddress must be between 0 to 100 characters',
|
||||||
@IsDefined({ message: "Property p_emailaddress is required" })
|
})
|
||||||
|
@IsEmail(
|
||||||
|
{},
|
||||||
|
{ message: 'Property p_emailaddress must be a valid email address' },
|
||||||
|
)
|
||||||
|
@IsDefined({ message: 'Property p_emailaddress is required' })
|
||||||
p_emailaddress: string;
|
p_emailaddress: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 100, { message: "Property p_userid must be between 0 to 100 characters" })
|
@Length(0, 100, {
|
||||||
@IsString({ message: "Property p_userid must be a string" })
|
message: 'Property p_userid must be between 0 to 100 characters',
|
||||||
@IsDefined({ message: "Property p_userid is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_userid must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_userid is required' })
|
||||||
p_userid: string;
|
p_userid: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetPreparersDTO {
|
export class GetPreparersDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Transform(({ value }) => Number(value))
|
@Transform(({ value }) => Number(value))
|
||||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||||
@IsInt({ message: "Property p_spid allows only whole numbers" })
|
@IsInt({ message: 'Property p_spid allows only whole numbers' })
|
||||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||||
@IsDefined({ message: "Property p_spid is required" })
|
@IsDefined({ message: 'Property p_spid is required' })
|
||||||
p_spid: number;
|
p_spid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 50, { message: "Property p_name must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property p_name must be a string" })
|
message: 'Property p_name must be between 0 to 50 characters',
|
||||||
|
})
|
||||||
|
@IsString({ message: 'Property p_name must be a string' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_name?: string;
|
p_name?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 30, { message: "Property p_lookupcode must be between 0 to 30 characters" })
|
@Length(0, 30, {
|
||||||
@IsString({ message: "Property p_lookupcode must be a string" })
|
message: 'Property p_lookupcode must be between 0 to 30 characters',
|
||||||
|
})
|
||||||
|
@IsString({ message: 'Property p_lookupcode must be a string' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_lookupcode?: string;
|
p_lookupcode?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 20, { message: "Property p_city must be between 0 to 20 characters" })
|
@Length(0, 20, {
|
||||||
@IsString({ message: "Property p_city must be a string" })
|
message: 'Property p_city must be between 0 to 20 characters',
|
||||||
|
})
|
||||||
|
@IsString({ message: 'Property p_city must be a string' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_city?: string;
|
p_city?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 2, { message: "Property p_state must be between 0 to 2 characters" })
|
@Length(0, 2, {
|
||||||
@IsString({ message: "Property p_state must be a string" })
|
message: 'Property p_state must be between 0 to 2 characters',
|
||||||
|
})
|
||||||
|
@IsString({ message: 'Property p_state must be a string' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_state?: string;
|
p_state?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 10, { message: "Property p_status must be between 0 to 10 characters" })
|
@Length(0, 10, {
|
||||||
@IsString({ message: "Property p_status must be a string" })
|
message: 'Property p_status must be between 0 to 10 characters',
|
||||||
@IsDefined({ message: "Property p_status is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_status must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_status is required' })
|
||||||
p_status: string;
|
p_status: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class UpdateClientLocationsDTO {
|
export class UpdateClientLocationsDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||||
@IsInt({ message: "Property p_spid allows only whole numbers" })
|
@IsInt({ message: 'Property p_spid allows only whole numbers' })
|
||||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||||
@IsDefined({ message: "Property p_spid is required" })
|
@IsDefined({ message: 'Property p_spid is required' })
|
||||||
p_spid: number;
|
p_spid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_clientlocationid must not exceed 999999999" })
|
@Max(999999999, {
|
||||||
@Min(0, { message: "Property p_clientlocationid must be at least 0 or more" })
|
message: 'Property p_clientlocationid must not exceed 999999999',
|
||||||
@IsInt({ message: "Property p_clientlocationid allows only whole numbers" })
|
})
|
||||||
@IsNumber({}, { message: "Property p_clientlocationid must be a number" })
|
@Min(0, { message: 'Property p_clientlocationid must be at least 0 or more' })
|
||||||
@IsDefined({ message: "Property p_clientlocationid is required" })
|
@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;
|
p_clientlocationid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 50, { message: "Property p_lcoationname must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property p_lcoationname must be a string" })
|
message: 'Property p_lcoationname must be between 0 to 50 characters',
|
||||||
@IsDefined({ message: "Property p_lcoationname is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_lcoationname must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_lcoationname is required' })
|
||||||
p_lcoationname: string;
|
p_lcoationname: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 50, { message: "Property p_address1 must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property p_address1 must be a string" })
|
message: 'Property p_address1 must be between 0 to 50 characters',
|
||||||
@IsDefined({ message: "Property p_address1 is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_address1 must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_address1 is required' })
|
||||||
p_address1: string;
|
p_address1: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 50, { message: "Property p_address2 must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property p_address2 must be a string" })
|
message: 'Property p_address2 must be between 0 to 50 characters',
|
||||||
|
})
|
||||||
|
@IsString({ message: 'Property p_address2 must be a string' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_address2?: string;
|
p_address2?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 30, { message: "Property p_city must be between 0 to 30 characters" })
|
@Length(0, 30, {
|
||||||
@IsString({ message: "Property p_city must be a string" })
|
message: 'Property p_city must be between 0 to 30 characters',
|
||||||
|
})
|
||||||
|
@IsString({ message: 'Property p_city must be a string' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_city?: string;
|
p_city?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 2, { message: "Property p_state must be between 0 to 2 characters" })
|
@Length(0, 2, {
|
||||||
@IsString({ message: "Property p_state must be a string" })
|
message: 'Property p_state must be between 0 to 2 characters',
|
||||||
@IsDefined({ message: "Property p_state is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_state must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_state is required' })
|
||||||
p_state: string;
|
p_state: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 10, { message: "Property p_zip must be between 0 to 10 characters" })
|
@Length(0, 10, {
|
||||||
@IsString({ message: "Property p_zip must be a string" })
|
message: 'Property p_zip must be between 0 to 10 characters',
|
||||||
@IsDefined({ message: "Property p_zip is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_zip must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_zip is required' })
|
||||||
p_zip: string;
|
p_zip: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 2, { message: "Property p_country must be between 0 to 2 characters" })
|
@Length(0, 2, {
|
||||||
@IsString({ message: "Property p_country must be a string" })
|
message: 'Property p_country must be between 0 to 2 characters',
|
||||||
@IsDefined({ message: "Property p_country is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_country must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_country is required' })
|
||||||
p_country: string;
|
p_country: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 100, { message: "Property p_userid must be between 0 to 100 characters" })
|
@Length(0, 100, {
|
||||||
@IsString({ message: "Property p_userid must be a string" })
|
message: 'Property p_userid must be between 0 to 100 characters',
|
||||||
@IsDefined({ message: "Property p_userid is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_userid must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_userid is required' })
|
||||||
p_userid: string;
|
p_userid: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CreateAdditionalClientContactsDTO {
|
export class CreateAdditionalClientContactsDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||||
@IsInt({ message: "Property p_spid allows only whole numbers" })
|
@IsInt({ message: 'Property p_spid allows only whole numbers' })
|
||||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||||
@IsDefined({ message: "Property p_spid is required" })
|
@IsDefined({ message: 'Property p_spid is required' })
|
||||||
p_spid: number;
|
p_spid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_clientid must not exceed 999999999" })
|
@Max(999999999, { message: 'Property p_clientid must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property p_clientid must be at least 0 or more" })
|
@Min(0, { message: 'Property p_clientid must be at least 0 or more' })
|
||||||
@IsInt({ message: "Property p_clientid allows only whole numbers" })
|
@IsInt({ message: 'Property p_clientid allows only whole numbers' })
|
||||||
@IsNumber({}, { message: "Property p_clientid must be a number" })
|
@IsNumber({}, { message: 'Property p_clientid must be a number' })
|
||||||
@IsDefined({ message: "Property p_clientid is required" })
|
@IsDefined({ message: 'Property p_clientid is required' })
|
||||||
p_clientid: number;
|
p_clientid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true, type: () => [p_contactstableDTO] })
|
@ApiProperty({ required: true, type: () => [p_contactstableDTO] })
|
||||||
@Type(() => p_contactstableDTO)
|
@Type(() => p_contactstableDTO)
|
||||||
@ValidateNested({ each: true })
|
@ValidateNested({ each: true })
|
||||||
@IsArray({ message: "Property p_contactstable allows only array type" })
|
@IsArray({ message: 'Property p_contactstable allows only array type' })
|
||||||
@IsDefined({ message: "Property p_contactstable is required" })
|
@IsDefined({ message: 'Property p_contactstable is required' })
|
||||||
p_contactstable: p_contactstableDTO[];
|
p_contactstable: p_contactstableDTO[];
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 1, { message: "Property p_defcontactflag must be exactly 1 character" })
|
@Length(0, 1, {
|
||||||
@IsString({ message: "Property p_defcontactflag must be a string" })
|
message: 'Property p_defcontactflag must be exactly 1 character',
|
||||||
@IsDefined({ message: "Property p_defcontactflag is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_defcontactflag must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_defcontactflag is required' })
|
||||||
p_defcontactflag: string;
|
p_defcontactflag: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 100, { message: "Property p_userid must be between 0 to 100 characters" })
|
@Length(0, 100, {
|
||||||
@IsString({ message: "Property p_userid must be a string" })
|
message: 'Property p_userid must be between 0 to 100 characters',
|
||||||
@IsDefined({ message: "Property p_userid is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_userid must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_userid is required' })
|
||||||
p_userid: string;
|
p_userid: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CreateAdditionalClientLocationsDTO {
|
export class CreateAdditionalClientLocationsDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||||
@IsInt({ message: "Property p_spid allows only whole numbers" })
|
@IsInt({ message: 'Property p_spid allows only whole numbers' })
|
||||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||||
@IsDefined({ message: "Property p_spid is required" })
|
@IsDefined({ message: 'Property p_spid is required' })
|
||||||
p_spid: number;
|
p_spid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_clientid must not exceed 999999999" })
|
@Max(999999999, { message: 'Property p_clientid must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property p_clientid must be at least 0 or more" })
|
@Min(0, { message: 'Property p_clientid must be at least 0 or more' })
|
||||||
@IsInt({ message: "Property p_clientid allows only whole numbers" })
|
@IsInt({ message: 'Property p_clientid allows only whole numbers' })
|
||||||
@IsNumber({}, { message: "Property p_clientid must be a number" })
|
@IsNumber({}, { message: 'Property p_clientid must be a number' })
|
||||||
@IsDefined({ message: "Property p_clientid is required" })
|
@IsDefined({ message: 'Property p_clientid is required' })
|
||||||
p_clientid: number;
|
p_clientid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true, type: () => [p_clientlocaddresstableDTO] })
|
@ApiProperty({ required: true, type: () => [p_clientlocaddresstableDTO] })
|
||||||
@Type(() => p_clientlocaddresstableDTO)
|
@Type(() => p_clientlocaddresstableDTO)
|
||||||
@ValidateNested({ each: true })
|
@ValidateNested({ each: true })
|
||||||
@IsArray({ message: "Property p_clientlocaddresstable allows only array type" })
|
@IsArray({
|
||||||
@IsDefined({ message: "Property p_clientlocaddresstable is required" })
|
message: 'Property p_clientlocaddresstable allows only array type',
|
||||||
|
})
|
||||||
|
@IsDefined({ message: 'Property p_clientlocaddresstable is required' })
|
||||||
p_clientlocaddresstable: p_clientlocaddresstableDTO[];
|
p_clientlocaddresstable: p_clientlocaddresstableDTO[];
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 1, { message: "Property p_defcontactflag must be exactly 1 character" })
|
@Length(0, 1, {
|
||||||
@IsString({ message: "Property p_defcontactflag must be a string" })
|
message: 'Property p_defcontactflag must be exactly 1 character',
|
||||||
@IsDefined({ message: "Property p_defcontactflag is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_defcontactflag must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_defcontactflag is required' })
|
||||||
p_defcontactflag: string;
|
p_defcontactflag: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 100, { message: "Property p_userid must be between 0 to 100 characters" })
|
@Length(0, 100, {
|
||||||
@IsString({ message: "Property p_userid must be a string" })
|
message: 'Property p_userid must be between 0 to 100 characters',
|
||||||
@IsDefined({ message: "Property p_userid is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_userid must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_userid is required' })
|
||||||
p_userid: string;
|
p_userid: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetPreparerByClientidContactsByClientidLocByClientidDTO {
|
export class GetPreparerByClientidContactsByClientidLocByClientidDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Transform(({ value }) => Number(value))
|
@Transform(({ value }) => Number(value))
|
||||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||||
@IsInt({ message: "Property p_spid allows only whole numbers" })
|
@IsInt({ message: 'Property p_spid allows only whole numbers' })
|
||||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||||
@IsDefined({ message: "Property p_spid is required" })
|
@IsDefined({ message: 'Property p_spid is required' })
|
||||||
p_spid: number;
|
p_spid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Transform(({ value }) => Number(value))
|
@Transform(({ value }) => Number(value))
|
||||||
@Max(999999999, { message: "Property p_clientid must not exceed 999999999" })
|
@Max(999999999, { message: 'Property p_clientid must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property p_clientid must be at least 0 or more" })
|
@Min(0, { message: 'Property p_clientid must be at least 0 or more' })
|
||||||
@IsInt({ message: "Property p_clientid allows only whole numbers" })
|
@IsInt({ message: 'Property p_clientid allows only whole numbers' })
|
||||||
@IsNumber({}, { message: "Property p_clientid must be a number" })
|
@IsNumber({}, { message: 'Property p_clientid must be a number' })
|
||||||
@IsDefined({ message: "Property p_clientid is required" })
|
@IsDefined({ message: 'Property p_clientid is required' })
|
||||||
p_clientid: number;
|
p_clientid: number;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,6 @@ import { ManageClientsService } from './manage-clients.service';
|
|||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
controllers: [ManageClientsController],
|
controllers: [ManageClientsController],
|
||||||
providers: [ManageClientsService]
|
providers: [ManageClientsService],
|
||||||
})
|
})
|
||||||
export class ManageClientsModule {}
|
export class ManageClientsModule {}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
|||||||
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 { ManageFeeService } from './manage-fee.service';
|
||||||
import { ApiTags } from '@nestjs/swagger';
|
import { ApiTags } from '@nestjs/swagger';
|
||||||
import {
|
import {
|
||||||
@ -16,137 +16,136 @@ import {
|
|||||||
UpdateCfFeeDTO,
|
UpdateCfFeeDTO,
|
||||||
UpdateCsFeeDTO,
|
UpdateCsFeeDTO,
|
||||||
UpdateEfFeeDTO,
|
UpdateEfFeeDTO,
|
||||||
UpdateFeeCommBodyDTO
|
UpdateFeeCommBodyDTO,
|
||||||
} from './manage-fee.dto';
|
} from './manage-fee.dto';
|
||||||
|
|
||||||
@Controller('manage-fee')
|
@Controller('manage-fee')
|
||||||
export class ManageFeeController {
|
export class ManageFeeController {
|
||||||
constructor(private readonly manageFeeService: ManageFeeService) { }
|
constructor(private readonly manageFeeService: ManageFeeService) {}
|
||||||
|
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
@ApiTags('Manage Fee - Oracle')
|
||||||
@Get('/GetBasicFeeRates')
|
@Get('/GetBasicFeeRates')
|
||||||
GetBasicFeeRates(@Query() body: GetFeeGeneralDTO) {
|
GetBasicFeeRates(@Query() body: GetFeeGeneralDTO) {
|
||||||
return this.manageFeeService.GETBASICFEERATES(body)
|
return this.manageFeeService.GETBASICFEERATES(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
@ApiTags('Manage Fee - Oracle')
|
||||||
@Get('/GetBondRates')
|
@Get('/GetBondRates')
|
||||||
GetBondRates(@Query() body: GetFeeGeneralDTO) {
|
GetBondRates(@Query() body: GetFeeGeneralDTO) {
|
||||||
return this.manageFeeService.GETBONDRATES(body)
|
return this.manageFeeService.GETBONDRATES(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
@ApiTags('Manage Fee - Oracle')
|
||||||
@Get('/GetCargoRates')
|
@Get('/GetCargoRates')
|
||||||
GetCargoRates(@Query() body: GetFeeGeneralDTO) {
|
GetCargoRates(@Query() body: GetFeeGeneralDTO) {
|
||||||
return this.manageFeeService.GETCARGORATES(body)
|
return this.manageFeeService.GETCARGORATES(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
@ApiTags('Manage Fee - Oracle')
|
||||||
@Get('/GetCfFeeRates')
|
@Get('/GetCfFeeRates')
|
||||||
GetCfFeeRates(@Query() body: GetFeeGeneralDTO) {
|
GetCfFeeRates(@Query() body: GetFeeGeneralDTO) {
|
||||||
return this.manageFeeService.GETCFFEERATES(body)
|
return this.manageFeeService.GETCFFEERATES(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
@ApiTags('Manage Fee - Oracle')
|
||||||
@Get('/GetCsFeeRates')
|
@Get('/GetCsFeeRates')
|
||||||
GetCsFeeRates(@Query() body: GetFeeGeneralDTO) {
|
GetCsFeeRates(@Query() body: GetFeeGeneralDTO) {
|
||||||
return this.manageFeeService.GETCSFEERATES(body)
|
return this.manageFeeService.GETCSFEERATES(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
@ApiTags('Manage Fee - Oracle')
|
||||||
@Get('/GetEfFeeRates')
|
@Get('/GetEfFeeRates')
|
||||||
GetEfFeeRates(@Query() body: GetFeeGeneralDTO) {
|
GetEfFeeRates(@Query() body: GetFeeGeneralDTO) {
|
||||||
return this.manageFeeService.GETEFFEERATES(body)
|
return this.manageFeeService.GETEFFEERATES(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
@ApiTags('Manage Fee - Oracle')
|
||||||
@Get('/GetFeeComm')
|
@Get('/GetFeeComm')
|
||||||
GetFeeComm(@Query() body: GetFeeGeneralDTO) {
|
GetFeeComm(@Query() body: GetFeeGeneralDTO) {
|
||||||
return this.manageFeeService.GETFEECOMM(body)
|
return this.manageFeeService.GETFEECOMM(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
@ApiTags('Manage Fee - Oracle')
|
||||||
@Post('/CreateBasicFee')
|
@Post('/CreateBasicFee')
|
||||||
CreateBasicFee(@Body() body: CreateBasicFeeDTO) {
|
CreateBasicFee(@Body() body: CreateBasicFeeDTO) {
|
||||||
return this.manageFeeService.CREATEBASICFEE(body)
|
return this.manageFeeService.CREATEBASICFEE(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
@ApiTags('Manage Fee - Oracle')
|
||||||
@Post('/CreateBondRate')
|
@Post('/CreateBondRate')
|
||||||
CreateBondRate(@Body() body: CreateBondRateDTO) {
|
CreateBondRate(@Body() body: CreateBondRateDTO) {
|
||||||
return this.manageFeeService.CREATEBONDRATE(body)
|
return this.manageFeeService.CREATEBONDRATE(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
@ApiTags('Manage Fee - Oracle')
|
||||||
@Post('/CreateCargoRate')
|
@Post('/CreateCargoRate')
|
||||||
CreateCargoRate(@Body() body: CreateCargoRateDTO) {
|
CreateCargoRate(@Body() body: CreateCargoRateDTO) {
|
||||||
return this.manageFeeService.CREATECARGORATE(body)
|
return this.manageFeeService.CREATECARGORATE(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
@ApiTags('Manage Fee - Oracle')
|
||||||
@Post('/CreateCfFee')
|
@Post('/CreateCfFee')
|
||||||
CreateCfFee(@Body() body: CreateCfFeeDTO) {
|
CreateCfFee(@Body() body: CreateCfFeeDTO) {
|
||||||
return this.manageFeeService.CREATECFFEE(body)
|
return this.manageFeeService.CREATECFFEE(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
@ApiTags('Manage Fee - Oracle')
|
||||||
@Post('/CreateCsFee')
|
@Post('/CreateCsFee')
|
||||||
CreateCsFee(@Body() body: CreateCsFeeDTO) {
|
CreateCsFee(@Body() body: CreateCsFeeDTO) {
|
||||||
return this.manageFeeService.CREATECSFEE(body)
|
return this.manageFeeService.CREATECSFEE(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
@ApiTags('Manage Fee - Oracle')
|
||||||
@Post('/CreateEfFee')
|
@Post('/CreateEfFee')
|
||||||
CreateEeFee(@Body() body: CreateEfFeeDTO) {
|
CreateEeFee(@Body() body: CreateEfFeeDTO) {
|
||||||
return this.manageFeeService.CREATEEFFEE(body)
|
return this.manageFeeService.CREATEEFFEE(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
@ApiTags('Manage Fee - Oracle')
|
||||||
@Post('/CreateFeeComm')
|
@Post('/CreateFeeComm')
|
||||||
CreateFeeComm(@Body() body: CreateFeeCommDTO) {
|
CreateFeeComm(@Body() body: CreateFeeCommDTO) {
|
||||||
return this.manageFeeService.CREATEFEECOMM(body)
|
return this.manageFeeService.CREATEFEECOMM(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
@ApiTags('Manage Fee - Oracle')
|
||||||
@Patch('/UpdateBasicFee')
|
@Patch('/UpdateBasicFee')
|
||||||
UpdateBasicFee(@Body() body: UpdateBasicFeeDTO) {
|
UpdateBasicFee(@Body() body: UpdateBasicFeeDTO) {
|
||||||
return this.manageFeeService.UPDATEBASICFEE(body)
|
return this.manageFeeService.UPDATEBASICFEE(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
@ApiTags('Manage Fee - Oracle')
|
||||||
@Patch('/UpdateBondRate')
|
@Patch('/UpdateBondRate')
|
||||||
UpdateBondRate(@Body() body: UpdateBondRateDTO) {
|
UpdateBondRate(@Body() body: UpdateBondRateDTO) {
|
||||||
return this.manageFeeService.UPDATEBONDRATE(body)
|
return this.manageFeeService.UPDATEBONDRATE(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
@ApiTags('Manage Fee - Oracle')
|
||||||
@Patch('/UpdateCargoRate')
|
@Patch('/UpdateCargoRate')
|
||||||
UpdateCargoRate(@Body() body: UpdateCargoRateDTO) {
|
UpdateCargoRate(@Body() body: UpdateCargoRateDTO) {
|
||||||
return this.manageFeeService.UPDATECARGORATE(body)
|
return this.manageFeeService.UPDATECARGORATE(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
@ApiTags('Manage Fee - Oracle')
|
||||||
@Patch('/UpdateCfFee')
|
@Patch('/UpdateCfFee')
|
||||||
UpdateCfFee(@Body() body: UpdateCfFeeDTO) {
|
UpdateCfFee(@Body() body: UpdateCfFeeDTO) {
|
||||||
return this.manageFeeService.UPDATECFFEE(body)
|
return this.manageFeeService.UPDATECFFEE(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
@ApiTags('Manage Fee - Oracle')
|
||||||
@Patch('/UpdateCsFee')
|
@Patch('/UpdateCsFee')
|
||||||
UpdateCsFee(@Body() body: UpdateCsFeeDTO) {
|
UpdateCsFee(@Body() body: UpdateCsFeeDTO) {
|
||||||
return this.manageFeeService.UPDATECSFEE(body)
|
return this.manageFeeService.UPDATECSFEE(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
@ApiTags('Manage Fee - Oracle')
|
||||||
@Patch('/UpdateEfFee')
|
@Patch('/UpdateEfFee')
|
||||||
UpdateEfFee(@Body() body: UpdateEfFeeDTO) {
|
UpdateEfFee(@Body() body: UpdateEfFeeDTO) {
|
||||||
return this.manageFeeService.UPDATEEFFEE(body)
|
return this.manageFeeService.UPDATEEFFEE(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
@ApiTags('Manage Fee - Oracle')
|
||||||
@Patch('/UpdateFeeComm')
|
@Patch('/UpdateFeeComm')
|
||||||
UpdateFeeComm(@Body() body: UpdateFeeCommBodyDTO) {
|
UpdateFeeComm(@Body() body: UpdateFeeCommBodyDTO) {
|
||||||
return this.manageFeeService.UPDATEFEECOMM(body)
|
return this.manageFeeService.UPDATEFEECOMM(body);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,19 +1,19 @@
|
|||||||
import { ApiProperty } from "@nestjs/swagger";
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
import { Transform } from "class-transformer";
|
import { Transform } from 'class-transformer';
|
||||||
import { IsDefined, IsInt, IsNumber, IsString, Min } from "class-validator";
|
import { IsDefined, IsInt, IsNumber, IsString, Min } from 'class-validator';
|
||||||
|
|
||||||
export class GetFeeGeneralDTO {
|
export class GetFeeGeneralDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Transform(({ value }) => Number(value))
|
@Transform(({ value }) => Number(value))
|
||||||
@Min(0, { message: "Property P_SPID must be at least 0" })
|
@Min(0, { message: 'Property P_SPID must be at least 0' })
|
||||||
@IsInt({ message: "Property P_SPID must be a whole number" })
|
@IsInt({ message: 'Property P_SPID must be a whole number' })
|
||||||
@IsNumber({}, { message: "Property P_SPID must be a number" })
|
@IsNumber({}, { message: 'Property P_SPID must be a number' })
|
||||||
@IsDefined({ message: "Property P_SPID is required" })
|
@IsDefined({ message: 'Property P_SPID is required' })
|
||||||
P_SPID: number;
|
P_SPID: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property P_ACTIVE_INACTIVE must be a string" })
|
@IsString({ message: 'Property P_ACTIVE_INACTIVE must be a string' })
|
||||||
@IsDefined({ message: "Property P_ACTIVE_INACTIVE is required" })
|
@IsDefined({ message: 'Property P_ACTIVE_INACTIVE is required' })
|
||||||
P_ACTIVE_INACTIVE: string;
|
P_ACTIVE_INACTIVE: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -336,7 +336,6 @@ export class UpdateEfFeeDTO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class UpdateFeeCommDTO {
|
export class UpdateFeeCommDTO {
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_FEECOMMID: number;
|
P_FEECOMMID: number;
|
||||||
|
|||||||
@ -4,6 +4,6 @@ import { ManageFeeService } from './manage-fee.service';
|
|||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
controllers: [ManageFeeController],
|
controllers: [ManageFeeController],
|
||||||
providers: [ManageFeeService]
|
providers: [ManageFeeService],
|
||||||
})
|
})
|
||||||
export class ManageFeeModule {}
|
export class ManageFeeModule {}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -1,12 +1,26 @@
|
|||||||
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 { ApiTags } from '@nestjs/swagger';
|
||||||
import { CreateHoldersDTO, GetHolderContactActivateOrInactivateDTO, GetHolderOrContactDTO, UpdateHolderContactDTO, UpdateHolderDTO } from './manage-holders.dto';
|
import {
|
||||||
|
CreateHoldersDTO,
|
||||||
|
GetHolderContactActivateOrInactivateDTO,
|
||||||
|
GetHolderOrContactDTO,
|
||||||
|
UpdateHolderContactDTO,
|
||||||
|
UpdateHolderDTO,
|
||||||
|
} from './manage-holders.dto';
|
||||||
import { ManageHoldersService } from './manage-holders.service';
|
import { ManageHoldersService } from './manage-holders.service';
|
||||||
|
|
||||||
@Controller('oracle')
|
@Controller('oracle')
|
||||||
export class ManageHoldersController {
|
export class ManageHoldersController {
|
||||||
|
constructor(private readonly manageHoldersService: ManageHoldersService) {}
|
||||||
constructor(private readonly manageHoldersService: ManageHoldersService) { }
|
|
||||||
|
|
||||||
@ApiTags('Manage Holders - Oracle')
|
@ApiTags('Manage Holders - Oracle')
|
||||||
@Post('/CreateHolderData')
|
@Post('/CreateHolderData')
|
||||||
@ -32,8 +46,8 @@ export class ManageHoldersController {
|
|||||||
GetHolderMaster(
|
GetHolderMaster(
|
||||||
@Param('p_spid', ParseIntPipe) p_spid: number,
|
@Param('p_spid', ParseIntPipe) p_spid: number,
|
||||||
@Param('p_holderid', ParseIntPipe) p_holderid: number,
|
@Param('p_holderid', ParseIntPipe) p_holderid: number,
|
||||||
){
|
) {
|
||||||
const reqParams:GetHolderOrContactDTO = {p_spid,p_holderid}
|
const reqParams: GetHolderOrContactDTO = { p_spid, p_holderid };
|
||||||
|
|
||||||
return this.manageHoldersService.GetHolderRecord(reqParams);
|
return this.manageHoldersService.GetHolderRecord(reqParams);
|
||||||
}
|
}
|
||||||
@ -43,8 +57,8 @@ export class ManageHoldersController {
|
|||||||
GetHolderContacts(
|
GetHolderContacts(
|
||||||
@Param('p_spid', ParseIntPipe) p_spid: number,
|
@Param('p_spid', ParseIntPipe) p_spid: number,
|
||||||
@Param('p_holderid', ParseIntPipe) p_holderid: number,
|
@Param('p_holderid', ParseIntPipe) p_holderid: number,
|
||||||
){
|
) {
|
||||||
const reqParams:GetHolderOrContactDTO = {p_spid,p_holderid}
|
const reqParams: GetHolderOrContactDTO = { p_spid, p_holderid };
|
||||||
|
|
||||||
return this.manageHoldersService.GetHolderContacts(reqParams);
|
return this.manageHoldersService.GetHolderContacts(reqParams);
|
||||||
}
|
}
|
||||||
@ -54,8 +68,8 @@ export class ManageHoldersController {
|
|||||||
InactivateHolder(
|
InactivateHolder(
|
||||||
@Param('p_spid', ParseIntPipe) p_spid: number,
|
@Param('p_spid', ParseIntPipe) p_spid: number,
|
||||||
@Param('p_holderid', ParseIntPipe) p_holderid: number,
|
@Param('p_holderid', ParseIntPipe) p_holderid: number,
|
||||||
){
|
) {
|
||||||
const reqParams:GetHolderOrContactDTO = {p_spid,p_holderid}
|
const reqParams: GetHolderOrContactDTO = { p_spid, p_holderid };
|
||||||
|
|
||||||
return this.manageHoldersService.InactivateHolder(reqParams);
|
return this.manageHoldersService.InactivateHolder(reqParams);
|
||||||
}
|
}
|
||||||
@ -65,8 +79,8 @@ export class ManageHoldersController {
|
|||||||
ReactivateHolder(
|
ReactivateHolder(
|
||||||
@Param('p_spid', ParseIntPipe) p_spid: number,
|
@Param('p_spid', ParseIntPipe) p_spid: number,
|
||||||
@Param('p_holderid', ParseIntPipe) p_holderid: number,
|
@Param('p_holderid', ParseIntPipe) p_holderid: number,
|
||||||
){
|
) {
|
||||||
const reqParams:GetHolderOrContactDTO = {p_spid,p_holderid}
|
const reqParams: GetHolderOrContactDTO = { p_spid, p_holderid };
|
||||||
|
|
||||||
return this.manageHoldersService.ReactivateHolder(reqParams);
|
return this.manageHoldersService.ReactivateHolder(reqParams);
|
||||||
}
|
}
|
||||||
@ -76,8 +90,11 @@ export class ManageHoldersController {
|
|||||||
InactivateHolderContact(
|
InactivateHolderContact(
|
||||||
@Param('p_spid', ParseIntPipe) p_spid: number,
|
@Param('p_spid', ParseIntPipe) p_spid: number,
|
||||||
@Param('p_holderContactid', ParseIntPipe) p_holderContactid: number,
|
@Param('p_holderContactid', ParseIntPipe) p_holderContactid: number,
|
||||||
){
|
) {
|
||||||
const reqParams:GetHolderContactActivateOrInactivateDTO = {p_spid,p_holderContactid}
|
const reqParams: GetHolderContactActivateOrInactivateDTO = {
|
||||||
|
p_spid,
|
||||||
|
p_holderContactid,
|
||||||
|
};
|
||||||
|
|
||||||
return this.manageHoldersService.InactivateHolderContact(reqParams);
|
return this.manageHoldersService.InactivateHolderContact(reqParams);
|
||||||
}
|
}
|
||||||
@ -87,8 +104,11 @@ export class ManageHoldersController {
|
|||||||
ReactivateHolderContact(
|
ReactivateHolderContact(
|
||||||
@Param('p_spid', ParseIntPipe) p_spid: number,
|
@Param('p_spid', ParseIntPipe) p_spid: number,
|
||||||
@Param('p_holderid', ParseIntPipe) p_holderContactid: number,
|
@Param('p_holderid', ParseIntPipe) p_holderContactid: number,
|
||||||
){
|
) {
|
||||||
const reqParams:GetHolderContactActivateOrInactivateDTO = {p_spid,p_holderContactid}
|
const reqParams: GetHolderContactActivateOrInactivateDTO = {
|
||||||
|
p_spid,
|
||||||
|
p_holderContactid,
|
||||||
|
};
|
||||||
|
|
||||||
return this.manageHoldersService.ReactivateHolderContact(reqParams);
|
return this.manageHoldersService.ReactivateHolderContact(reqParams);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,381 +1,487 @@
|
|||||||
import { ApiProperty } from '@nestjs/swagger';
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
import { Type } from 'class-transformer';
|
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 {
|
export class p_contactstableDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 50, { message: "Property FirstName must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property FirstName must be a string" })
|
message: 'Property FirstName must be between 0 to 50 characters',
|
||||||
@IsDefined({ message: "Property FirstName is required" })
|
})
|
||||||
|
@IsString({ message: 'Property FirstName must be a string' })
|
||||||
|
@IsDefined({ message: 'Property FirstName is required' })
|
||||||
FirstName: string;
|
FirstName: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 50, { message: "Property LastName must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property LastName must be a string" })
|
message: 'Property LastName must be between 0 to 50 characters',
|
||||||
@IsDefined({ message: "Property LastName is required" })
|
})
|
||||||
|
@IsString({ message: 'Property LastName must be a string' })
|
||||||
|
@IsDefined({ message: 'Property LastName is required' })
|
||||||
LastName: string;
|
LastName: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 3, { message: "Property MiddleInitial must be between 0 to 3 characters" })
|
@Length(0, 3, {
|
||||||
@IsString({ message: "Property MiddleInitial must be a string" })
|
message: 'Property MiddleInitial must be between 0 to 3 characters',
|
||||||
|
})
|
||||||
|
@IsString({ message: 'Property MiddleInitial must be a string' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
MiddleInitial?: string;
|
MiddleInitial?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 50, { message: "Property Title must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property Title must be a string" })
|
message: 'Property Title must be between 0 to 50 characters',
|
||||||
|
})
|
||||||
|
@IsString({ message: 'Property Title must be a string' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
Title?: string;
|
Title?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 100, { message: "Property EmailAddress must be between 0 to 100 characters" })
|
@Length(0, 100, {
|
||||||
@IsString({ message: "Property EmailAddress must be a string" })
|
message: 'Property EmailAddress must be between 0 to 100 characters',
|
||||||
@IsDefined({ message: "Property EmailAddress is required" })
|
})
|
||||||
|
@IsString({ message: 'Property EmailAddress must be a string' })
|
||||||
|
@IsDefined({ message: 'Property EmailAddress is required' })
|
||||||
EmailAddress: string;
|
EmailAddress: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 20, { message: "Property PhoneNo must be between 0 to 20 characters" })
|
@Length(0, 20, {
|
||||||
@IsString({ message: "Property PhoneNo must be a string" })
|
message: 'Property PhoneNo must be between 0 to 20 characters',
|
||||||
@IsDefined({ message: "Property PhoneNo is required" })
|
})
|
||||||
|
@IsString({ message: 'Property PhoneNo must be a string' })
|
||||||
|
@IsDefined({ message: 'Property PhoneNo is required' })
|
||||||
PhoneNo: string;
|
PhoneNo: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 20, { message: "Property MobileNo must be between 0 to 20 characters" })
|
@Length(0, 20, {
|
||||||
@IsString({ message: "Property MobileNo must be a string" })
|
message: 'Property MobileNo must be between 0 to 20 characters',
|
||||||
@IsDefined({ message: "Property MobileNo is required" })
|
})
|
||||||
|
@IsString({ message: 'Property MobileNo must be a string' })
|
||||||
|
@IsDefined({ message: 'Property MobileNo is required' })
|
||||||
MobileNo: string;
|
MobileNo: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 20, { message: "Property FaxNo must be between 0 to 20 characters" })
|
@Length(0, 20, {
|
||||||
@IsString({ message: "Property FaxNo must be a string" })
|
message: 'Property FaxNo must be between 0 to 20 characters',
|
||||||
|
})
|
||||||
|
@IsString({ message: 'Property FaxNo must be a string' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
FaxNo?: string;
|
FaxNo?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CreateHoldersDTO {
|
export class CreateHoldersDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||||
@IsInt({ message: "Property p_spid allows only whole numbers" })
|
@IsInt({ message: 'Property p_spid allows only whole numbers' })
|
||||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||||
@IsDefined({ message: "Property p_spid is required" })
|
@IsDefined({ message: 'Property p_spid is required' })
|
||||||
p_spid: number;
|
p_spid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_clientlocationid must not exceed 999999999" })
|
@Max(999999999, {
|
||||||
@Min(0, { message: "Property p_clientlocationid must be at least 0 or more" })
|
message: 'Property p_clientlocationid must not exceed 999999999',
|
||||||
@IsInt({ message: "Property p_clientlocationid allows only whole numbers" })
|
})
|
||||||
@IsNumber({}, { message: "Property p_clientlocationid must be a number" })
|
@Min(0, { message: 'Property p_clientlocationid must be at least 0 or more' })
|
||||||
@IsDefined({ message: "Property p_clientlocationid is required" })
|
@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;
|
p_clientlocationid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 15, { message: "Property p_holderno must be between 0 to 15 characters" })
|
@Length(0, 15, {
|
||||||
@IsString({ message: "Property p_holderno must be a string" })
|
message: 'Property p_holderno must be between 0 to 15 characters',
|
||||||
@IsDefined({ message: "Property p_holderno is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_holderno must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_holderno is required' })
|
||||||
p_holderno: string;
|
p_holderno: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 3, { message: "Property p_holdertype must be between 0 to 3 characters" })
|
@Length(0, 3, {
|
||||||
@IsString({ message: "Property p_holdertype must be a string" })
|
message: 'Property p_holdertype must be between 0 to 3 characters',
|
||||||
@IsDefined({ message: "Property p_holdertype is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_holdertype must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_holdertype is required' })
|
||||||
p_holdertype: string;
|
p_holdertype: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 1, { message: "Property p_uscibmemberflag must be between 0 to 1 character" })
|
@Length(0, 1, {
|
||||||
@IsString({ message: "Property p_uscibmemberflag must be a string" })
|
message: 'Property p_uscibmemberflag must be between 0 to 1 character',
|
||||||
@IsDefined({ message: "Property p_uscibmemberflag is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_uscibmemberflag must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_uscibmemberflag is required' })
|
||||||
p_uscibmemberflag: string;
|
p_uscibmemberflag: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 1, { message: "Property p_govagencyflag must be between 0 to 1 character" })
|
@Length(0, 1, {
|
||||||
@IsString({ message: "Property p_govagencyflag must be a string" })
|
message: 'Property p_govagencyflag must be between 0 to 1 character',
|
||||||
@IsDefined({ message: "Property p_govagencyflag is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_govagencyflag must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_govagencyflag is required' })
|
||||||
p_govagencyflag: string;
|
p_govagencyflag: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 50, { message: "Property p_holdername must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property p_holdername must be a string" })
|
message: 'Property p_holdername must be between 0 to 50 characters',
|
||||||
@IsDefined({ message: "Property p_holdername is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_holdername must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_holdername is required' })
|
||||||
p_holdername: string;
|
p_holdername: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 10, { message: "Property p_namequalifier must be between 0 to 10 characters" })
|
@Length(0, 10, {
|
||||||
@IsString({ message: "Property p_namequalifier must be a string" })
|
message: 'Property p_namequalifier must be between 0 to 10 characters',
|
||||||
|
})
|
||||||
|
@IsString({ message: 'Property p_namequalifier must be a string' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_namequalifier?: string;
|
p_namequalifier?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 50, { message: "Property p_addlname must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property p_addlname must be a string" })
|
message: 'Property p_addlname must be between 0 to 50 characters',
|
||||||
|
})
|
||||||
|
@IsString({ message: 'Property p_addlname must be a string' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_addlname?: string;
|
p_addlname?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 50, { message: "Property p_address1 must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property p_address1 must be a string" })
|
message: 'Property p_address1 must be between 0 to 50 characters',
|
||||||
@IsDefined({ message: "Property p_address1 is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_address1 must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_address1 is required' })
|
||||||
p_address1: string;
|
p_address1: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 50, { message: "Property p_address2 must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property p_address2 must be a string" })
|
message: 'Property p_address2 must be between 0 to 50 characters',
|
||||||
|
})
|
||||||
|
@IsString({ message: 'Property p_address2 must be a string' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_address2?: string;
|
p_address2?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 30, { message: "Property p_city must be between 0 to 30 characters" })
|
@Length(0, 30, {
|
||||||
@IsString({ message: "Property p_city must be a string" })
|
message: 'Property p_city must be between 0 to 30 characters',
|
||||||
@IsDefined({ message: "Property p_city is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_city must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_city is required' })
|
||||||
p_city: string;
|
p_city: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 2, { message: "Property p_state must be between 0 to 2 characters" })
|
@Length(0, 2, {
|
||||||
@IsString({ message: "Property p_state must be a string" })
|
message: 'Property p_state must be between 0 to 2 characters',
|
||||||
@IsDefined({ message: "Property p_state is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_state must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_state is required' })
|
||||||
p_state: string;
|
p_state: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 10, { message: "Property p_zip must be between 0 to 10 characters" })
|
@Length(0, 10, {
|
||||||
@IsString({ message: "Property p_zip must be a string" })
|
message: 'Property p_zip must be between 0 to 10 characters',
|
||||||
@IsDefined({ message: "Property p_zip is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_zip must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_zip is required' })
|
||||||
p_zip: string;
|
p_zip: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 50, { message: "Property p_country must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property p_country must be a string" })
|
message: 'Property p_country must be between 0 to 50 characters',
|
||||||
@IsDefined({ message: "Property p_country is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_country must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_country is required' })
|
||||||
p_country: string;
|
p_country: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 50, { message: "Property p_userid must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property p_userid must be a string" })
|
message: 'Property p_userid must be between 0 to 50 characters',
|
||||||
@IsDefined({ message: "Property p_userid is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_userid must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_userid is required' })
|
||||||
p_userid: string;
|
p_userid: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false, type: () => [p_contactstableDTO] })
|
@ApiProperty({ required: false, type: () => [p_contactstableDTO] })
|
||||||
@Type(() => p_contactstableDTO)
|
@Type(() => p_contactstableDTO)
|
||||||
@ValidateNested({ each: true })
|
@ValidateNested({ each: true })
|
||||||
@IsArray({ message: "Property p_contactstable allows only array type" })
|
@IsArray({ message: 'Property p_contactstable allows only array type' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_contactstable?: p_contactstableDTO[];
|
p_contactstable?: p_contactstableDTO[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export class UpdateHolderDTO {
|
export class UpdateHolderDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_holderid must not exceed 999999999" })
|
@Max(999999999, { message: 'Property p_holderid must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property p_holderid must be at least 0 or more" })
|
@Min(0, { message: 'Property p_holderid must be at least 0 or more' })
|
||||||
@IsInt({ message: "Property p_holderid allows only whole numbers" })
|
@IsInt({ message: 'Property p_holderid allows only whole numbers' })
|
||||||
@IsNumber({}, { message: "Property p_holderid must be a number" })
|
@IsNumber({}, { message: 'Property p_holderid must be a number' })
|
||||||
@IsDefined({ message: "Property p_holderid is required" })
|
@IsDefined({ message: 'Property p_holderid is required' })
|
||||||
p_holderid: number;
|
p_holderid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||||
@IsInt({ message: "Property p_spid allows only whole numbers" })
|
@IsInt({ message: 'Property p_spid allows only whole numbers' })
|
||||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||||
@IsDefined({ message: "Property p_spid is required" })
|
@IsDefined({ message: 'Property p_spid is required' })
|
||||||
p_spid: number;
|
p_spid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_locationid must not exceed 999999999" })
|
@Max(999999999, {
|
||||||
@Min(0, { message: "Property p_locationid must be at least 0 or more" })
|
message: 'Property p_locationid must not exceed 999999999',
|
||||||
@IsInt({ message: "Property p_locationid allows only whole numbers" })
|
})
|
||||||
@IsNumber({}, { message: "Property p_locationid must be a number" })
|
@Min(0, { message: 'Property p_locationid must be at least 0 or more' })
|
||||||
@IsDefined({ message: "Property p_locationid is required" })
|
@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;
|
p_locationid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 15, { message: "Property p_holderno must be between 0 to 15 characters" })
|
@Length(0, 15, {
|
||||||
@IsString({ message: "Property p_holderno must be a string" })
|
message: 'Property p_holderno must be between 0 to 15 characters',
|
||||||
@IsDefined({ message: "Property p_holderno is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_holderno must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_holderno is required' })
|
||||||
p_holderno: string;
|
p_holderno: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 3, { message: "Property p_holdertype must be between 0 to 3 characters" })
|
@Length(0, 3, {
|
||||||
@IsString({ message: "Property p_holdertype must be a string" })
|
message: 'Property p_holdertype must be between 0 to 3 characters',
|
||||||
@IsDefined({ message: "Property p_holdertype is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_holdertype must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_holdertype is required' })
|
||||||
p_holdertype: string;
|
p_holdertype: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 1, { message: "Property p_uscibmemberflag must be between 0 to 1 character" })
|
@Length(0, 1, {
|
||||||
@IsString({ message: "Property p_uscibmemberflag must be a string" })
|
message: 'Property p_uscibmemberflag must be between 0 to 1 character',
|
||||||
@IsDefined({ message: "Property p_uscibmemberflag is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_uscibmemberflag must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_uscibmemberflag is required' })
|
||||||
p_uscibmemberflag: string;
|
p_uscibmemberflag: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 1, { message: "Property p_govagencyflag must be between 0 to 1 character" })
|
@Length(0, 1, {
|
||||||
@IsString({ message: "Property p_govagencyflag must be a string" })
|
message: 'Property p_govagencyflag must be between 0 to 1 character',
|
||||||
@IsDefined({ message: "Property p_govagencyflag is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_govagencyflag must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_govagencyflag is required' })
|
||||||
p_govagencyflag: string;
|
p_govagencyflag: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 50, { message: "Property p_holdername must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property p_holdername must be a string" })
|
message: 'Property p_holdername must be between 0 to 50 characters',
|
||||||
@IsDefined({ message: "Property p_holdername is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_holdername must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_holdername is required' })
|
||||||
p_holdername: string;
|
p_holdername: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 10, { message: "Property p_namequalifier must be between 0 to 10 characters" })
|
@Length(0, 10, {
|
||||||
@IsString({ message: "Property p_namequalifier must be a string" })
|
message: 'Property p_namequalifier must be between 0 to 10 characters',
|
||||||
|
})
|
||||||
|
@IsString({ message: 'Property p_namequalifier must be a string' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_namequalifier?: string;
|
p_namequalifier?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 50, { message: "Property p_addlname must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property p_addlname must be a string" })
|
message: 'Property p_addlname must be between 0 to 50 characters',
|
||||||
|
})
|
||||||
|
@IsString({ message: 'Property p_addlname must be a string' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_addlname?: string;
|
p_addlname?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 50, { message: "Property p_address1 must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property p_address1 must be a string" })
|
message: 'Property p_address1 must be between 0 to 50 characters',
|
||||||
@IsDefined({ message: "Property p_address1 is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_address1 must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_address1 is required' })
|
||||||
p_address1: string;
|
p_address1: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 50, { message: "Property p_address2 must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property p_address2 must be a string" })
|
message: 'Property p_address2 must be between 0 to 50 characters',
|
||||||
|
})
|
||||||
|
@IsString({ message: 'Property p_address2 must be a string' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_address2?: string;
|
p_address2?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 30, { message: "Property p_city must be between 0 to 30 characters" })
|
@Length(0, 30, {
|
||||||
@IsString({ message: "Property p_city must be a string" })
|
message: 'Property p_city must be between 0 to 30 characters',
|
||||||
@IsDefined({ message: "Property p_city is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_city must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_city is required' })
|
||||||
p_city: string;
|
p_city: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 2, { message: "Property p_state must be between 0 to 2 characters" })
|
@Length(0, 2, {
|
||||||
@IsString({ message: "Property p_state must be a string" })
|
message: 'Property p_state must be between 0 to 2 characters',
|
||||||
@IsDefined({ message: "Property p_state is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_state must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_state is required' })
|
||||||
p_state: string;
|
p_state: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 10, { message: "Property p_zip must be between 0 to 10 characters" })
|
@Length(0, 10, {
|
||||||
@IsString({ message: "Property p_zip must be a string" })
|
message: 'Property p_zip must be between 0 to 10 characters',
|
||||||
@IsDefined({ message: "Property p_zip is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_zip must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_zip is required' })
|
||||||
p_zip: string;
|
p_zip: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 2, { message: "Property p_country must be between 0 to 2 characters" })
|
@Length(0, 2, {
|
||||||
@IsString({ message: "Property p_country must be a string" })
|
message: 'Property p_country must be between 0 to 2 characters',
|
||||||
@IsDefined({ message: "Property p_country is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_country must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_country is required' })
|
||||||
p_country: string;
|
p_country: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 100, { message: "Property p_userid must be between 0 to 100 characters" })
|
@Length(0, 100, {
|
||||||
@IsString({ message: "Property p_userid must be a string" })
|
message: 'Property p_userid must be between 0 to 100 characters',
|
||||||
@IsDefined({ message: "Property p_userid is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_userid must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_userid is required' })
|
||||||
p_userid: string;
|
p_userid: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class UpdateHolderContactDTO {
|
export class UpdateHolderContactDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_holdercontactid must not exceed 999999999" })
|
@Max(999999999, {
|
||||||
@Min(0, { message: "Property p_holdercontactid must be at least 0 or more" })
|
message: 'Property p_holdercontactid must not exceed 999999999',
|
||||||
@IsInt({ message: "Property p_holdercontactid allows only whole numbers" })
|
})
|
||||||
@IsNumber({}, { message: "Property p_holdercontactid must be a number" })
|
@Min(0, { message: 'Property p_holdercontactid must be at least 0 or more' })
|
||||||
@IsDefined({ message: "Property p_holdercontactid is required" })
|
@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;
|
p_holdercontactid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||||
@IsInt({ message: "Property p_spid allows only whole numbers" })
|
@IsInt({ message: 'Property p_spid allows only whole numbers' })
|
||||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||||
@IsDefined({ message: "Property p_spid is required" })
|
@IsDefined({ message: 'Property p_spid is required' })
|
||||||
p_spid: number;
|
p_spid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 50, { message: "Property p_firstname must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property p_firstname must be a string" })
|
message: 'Property p_firstname must be between 0 to 50 characters',
|
||||||
@IsDefined({ message: "Property p_firstname is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_firstname must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_firstname is required' })
|
||||||
p_firstname: string;
|
p_firstname: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 50, { message: "Property p_lastname must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property p_lastname must be a string" })
|
message: 'Property p_lastname must be between 0 to 50 characters',
|
||||||
@IsDefined({ message: "Property p_lastname is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_lastname must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_lastname is required' })
|
||||||
p_lastname: string;
|
p_lastname: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 3, { message: "Property p_middleinitial must be between 0 to 3 characters" })
|
@Length(0, 3, {
|
||||||
@IsString({ message: "Property p_middleinitial must be a string" })
|
message: 'Property p_middleinitial must be between 0 to 3 characters',
|
||||||
|
})
|
||||||
|
@IsString({ message: 'Property p_middleinitial must be a string' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_middleinitial?: string;
|
p_middleinitial?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 50, { message: "Property p_title must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property p_title must be a string" })
|
message: 'Property p_title must be between 0 to 50 characters',
|
||||||
|
})
|
||||||
|
@IsString({ message: 'Property p_title must be a string' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_title?: string;
|
p_title?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 20, { message: "Property p_phone must be between 0 to 20 characters" })
|
@Length(0, 20, {
|
||||||
@IsString({ message: "Property p_phone must be a string" })
|
message: 'Property p_phone must be between 0 to 20 characters',
|
||||||
@IsDefined({ message: "Property p_phone is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_phone must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_phone is required' })
|
||||||
p_phone: string;
|
p_phone: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 20, { message: "Property p_mobile must be between 0 to 20 characters" })
|
@Length(0, 20, {
|
||||||
@IsString({ message: "Property p_mobile must be a string" })
|
message: 'Property p_mobile must be between 0 to 20 characters',
|
||||||
@IsDefined({ message: "Property p_mobile is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_mobile must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_mobile is required' })
|
||||||
p_mobile: string;
|
p_mobile: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 20, { message: "Property p_fax must be between 0 to 20 characters" })
|
@Length(0, 20, {
|
||||||
@IsString({ message: "Property p_fax must be a string" })
|
message: 'Property p_fax must be between 0 to 20 characters',
|
||||||
|
})
|
||||||
|
@IsString({ message: 'Property p_fax must be a string' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_fax?: string;
|
p_fax?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 100, { message: "Property p_emailaddress must be between 0 to 100 characters" })
|
@Length(0, 100, {
|
||||||
@IsString({ message: "Property p_emailaddress must be a string" })
|
message: 'Property p_emailaddress must be between 0 to 100 characters',
|
||||||
@IsDefined({ message: "Property p_emailaddress is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_emailaddress must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_emailaddress is required' })
|
||||||
p_emailaddress: string;
|
p_emailaddress: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 100, { message: "Property p_userid must be between 0 to 100 characters" })
|
@Length(0, 100, {
|
||||||
@IsString({ message: "Property p_userid must be a string" })
|
message: 'Property p_userid must be between 0 to 100 characters',
|
||||||
@IsDefined({ message: "Property p_userid is required" })
|
})
|
||||||
|
@IsString({ message: 'Property p_userid must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_userid is required' })
|
||||||
p_userid: string;
|
p_userid: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetHolderOrContactDTO {
|
export class GetHolderOrContactDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||||
@IsInt({ message: "Property p_spid allows only whole numbers" })
|
@IsInt({ message: 'Property p_spid allows only whole numbers' })
|
||||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||||
@IsDefined({ message: "Property p_spid is required" })
|
@IsDefined({ message: 'Property p_spid is required' })
|
||||||
p_spid: number;
|
p_spid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_holderid must not exceed 999999999" })
|
@Max(999999999, { message: 'Property p_holderid must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property p_holderid must be at least 0 or more" })
|
@Min(0, { message: 'Property p_holderid must be at least 0 or more' })
|
||||||
@IsInt({ message: "Property p_holderid allows only whole numbers" })
|
@IsInt({ message: 'Property p_holderid allows only whole numbers' })
|
||||||
@IsNumber({}, { message: "Property p_holderid must be a number" })
|
@IsNumber({}, { message: 'Property p_holderid must be a number' })
|
||||||
@IsDefined({ message: "Property p_holderid is required" })
|
@IsDefined({ message: 'Property p_holderid is required' })
|
||||||
p_holderid: number;
|
p_holderid: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetHolderContactActivateOrInactivateDTO {
|
export class GetHolderContactActivateOrInactivateDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||||
@IsInt({ message: "Property p_spid allows only whole numbers" })
|
@IsInt({ message: 'Property p_spid allows only whole numbers' })
|
||||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||||
@IsDefined({ message: "Property p_spid is required" })
|
@IsDefined({ message: 'Property p_spid is required' })
|
||||||
p_spid: number;
|
p_spid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_holderid must not exceed 999999999" })
|
@Max(999999999, { message: 'Property p_holderid must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property p_holderid must be at least 0 or more" })
|
@Min(0, { message: 'Property p_holderid must be at least 0 or more' })
|
||||||
@IsInt({ message: "Property p_holderid allows only whole numbers" })
|
@IsInt({ message: 'Property p_holderid allows only whole numbers' })
|
||||||
@IsNumber({}, { message: "Property p_holderid must be a number" })
|
@IsNumber({}, { message: 'Property p_holderid must be a number' })
|
||||||
@IsDefined({ message: "Property p_holderid is required" })
|
@IsDefined({ message: 'Property p_holderid is required' })
|
||||||
p_holderContactid: number;
|
p_holderContactid: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,8 +4,8 @@ import { ManageHoldersController } from './manage-holders.controller';
|
|||||||
import { DbModule } from 'src/db/db.module';
|
import { DbModule } from 'src/db/db.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports:[DbModule],
|
imports: [DbModule],
|
||||||
providers: [ManageHoldersService],
|
providers: [ManageHoldersService],
|
||||||
controllers: [ManageHoldersController]
|
controllers: [ManageHoldersController],
|
||||||
})
|
})
|
||||||
export class ManageHoldersModule {}
|
export class ManageHoldersModule {}
|
||||||
|
|||||||
@ -1,42 +1,47 @@
|
|||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { OracleDBService } from 'src/db/db.service';
|
import { OracleDBService } from 'src/db/db.service';
|
||||||
import { CreateHoldersDTO, GetHolderContactActivateOrInactivateDTO, GetHolderOrContactDTO, p_contactstableDTO, UpdateHolderContactDTO, UpdateHolderDTO } from './manage-holders.dto';
|
import {
|
||||||
import * as oracledb from 'oracledb'
|
CreateHoldersDTO,
|
||||||
|
GetHolderContactActivateOrInactivateDTO,
|
||||||
|
GetHolderOrContactDTO,
|
||||||
|
p_contactstableDTO,
|
||||||
|
UpdateHolderContactDTO,
|
||||||
|
UpdateHolderDTO,
|
||||||
|
} from './manage-holders.dto';
|
||||||
|
import * as oracledb from 'oracledb';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ManageHoldersService {
|
export class ManageHoldersService {
|
||||||
|
constructor(private readonly oracleDBService: OracleDBService) {}
|
||||||
constructor(private readonly oracleDBService: OracleDBService) { }
|
|
||||||
|
|
||||||
CreateHolders = async (body: CreateHoldersDTO) => {
|
CreateHolders = async (body: CreateHoldersDTO) => {
|
||||||
|
const newBody = {
|
||||||
|
p_spid: null,
|
||||||
|
p_clientlocationid: null,
|
||||||
|
p_holderno: null,
|
||||||
|
p_holdertype: null,
|
||||||
|
p_uscibmemberflag: null,
|
||||||
|
p_govagencyflag: null,
|
||||||
|
p_holdername: null,
|
||||||
|
p_namequalifier: null,
|
||||||
|
p_addlname: null,
|
||||||
|
p_address1: null,
|
||||||
|
p_address2: null,
|
||||||
|
p_city: null,
|
||||||
|
p_state: null,
|
||||||
|
p_zip: null,
|
||||||
|
p_country: null,
|
||||||
|
p_userid: null,
|
||||||
|
p_contactstable: null,
|
||||||
|
};
|
||||||
|
|
||||||
let newBody = {
|
const reqBody = JSON.parse(JSON.stringify(body));
|
||||||
"p_spid": null,
|
|
||||||
"p_clientlocationid": null,
|
|
||||||
"p_holderno": null,
|
|
||||||
"p_holdertype": null,
|
|
||||||
"p_uscibmemberflag": null,
|
|
||||||
"p_govagencyflag": null,
|
|
||||||
"p_holdername": null,
|
|
||||||
"p_namequalifier": null,
|
|
||||||
"p_addlname": null,
|
|
||||||
"p_address1": null,
|
|
||||||
"p_address2": null,
|
|
||||||
"p_city": null,
|
|
||||||
"p_state": null,
|
|
||||||
"p_zip": null,
|
|
||||||
"p_country": null,
|
|
||||||
"p_userid": null,
|
|
||||||
"p_contactstable": null
|
|
||||||
}
|
|
||||||
|
|
||||||
let reqBody = JSON.parse(JSON.stringify(body));
|
|
||||||
|
|
||||||
function setEmptyStringsToNull(obj) {
|
function setEmptyStringsToNull(obj) {
|
||||||
Object.keys(obj).forEach(key => {
|
Object.keys(obj).forEach((key) => {
|
||||||
if (typeof obj[key] === 'object' && obj[key] !== null) {
|
if (typeof obj[key] === 'object' && obj[key] !== null) {
|
||||||
setEmptyStringsToNull(obj[key]);
|
setEmptyStringsToNull(obj[key]);
|
||||||
} else if (obj[key] === "") {
|
} else if (obj[key] === '') {
|
||||||
obj[key] = null;
|
obj[key] = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -50,10 +55,9 @@ export class ManageHoldersService {
|
|||||||
let p_holdercursor_rows = [];
|
let p_holdercursor_rows = [];
|
||||||
let p_holdercontactcursor_rows = [];
|
let p_holdercontactcursor_rows = [];
|
||||||
try {
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
connection = await this.oracleDBService.getConnection()
|
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected');
|
||||||
}
|
}
|
||||||
|
|
||||||
// let res = await connection.execute(`SELECT owner, type_name FROM all_types WHERE type_name LIKE '%CONTACT%'`);
|
// let res = await connection.execute(`SELECT owner, type_name FROM all_types WHERE type_name LIKE '%CONTACT%'`);
|
||||||
@ -61,14 +65,26 @@ export class ManageHoldersService {
|
|||||||
// return { res:res.rows };
|
// return { res:res.rows };
|
||||||
|
|
||||||
// const CONTACTSARRAY = await connection.getDbObjectClass('CARNETSYS.CONTACTSARRAY');
|
// const CONTACTSARRAY = await connection.getDbObjectClass('CARNETSYS.CONTACTSARRAY');
|
||||||
const CONTACTSTABLE = await connection.getDbObjectClass('CARNETSYS.CONTACTSTABLE');
|
const CONTACTSTABLE = await connection.getDbObjectClass(
|
||||||
|
'CARNETSYS.CONTACTSTABLE',
|
||||||
|
);
|
||||||
|
|
||||||
// Check if GLTABLE is a constructor
|
// Check if GLTABLE is a constructor
|
||||||
if (typeof CONTACTSTABLE !== 'function') {
|
if (typeof CONTACTSTABLE !== 'function') {
|
||||||
throw new Error('CONTACTSTABLE is not a constructor');
|
throw new Error('CONTACTSTABLE is not a constructor');
|
||||||
}
|
}
|
||||||
|
|
||||||
async function CREATECONTACTSTABLE_INSTANCE(connection, FirstName, LastName, MiddleInitial, Title, EmailAddress, PhoneNo, MobileNo, FaxNo) {
|
async function CREATECONTACTSTABLE_INSTANCE(
|
||||||
|
connection,
|
||||||
|
FirstName,
|
||||||
|
LastName,
|
||||||
|
MiddleInitial,
|
||||||
|
Title,
|
||||||
|
EmailAddress,
|
||||||
|
PhoneNo,
|
||||||
|
MobileNo,
|
||||||
|
FaxNo,
|
||||||
|
) {
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
`SELECT CARNETSYS.CONTACTSARRAY(:FirstName, :LastName, :MiddleInitial, :Title, :EmailAddress, :PhoneNo, :MobileNo, :FaxNo) FROM dual`,
|
`SELECT CARNETSYS.CONTACTSARRAY(:FirstName, :LastName, :MiddleInitial, :Title, :EmailAddress, :PhoneNo, :MobileNo, :FaxNo) FROM dual`,
|
||||||
{
|
{
|
||||||
@ -79,15 +95,29 @@ export class ManageHoldersService {
|
|||||||
EmailAddress,
|
EmailAddress,
|
||||||
PhoneNo,
|
PhoneNo,
|
||||||
MobileNo,
|
MobileNo,
|
||||||
FaxNo
|
FaxNo,
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
return result.rows[0][0];
|
return result.rows[0][0];
|
||||||
}
|
}
|
||||||
|
|
||||||
const CONTACTSARRAY = finalBody.p_contactstable ? await Promise.all(finalBody.p_contactstable.map(async (x: p_contactstableDTO) => {
|
const CONTACTSARRAY = finalBody.p_contactstable
|
||||||
return await CREATECONTACTSTABLE_INSTANCE(connection, x.FirstName, x.LastName, x.MiddleInitial, x.Title, x.EmailAddress, x.PhoneNo, x.MobileNo, x.FaxNo);
|
? await Promise.all(
|
||||||
})) : [];
|
finalBody.p_contactstable.map(async (x: p_contactstableDTO) => {
|
||||||
|
return await CREATECONTACTSTABLE_INSTANCE(
|
||||||
|
connection,
|
||||||
|
x.FirstName,
|
||||||
|
x.LastName,
|
||||||
|
x.MiddleInitial,
|
||||||
|
x.Title,
|
||||||
|
x.EmailAddress,
|
||||||
|
x.PhoneNo,
|
||||||
|
x.MobileNo,
|
||||||
|
x.FaxNo,
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
: [];
|
||||||
|
|
||||||
// Create an instance of GLTABLE
|
// Create an instance of GLTABLE
|
||||||
const CONTACTSTABLE_INSTANCE = new CONTACTSTABLE(CONTACTSARRAY);
|
const CONTACTSTABLE_INSTANCE = new CONTACTSTABLE(CONTACTSARRAY);
|
||||||
@ -119,84 +149,89 @@ export class ManageHoldersService {
|
|||||||
{
|
{
|
||||||
p_spid: {
|
p_spid: {
|
||||||
val: finalBody.p_spid ? finalBody.p_spid : null,
|
val: finalBody.p_spid ? finalBody.p_spid : null,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
p_clientlocationid: {
|
p_clientlocationid: {
|
||||||
val: finalBody.p_clientlocationid ? finalBody.p_clientlocationid : null,
|
val: finalBody.p_clientlocationid
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
? finalBody.p_clientlocationid
|
||||||
|
: null,
|
||||||
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
|
|
||||||
p_holderno: {
|
p_holderno: {
|
||||||
val: finalBody.p_holderno ? finalBody.p_holderno : null,
|
val: finalBody.p_holderno ? finalBody.p_holderno : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_holdertype: {
|
p_holdertype: {
|
||||||
val: finalBody.p_holdertype ? finalBody.p_holdertype : null,
|
val: finalBody.p_holdertype ? finalBody.p_holdertype : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_uscibmemberflag: {
|
p_uscibmemberflag: {
|
||||||
val: finalBody.p_uscibmemberflag ? finalBody.p_uscibmemberflag : null,
|
val: finalBody.p_uscibmemberflag
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
? finalBody.p_uscibmemberflag
|
||||||
|
: null,
|
||||||
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_govagencyflag: {
|
p_govagencyflag: {
|
||||||
val: finalBody.p_govagencyflag ? finalBody.p_govagencyflag : null,
|
val: finalBody.p_govagencyflag ? finalBody.p_govagencyflag : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_holdername: {
|
p_holdername: {
|
||||||
val: finalBody.p_holdername ? finalBody.p_holdername : null,
|
val: finalBody.p_holdername ? finalBody.p_holdername : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_namequalifier: {
|
p_namequalifier: {
|
||||||
val: finalBody.p_namequalifier ? finalBody.p_namequalifier : null,
|
val: finalBody.p_namequalifier ? finalBody.p_namequalifier : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_addlname: {
|
p_addlname: {
|
||||||
val: finalBody.p_addlname ? finalBody.p_addlname : null,
|
val: finalBody.p_addlname ? finalBody.p_addlname : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_address1: {
|
p_address1: {
|
||||||
val: finalBody.p_address1 ? finalBody.p_address1 : null,
|
val: finalBody.p_address1 ? finalBody.p_address1 : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_address2: {
|
p_address2: {
|
||||||
val: finalBody.p_address2 ? finalBody.p_address2 : null,
|
val: finalBody.p_address2 ? finalBody.p_address2 : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_city: {
|
p_city: {
|
||||||
val: finalBody.p_city ? finalBody.p_city : null,
|
val: finalBody.p_city ? finalBody.p_city : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_state: {
|
p_state: {
|
||||||
val: finalBody.p_state ? finalBody.p_state : null,
|
val: finalBody.p_state ? finalBody.p_state : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_zip: {
|
p_zip: {
|
||||||
val: finalBody.p_zip ? finalBody.p_zip : null,
|
val: finalBody.p_zip ? finalBody.p_zip : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_country: {
|
p_country: {
|
||||||
val: finalBody.p_country ? finalBody.p_country : null,
|
val: finalBody.p_country ? finalBody.p_country : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_userid: {
|
p_userid: {
|
||||||
val: finalBody.p_userid ? finalBody.p_userid : null,
|
val: finalBody.p_userid ? finalBody.p_userid : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_contactstable: {
|
p_contactstable: {
|
||||||
val: CONTACTSTABLE_INSTANCE,
|
val: CONTACTSTABLE_INSTANCE,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_holdercursor: {
|
p_holdercursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
},
|
},
|
||||||
p_holdercontactcursor: {
|
p_holdercontactcursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
}, {
|
},
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
{
|
||||||
}
|
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
await connection.commit();
|
await connection.commit();
|
||||||
@ -212,7 +247,6 @@ export class ManageHoldersService {
|
|||||||
p_holdercursor_rows = p_holdercursor_rows.concat(rowsBatch);
|
p_holdercursor_rows = p_holdercursor_rows.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
await cursor.close();
|
await cursor.close();
|
||||||
} else {
|
} else {
|
||||||
throw new Error('No cursor returned from the stored procedure');
|
throw new Error('No cursor returned from the stored procedure');
|
||||||
@ -224,53 +258,57 @@ export class ManageHoldersService {
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
rowsBatch = await cursor.getRows(100);
|
rowsBatch = await cursor.getRows(100);
|
||||||
p_holdercontactcursor_rows = p_holdercontactcursor_rows.concat(rowsBatch);
|
p_holdercontactcursor_rows =
|
||||||
|
p_holdercontactcursor_rows.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
await cursor.close();
|
await cursor.close();
|
||||||
} else {
|
} else {
|
||||||
throw new Error('No cursor returned from the stored procedure');
|
throw new Error('No cursor returned from the stored procedure');
|
||||||
}
|
}
|
||||||
|
|
||||||
return { p_holdercursor: p_holdercursor_rows, p_holdercontactcursor: p_holdercontactcursor_rows };
|
return {
|
||||||
|
p_holdercursor: p_holdercursor_rows,
|
||||||
|
p_holdercontactcursor: p_holdercontactcursor_rows,
|
||||||
|
};
|
||||||
|
|
||||||
// return fres
|
// return fres
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
return { error: err.message }
|
return { error: err.message };
|
||||||
} finally { }
|
} else {
|
||||||
|
return { error: 'An unknown error occurred' };
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
UpdateHolder = async (body: UpdateHolderDTO) => {
|
UpdateHolder = async (body: UpdateHolderDTO) => {
|
||||||
let newBody = {
|
const newBody = {
|
||||||
"p_holderid": null,
|
p_holderid: null,
|
||||||
"p_spid": null,
|
p_spid: null,
|
||||||
"p_locationid": null,
|
p_locationid: null,
|
||||||
"p_holderno": null,
|
p_holderno: null,
|
||||||
"p_holdertype": null,
|
p_holdertype: null,
|
||||||
"p_uscibmemberflag": null,
|
p_uscibmemberflag: null,
|
||||||
"p_govagencyflag": null,
|
p_govagencyflag: null,
|
||||||
"p_holdername": null,
|
p_holdername: null,
|
||||||
"p_namequalifier": null,
|
p_namequalifier: null,
|
||||||
"p_addlname": null,
|
p_addlname: null,
|
||||||
"p_address1": null,
|
p_address1: null,
|
||||||
"p_address2": null,
|
p_address2: null,
|
||||||
"p_city": null,
|
p_city: null,
|
||||||
"p_state": null,
|
p_state: null,
|
||||||
"p_zip": null,
|
p_zip: null,
|
||||||
"p_country": null,
|
p_country: null,
|
||||||
"p_userid": null
|
p_userid: null,
|
||||||
}
|
};
|
||||||
|
|
||||||
let reqBody = JSON.parse(JSON.stringify(body));
|
const reqBody = JSON.parse(JSON.stringify(body));
|
||||||
|
|
||||||
function setEmptyStringsToNull(obj) {
|
function setEmptyStringsToNull(obj) {
|
||||||
Object.keys(obj).forEach(key => {
|
Object.keys(obj).forEach((key) => {
|
||||||
if (typeof obj[key] === 'object' && obj[key] !== null) {
|
if (typeof obj[key] === 'object' && obj[key] !== null) {
|
||||||
setEmptyStringsToNull(obj[key]);
|
setEmptyStringsToNull(obj[key]);
|
||||||
} else if (obj[key] === "") {
|
} else if (obj[key] === '') {
|
||||||
obj[key] = null;
|
obj[key] = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -283,10 +321,9 @@ export class ManageHoldersService {
|
|||||||
let connection;
|
let connection;
|
||||||
let P_cursor_rows = [];
|
let P_cursor_rows = [];
|
||||||
try {
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
connection = await this.oracleDBService.getConnection()
|
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected');
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
@ -315,79 +352,82 @@ export class ManageHoldersService {
|
|||||||
{
|
{
|
||||||
p_holderid: {
|
p_holderid: {
|
||||||
val: finalBody.p_holderid ? finalBody.p_holderid : null,
|
val: finalBody.p_holderid ? finalBody.p_holderid : null,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
p_spid: {
|
p_spid: {
|
||||||
val: finalBody.p_spid ? finalBody.p_spid : null,
|
val: finalBody.p_spid ? finalBody.p_spid : null,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
p_locationid: {
|
p_locationid: {
|
||||||
val: finalBody.p_locationid ? finalBody.p_locationid : null,
|
val: finalBody.p_locationid ? finalBody.p_locationid : null,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
p_holderno: {
|
p_holderno: {
|
||||||
val: finalBody.p_holderno ? finalBody.p_holderno : null,
|
val: finalBody.p_holderno ? finalBody.p_holderno : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_holdertype: {
|
p_holdertype: {
|
||||||
val: finalBody.p_holdertype ? finalBody.p_holdertype : null,
|
val: finalBody.p_holdertype ? finalBody.p_holdertype : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_uscibmemberflag: {
|
p_uscibmemberflag: {
|
||||||
val: finalBody.p_uscibmemberflag ? finalBody.p_uscibmemberflag : null,
|
val: finalBody.p_uscibmemberflag
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
? finalBody.p_uscibmemberflag
|
||||||
|
: null,
|
||||||
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_govagencyflag: {
|
p_govagencyflag: {
|
||||||
val: finalBody.p_govagencyflag ? finalBody.p_govagencyflag : null,
|
val: finalBody.p_govagencyflag ? finalBody.p_govagencyflag : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_holdername: {
|
p_holdername: {
|
||||||
val: finalBody.p_holdername ? finalBody.p_holdername : null,
|
val: finalBody.p_holdername ? finalBody.p_holdername : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_namequalifier: {
|
p_namequalifier: {
|
||||||
val: finalBody.p_namequalifier ? finalBody.p_namequalifier : null,
|
val: finalBody.p_namequalifier ? finalBody.p_namequalifier : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_addlname: {
|
p_addlname: {
|
||||||
val: finalBody.p_addlname ? finalBody.p_addlname : null,
|
val: finalBody.p_addlname ? finalBody.p_addlname : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_address1: {
|
p_address1: {
|
||||||
val: finalBody.p_address1 ? finalBody.p_address1 : null,
|
val: finalBody.p_address1 ? finalBody.p_address1 : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_address2: {
|
p_address2: {
|
||||||
val: finalBody.p_address2 ? finalBody.p_address2 : null,
|
val: finalBody.p_address2 ? finalBody.p_address2 : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_city: {
|
p_city: {
|
||||||
val: finalBody.p_city ? finalBody.p_city : null,
|
val: finalBody.p_city ? finalBody.p_city : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_state: {
|
p_state: {
|
||||||
val: finalBody.p_state ? finalBody.p_state : null,
|
val: finalBody.p_state ? finalBody.p_state : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_zip: {
|
p_zip: {
|
||||||
val: finalBody.p_zip ? finalBody.p_zip : null,
|
val: finalBody.p_zip ? finalBody.p_zip : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_country: {
|
p_country: {
|
||||||
val: finalBody.p_country ? finalBody.p_country : null,
|
val: finalBody.p_country ? finalBody.p_country : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_userid: {
|
p_userid: {
|
||||||
val: finalBody.p_userid ? finalBody.p_userid : null,
|
val: finalBody.p_userid ? finalBody.p_userid : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
P_cursor: {
|
P_cursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
}, {
|
},
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
{
|
||||||
}
|
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||||
|
},
|
||||||
);
|
);
|
||||||
await connection.commit();
|
await connection.commit();
|
||||||
|
|
||||||
@ -402,7 +442,6 @@ export class ManageHoldersService {
|
|||||||
P_cursor_rows = P_cursor_rows.concat(rowsBatch);
|
P_cursor_rows = P_cursor_rows.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
await cursor.close();
|
await cursor.close();
|
||||||
} else {
|
} else {
|
||||||
throw new Error('No cursor returned from the stored procedure');
|
throw new Error('No cursor returned from the stored procedure');
|
||||||
@ -411,22 +450,22 @@ export class ManageHoldersService {
|
|||||||
return { P_cursor: P_cursor_rows };
|
return { P_cursor: P_cursor_rows };
|
||||||
|
|
||||||
// return fres
|
// return fres
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
return { error: err.message }
|
return { error: err.message };
|
||||||
} finally { }
|
} else {
|
||||||
|
return { error: 'An unknown error occurred' };
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
GetHolderRecord = async (body: GetHolderOrContactDTO) => {
|
GetHolderRecord = async (body: GetHolderOrContactDTO) => {
|
||||||
|
|
||||||
let connection;
|
let connection;
|
||||||
let p_cursor_rows = [];
|
let p_cursor_rows = [];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
connection = await this.oracleDBService.getConnection()
|
connection = await this.oracleDBService.getConnection();
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected');
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
@ -448,12 +487,12 @@ export class ManageHoldersService {
|
|||||||
},
|
},
|
||||||
p_cursor: {
|
p_cursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result.outBinds && result.outBinds.p_cursor) {
|
if (result.outBinds && result.outBinds.p_cursor) {
|
||||||
@ -465,40 +504,40 @@ export class ManageHoldersService {
|
|||||||
p_cursor_rows = p_cursor_rows.concat(rowsBatch);
|
p_cursor_rows = p_cursor_rows.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
await cursor.close();
|
await cursor.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
return { p_cursor: p_cursor_rows };
|
return { p_cursor: p_cursor_rows };
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
return { error: err.message }
|
return { error: err.message };
|
||||||
} finally { }
|
} else {
|
||||||
|
return { error: 'An unknown error occurred' };
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
UpdateHolderContact = async (body: UpdateHolderContactDTO) => {
|
UpdateHolderContact = async (body: UpdateHolderContactDTO) => {
|
||||||
|
const newBody = {
|
||||||
|
p_holdercontactid: null,
|
||||||
|
p_spid: null,
|
||||||
|
p_firstname: null,
|
||||||
|
p_lastname: null,
|
||||||
|
p_middleinitial: null,
|
||||||
|
p_title: null,
|
||||||
|
p_phone: null,
|
||||||
|
p_mobile: null,
|
||||||
|
p_fax: null,
|
||||||
|
p_emailaddress: null,
|
||||||
|
p_userid: null,
|
||||||
|
};
|
||||||
|
|
||||||
let newBody = {
|
const reqBody = JSON.parse(JSON.stringify(body));
|
||||||
"p_holdercontactid": null,
|
|
||||||
"p_spid": null,
|
|
||||||
"p_firstname": null,
|
|
||||||
"p_lastname": null,
|
|
||||||
"p_middleinitial": null,
|
|
||||||
"p_title": null,
|
|
||||||
"p_phone": null,
|
|
||||||
"p_mobile": null,
|
|
||||||
"p_fax": null,
|
|
||||||
"p_emailaddress": null,
|
|
||||||
"p_userid": null
|
|
||||||
}
|
|
||||||
|
|
||||||
let reqBody = JSON.parse(JSON.stringify(body));
|
|
||||||
|
|
||||||
function setEmptyStringsToNull(obj) {
|
function setEmptyStringsToNull(obj) {
|
||||||
Object.keys(obj).forEach(key => {
|
Object.keys(obj).forEach((key) => {
|
||||||
if (typeof obj[key] === 'object' && obj[key] !== null) {
|
if (typeof obj[key] === 'object' && obj[key] !== null) {
|
||||||
setEmptyStringsToNull(obj[key]);
|
setEmptyStringsToNull(obj[key]);
|
||||||
} else if (obj[key] === "") {
|
} else if (obj[key] === '') {
|
||||||
obj[key] = null;
|
obj[key] = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -511,10 +550,9 @@ export class ManageHoldersService {
|
|||||||
let connection;
|
let connection;
|
||||||
let P_cursor_rows = [];
|
let P_cursor_rows = [];
|
||||||
try {
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
connection = await this.oracleDBService.getConnection()
|
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected');
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
@ -536,56 +574,59 @@ export class ManageHoldersService {
|
|||||||
END;`,
|
END;`,
|
||||||
{
|
{
|
||||||
p_holdercontactid: {
|
p_holdercontactid: {
|
||||||
val: finalBody.p_holdercontactid ? finalBody.p_holdercontactid : null,
|
val: finalBody.p_holdercontactid
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
? finalBody.p_holdercontactid
|
||||||
|
: null,
|
||||||
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
p_spid: {
|
p_spid: {
|
||||||
val: finalBody.p_spid ? finalBody.p_spid : null,
|
val: finalBody.p_spid ? finalBody.p_spid : null,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
p_firstname: {
|
p_firstname: {
|
||||||
val: finalBody.p_firstname ? finalBody.p_firstname : null,
|
val: finalBody.p_firstname ? finalBody.p_firstname : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_lastname: {
|
p_lastname: {
|
||||||
val: finalBody.p_lastname ? finalBody.p_lastname : null,
|
val: finalBody.p_lastname ? finalBody.p_lastname : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_middleinitial: {
|
p_middleinitial: {
|
||||||
val: finalBody.p_middleinitial ? finalBody.p_middleinitial : null,
|
val: finalBody.p_middleinitial ? finalBody.p_middleinitial : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_title: {
|
p_title: {
|
||||||
val: finalBody.p_title ? finalBody.p_title : null,
|
val: finalBody.p_title ? finalBody.p_title : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_phone: {
|
p_phone: {
|
||||||
val: finalBody.p_phone ? finalBody.p_phone : null,
|
val: finalBody.p_phone ? finalBody.p_phone : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_mobile: {
|
p_mobile: {
|
||||||
val: finalBody.p_mobile ? finalBody.p_mobile : null,
|
val: finalBody.p_mobile ? finalBody.p_mobile : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_fax: {
|
p_fax: {
|
||||||
val: finalBody.p_fax ? finalBody.p_fax : null,
|
val: finalBody.p_fax ? finalBody.p_fax : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_emailaddress: {
|
p_emailaddress: {
|
||||||
val: finalBody.p_emailaddress ? finalBody.p_emailaddress : null,
|
val: finalBody.p_emailaddress ? finalBody.p_emailaddress : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_userid: {
|
p_userid: {
|
||||||
val: finalBody.p_userid ? finalBody.p_userid : null,
|
val: finalBody.p_userid ? finalBody.p_userid : null,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
P_cursor: {
|
P_cursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
}, {
|
},
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
{
|
||||||
}
|
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||||
|
},
|
||||||
);
|
);
|
||||||
await connection.commit();
|
await connection.commit();
|
||||||
|
|
||||||
@ -600,7 +641,6 @@ export class ManageHoldersService {
|
|||||||
P_cursor_rows = P_cursor_rows.concat(rowsBatch);
|
P_cursor_rows = P_cursor_rows.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
await cursor.close();
|
await cursor.close();
|
||||||
} else {
|
} else {
|
||||||
throw new Error('No cursor returned from the stored procedure');
|
throw new Error('No cursor returned from the stored procedure');
|
||||||
@ -609,20 +649,22 @@ export class ManageHoldersService {
|
|||||||
return { P_cursor: P_cursor_rows };
|
return { P_cursor: P_cursor_rows };
|
||||||
|
|
||||||
// return fres
|
// return fres
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
return { error: err.message }
|
return { error: err.message };
|
||||||
} finally { }
|
} else {
|
||||||
|
return { error: 'An unknown error occurred' };
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
GetHolderContacts = async (body: GetHolderOrContactDTO) => {
|
GetHolderContacts = async (body: GetHolderOrContactDTO) => {
|
||||||
let connection;
|
let connection;
|
||||||
let p_cursor_rows = [];
|
let p_cursor_rows = [];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
connection = await this.oracleDBService.getConnection()
|
connection = await this.oracleDBService.getConnection();
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected');
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
@ -644,12 +686,12 @@ export class ManageHoldersService {
|
|||||||
},
|
},
|
||||||
p_cursor: {
|
p_cursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result.outBinds && result.outBinds.p_cursor) {
|
if (result.outBinds && result.outBinds.p_cursor) {
|
||||||
@ -661,25 +703,26 @@ export class ManageHoldersService {
|
|||||||
p_cursor_rows = p_cursor_rows.concat(rowsBatch);
|
p_cursor_rows = p_cursor_rows.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
await cursor.close();
|
await cursor.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
return { p_cursor: p_cursor_rows };
|
return { p_cursor: p_cursor_rows };
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
return { error: err.message }
|
return { error: err.message };
|
||||||
} finally { }
|
} else {
|
||||||
|
return { error: 'An unknown error occurred' };
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
InactivateHolder = async (body: GetHolderOrContactDTO) => {
|
InactivateHolder = async (body: GetHolderOrContactDTO) => {
|
||||||
let connection;
|
let connection;
|
||||||
let p_cursor_rows = [];
|
let p_cursor_rows = [];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
connection = await this.oracleDBService.getConnection()
|
connection = await this.oracleDBService.getConnection();
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected');
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
@ -701,12 +744,12 @@ export class ManageHoldersService {
|
|||||||
},
|
},
|
||||||
p_cursor: {
|
p_cursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result.outBinds && result.outBinds.p_cursor) {
|
if (result.outBinds && result.outBinds.p_cursor) {
|
||||||
@ -718,25 +761,26 @@ export class ManageHoldersService {
|
|||||||
p_cursor_rows = p_cursor_rows.concat(rowsBatch);
|
p_cursor_rows = p_cursor_rows.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
await cursor.close();
|
await cursor.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
return { p_cursor: p_cursor_rows };
|
return { p_cursor: p_cursor_rows };
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
return { error: err.message }
|
return { error: err.message };
|
||||||
} finally { }
|
} else {
|
||||||
|
return { error: 'An unknown error occurred' };
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
ReactivateHolder = async (body: GetHolderOrContactDTO) => {
|
ReactivateHolder = async (body: GetHolderOrContactDTO) => {
|
||||||
let connection;
|
let connection;
|
||||||
let p_cursor_rows = [];
|
let p_cursor_rows = [];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
connection = await this.oracleDBService.getConnection()
|
connection = await this.oracleDBService.getConnection();
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected');
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
@ -758,12 +802,12 @@ export class ManageHoldersService {
|
|||||||
},
|
},
|
||||||
p_cursor: {
|
p_cursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result.outBinds && result.outBinds.p_cursor) {
|
if (result.outBinds && result.outBinds.p_cursor) {
|
||||||
@ -775,25 +819,28 @@ export class ManageHoldersService {
|
|||||||
p_cursor_rows = p_cursor_rows.concat(rowsBatch);
|
p_cursor_rows = p_cursor_rows.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
await cursor.close();
|
await cursor.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
return { p_cursor: p_cursor_rows };
|
return { p_cursor: p_cursor_rows };
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
return { error: err.message }
|
return { error: err.message };
|
||||||
} finally { }
|
} else {
|
||||||
|
return { error: 'An unknown error occurred' };
|
||||||
}
|
}
|
||||||
InactivateHolderContact = async (body: GetHolderContactActivateOrInactivateDTO) => {
|
}
|
||||||
|
};
|
||||||
|
InactivateHolderContact = async (
|
||||||
|
body: GetHolderContactActivateOrInactivateDTO,
|
||||||
|
) => {
|
||||||
let connection;
|
let connection;
|
||||||
let p_cursor_rows = [];
|
let p_cursor_rows = [];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
connection = await this.oracleDBService.getConnection()
|
connection = await this.oracleDBService.getConnection();
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected');
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
@ -815,12 +862,12 @@ export class ManageHoldersService {
|
|||||||
},
|
},
|
||||||
p_cursor: {
|
p_cursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result.outBinds && result.outBinds.p_cursor) {
|
if (result.outBinds && result.outBinds.p_cursor) {
|
||||||
@ -832,25 +879,28 @@ export class ManageHoldersService {
|
|||||||
p_cursor_rows = p_cursor_rows.concat(rowsBatch);
|
p_cursor_rows = p_cursor_rows.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
await cursor.close();
|
await cursor.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
return { p_cursor: p_cursor_rows };
|
return { p_cursor: p_cursor_rows };
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
return { error: err.message }
|
return { error: err.message };
|
||||||
} finally { }
|
} else {
|
||||||
|
return { error: 'An unknown error occurred' };
|
||||||
}
|
}
|
||||||
ReactivateHolderContact = async (body: GetHolderContactActivateOrInactivateDTO) => {
|
}
|
||||||
|
};
|
||||||
|
ReactivateHolderContact = async (
|
||||||
|
body: GetHolderContactActivateOrInactivateDTO,
|
||||||
|
) => {
|
||||||
let connection;
|
let connection;
|
||||||
let p_cursor_rows = [];
|
let p_cursor_rows = [];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
connection = await this.oracleDBService.getConnection()
|
connection = await this.oracleDBService.getConnection();
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected');
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
@ -872,12 +922,12 @@ export class ManageHoldersService {
|
|||||||
},
|
},
|
||||||
p_cursor: {
|
p_cursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result.outBinds && result.outBinds.p_cursor) {
|
if (result.outBinds && result.outBinds.p_cursor) {
|
||||||
@ -889,15 +939,16 @@ export class ManageHoldersService {
|
|||||||
p_cursor_rows = p_cursor_rows.concat(rowsBatch);
|
p_cursor_rows = p_cursor_rows.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
await cursor.close();
|
await cursor.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
return { p_cursor: p_cursor_rows };
|
return { p_cursor: p_cursor_rows };
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
return { error: err.message }
|
return { error: err.message };
|
||||||
} finally { }
|
} else {
|
||||||
|
return { error: 'An unknown error occurred' };
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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[];
|
|
||||||
}
|
|
||||||
@ -8,9 +8,17 @@ import { ManageFeeModule } from './manage-fee/manage-fee.module';
|
|||||||
import { ManageClientsModule } from './manage-clients/manage-clients.module';
|
import { ManageClientsModule } from './manage-clients/manage-clients.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports:[DbModule, HomePageModule, UscibManagedSpModule, ParamTableModule, ManageFeeModule, ManageHoldersModule, ManageClientsModule],
|
imports: [
|
||||||
|
DbModule,
|
||||||
|
HomePageModule,
|
||||||
|
UscibManagedSpModule,
|
||||||
|
ParamTableModule,
|
||||||
|
ManageFeeModule,
|
||||||
|
ManageHoldersModule,
|
||||||
|
ManageClientsModule,
|
||||||
|
],
|
||||||
providers: [],
|
providers: [],
|
||||||
controllers: [],
|
controllers: [],
|
||||||
exports:[]
|
exports: [],
|
||||||
})
|
})
|
||||||
export class OracleModule {}
|
export class OracleModule {}
|
||||||
|
|||||||
@ -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 { ApiQuery, ApiTags } from '@nestjs/swagger';
|
||||||
import { ParamTableService } from './param-table.service';
|
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')
|
@Controller('param-table')
|
||||||
export class ParamTableController {
|
export class ParamTableController {
|
||||||
|
constructor(private readonly paramTableService: ParamTableService) {}
|
||||||
constructor(private readonly paramTableService: ParamTableService) { }
|
|
||||||
|
|
||||||
@ApiTags('Param Table - Oracle')
|
@ApiTags('Param Table - Oracle')
|
||||||
@Get('/GetParamValues')
|
@Get('/GetParamValues')
|
||||||
@ApiQuery({ name: 'P_SPID', required: false, type: Number, description: 'The ID of the parameter' })
|
@ApiQuery({
|
||||||
@ApiQuery({ name: 'P_PARAMTYPE', required: false, type: String, description: 'The type of the parameter' })
|
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) {
|
getParamValues(@Query() body: getParamValuesDTO) {
|
||||||
return this.paramTableService.GETPARAMVALUES(body)
|
return this.paramTableService.GETPARAMVALUES(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Param Table - Oracle')
|
@ApiTags('Param Table - Oracle')
|
||||||
@Post('/CreateTableRecord')
|
@Post('/CreateTableRecord')
|
||||||
createTableRecord(@Body() body: CreateTableRecordDTO) {
|
createTableRecord(@Body() body: CreateTableRecordDTO) {
|
||||||
return this.paramTableService.CREATETABLERECORD(body)
|
return this.paramTableService.CREATETABLERECORD(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Param Table - Oracle')
|
@ApiTags('Param Table - Oracle')
|
||||||
@Post('/CreateParamRecord')
|
@Post('/CreateParamRecord')
|
||||||
createParamRecord(@Body() body: CreateParamRecordDTO) {
|
createParamRecord(@Body() body: CreateParamRecordDTO) {
|
||||||
return this.paramTableService.CREATEPARAMRECORD(body)
|
return this.paramTableService.CREATEPARAMRECORD(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Param Table - Oracle')
|
@ApiTags('Param Table - Oracle')
|
||||||
@Patch('/UpdateParamRecord')
|
@Patch('/UpdateParamRecord')
|
||||||
UpdateParamRecord(@Body() body: UpdateParamRecordDTO) {
|
UpdateParamRecord(@Body() body: UpdateParamRecordDTO) {
|
||||||
return this.paramTableService.UPDATEPARAMRECORD(body)
|
return this.paramTableService.UPDATEPARAMRECORD(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Param Table - Oracle')
|
@ApiTags('Param Table - Oracle')
|
||||||
@Put('/InActivateParamRecord')
|
@Put('/InActivateParamRecord')
|
||||||
inActivateParamRecord(@Body() body: ActivateOrInactivateParamRecordDTO) {
|
inActivateParamRecord(@Body() body: ActivateOrInactivateParamRecordDTO) {
|
||||||
return this.paramTableService.INACTIVATEPARAMRECORD(body)
|
return this.paramTableService.INACTIVATEPARAMRECORD(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Param Table - Oracle')
|
@ApiTags('Param Table - Oracle')
|
||||||
@Put('/ReActivateParamRecord')
|
@Put('/ReActivateParamRecord')
|
||||||
reActivateParamRecord(@Body() body: ActivateOrInactivateParamRecordDTO) {
|
reActivateParamRecord(@Body() body: ActivateOrInactivateParamRecordDTO) {
|
||||||
return this.paramTableService.REACTIVATEPARAMRECORD(body)
|
return this.paramTableService.REACTIVATEPARAMRECORD(body);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,16 +1,23 @@
|
|||||||
import { ApiProperty } from "@nestjs/swagger";
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
import { Transform } from "class-transformer";
|
import { Transform } from 'class-transformer';
|
||||||
import { IsDefined, IsInt, IsNumber, IsOptional, IsString, Min, ValidateIf } from "class-validator";
|
import {
|
||||||
|
IsDefined,
|
||||||
|
IsInt,
|
||||||
|
IsNumber,
|
||||||
|
IsOptional,
|
||||||
|
IsString,
|
||||||
|
Min,
|
||||||
|
} from 'class-validator';
|
||||||
|
|
||||||
export class CreateTableRecordDTO {
|
export class CreateTableRecordDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property P_USERID must be a string" })
|
@IsString({ message: 'Property P_USERID must be a string' })
|
||||||
@IsDefined({ message: "Property P_USERID is required" })
|
@IsDefined({ message: 'Property P_USERID is required' })
|
||||||
P_USERID: string;
|
P_USERID: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property P_TABLEFULLDESC must be a string" })
|
@IsString({ message: 'Property P_TABLEFULLDESC must be a string' })
|
||||||
@IsDefined({ message: "Property P_TABLEFULLDESC is required" })
|
@IsDefined({ message: 'Property P_TABLEFULLDESC is required' })
|
||||||
P_TABLEFULLDESC: string;
|
P_TABLEFULLDESC: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,26 +122,26 @@ export class UpdateParamRecordDTO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class getParamValuesDTO {
|
export class getParamValuesDTO {
|
||||||
@IsInt({ message: "Property P_SPID must be a whole number" })
|
@IsInt({ message: 'Property P_SPID must be a whole number' })
|
||||||
@IsNumber({}, { message: "Property P_SPID must be a number" })
|
@IsNumber({}, { message: 'Property P_SPID must be a number' })
|
||||||
@Min(0, { message: "Property P_SPID must be at least 0" })
|
@Min(0, { message: 'Property P_SPID must be at least 0' })
|
||||||
@Transform(({ value }) => Number(value))
|
@Transform(({ value }) => Number(value))
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
P_SPID?: number;
|
P_SPID?: number;
|
||||||
|
|
||||||
@IsString({ message: "Property P_PARAMTYPE must be a string" })
|
@IsString({ message: 'Property P_PARAMTYPE must be a string' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
P_PARAMTYPE?: string;
|
P_PARAMTYPE?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ActivateOrInactivateParamRecordDTO {
|
export class ActivateOrInactivateParamRecordDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber({}, { message: "Property P_PARAMID must be a number" })
|
@IsNumber({}, { message: 'Property P_PARAMID must be a number' })
|
||||||
@IsDefined({ message: "Property P_PARAMID is required" })
|
@IsDefined({ message: 'Property P_PARAMID is required' })
|
||||||
P_PARAMID: number;
|
P_PARAMID: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property P_USERID must be a string" })
|
@IsString({ message: 'Property P_USERID must be a string' })
|
||||||
@IsDefined({ message: "Property P_USERID is required" })
|
@IsDefined({ message: 'Property P_USERID is required' })
|
||||||
P_USERID: string;
|
P_USERID: string;
|
||||||
}
|
}
|
||||||
@ -4,6 +4,6 @@ import { ParamTableService } from './param-table.service';
|
|||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
controllers: [ParamTableController],
|
controllers: [ParamTableController],
|
||||||
providers: [ParamTableService]
|
providers: [ParamTableService],
|
||||||
})
|
})
|
||||||
export class ParamTableModule {}
|
export class ParamTableModule {}
|
||||||
|
|||||||
@ -1,25 +1,30 @@
|
|||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { OracleDBService } from 'src/db/db.service';
|
import { OracleDBService } from 'src/db/db.service';
|
||||||
import * as oracledb from 'oracledb'
|
import * as oracledb from 'oracledb';
|
||||||
import { ActivateOrInactivateParamRecordDTO, CreateParamRecordDTO, CreateTableRecordDTO, getParamValuesDTO, UpdateParamRecordDTO } from './param-table.dto';
|
import {
|
||||||
|
ActivateOrInactivateParamRecordDTO,
|
||||||
|
CreateParamRecordDTO,
|
||||||
|
CreateTableRecordDTO,
|
||||||
|
getParamValuesDTO,
|
||||||
|
UpdateParamRecordDTO,
|
||||||
|
} from './param-table.dto';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ParamTableService {
|
export class ParamTableService {
|
||||||
constructor(private readonly oracleDBService: OracleDBService) { }
|
constructor(private readonly oracleDBService: OracleDBService) {}
|
||||||
|
|
||||||
async GETPARAMVALUES(body:getParamValuesDTO) {
|
async GETPARAMVALUES(body: getParamValuesDTO) {
|
||||||
|
const finalBody = {
|
||||||
let finalBody = {
|
|
||||||
P_SPID: body.P_SPID ? body.P_SPID : null,
|
P_SPID: body.P_SPID ? body.P_SPID : null,
|
||||||
P_PARAMTYPE: body.P_PARAMTYPE ? body.P_PARAMTYPE : null
|
P_PARAMTYPE: body.P_PARAMTYPE ? body.P_PARAMTYPE : null,
|
||||||
}
|
};
|
||||||
|
|
||||||
let connection;
|
let connection;
|
||||||
let rows = [];
|
let rows = [];
|
||||||
try {
|
try {
|
||||||
connection = await this.oracleDBService.getConnection()
|
connection = await this.oracleDBService.getConnection();
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected');
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
@ -29,20 +34,20 @@ export class ParamTableService {
|
|||||||
{
|
{
|
||||||
P_SPID: {
|
P_SPID: {
|
||||||
val: finalBody.P_SPID,
|
val: finalBody.P_SPID,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
P_PARAMTYPE: {
|
P_PARAMTYPE: {
|
||||||
val: finalBody.P_PARAMTYPE,
|
val: finalBody.P_PARAMTYPE,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_cursor: {
|
p_cursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result.outBinds && result.outBinds.p_cursor) {
|
if (result.outBinds && result.outBinds.p_cursor) {
|
||||||
@ -54,28 +59,27 @@ export class ParamTableService {
|
|||||||
rows = rows.concat(rowsBatch);
|
rows = rows.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
await cursor.close();
|
await cursor.close();
|
||||||
} else {
|
} else {
|
||||||
throw new Error('No cursor returned from the stored procedure');
|
throw new Error('No cursor returned from the stored procedure');
|
||||||
}
|
}
|
||||||
|
|
||||||
return rows;
|
return rows;
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
return { error: err.message }
|
return { error: err.message };
|
||||||
} finally { }
|
} else {
|
||||||
|
return { error: 'An unknown error occurred' };
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async CREATETABLERECORD(body: CreateTableRecordDTO) {
|
async CREATETABLERECORD(body: CreateTableRecordDTO) {
|
||||||
let connection;
|
let connection;
|
||||||
try {
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
connection = await this.oracleDBService.getConnection()
|
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected');
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
@ -85,40 +89,42 @@ export class ParamTableService {
|
|||||||
{
|
{
|
||||||
P_TABLEFULLDESC: {
|
P_TABLEFULLDESC: {
|
||||||
val: body.P_TABLEFULLDESC,
|
val: body.P_TABLEFULLDESC,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
P_USERID: {
|
P_USERID: {
|
||||||
val: body.P_USERID,
|
val: body.P_USERID,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
|
|
||||||
p_cursor: {
|
p_cursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
}, {
|
},
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
{
|
||||||
}
|
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
|
|
||||||
|
|
||||||
|
return fres;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
return { error: err.message }
|
return { error: err.message };
|
||||||
} finally { }
|
} else {
|
||||||
|
return { error: 'An unknown error occurred' };
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async CREATEPARAMRECORD(body: CreateParamRecordDTO) {
|
async CREATEPARAMRECORD(body: CreateParamRecordDTO) {
|
||||||
let connection;
|
let connection;
|
||||||
try {
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
connection = await this.oracleDBService.getConnection()
|
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected');
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
@ -140,77 +146,78 @@ export class ParamTableService {
|
|||||||
{
|
{
|
||||||
P_SPID: {
|
P_SPID: {
|
||||||
val: body.P_SPID,
|
val: body.P_SPID,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
P_PARAMTYPE: {
|
P_PARAMTYPE: {
|
||||||
val: body.P_PARAMTYPE,
|
val: body.P_PARAMTYPE,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
P_PARAMDESC: {
|
P_PARAMDESC: {
|
||||||
val: body.P_PARAMDESC,
|
val: body.P_PARAMDESC,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
P_PARAMVALUE: {
|
P_PARAMVALUE: {
|
||||||
val: body.P_PARAMVALUE,
|
val: body.P_PARAMVALUE,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
P_ADDLPARAMVALUE1: {
|
P_ADDLPARAMVALUE1: {
|
||||||
val: body.P_ADDLPARAMVALUE1,
|
val: body.P_ADDLPARAMVALUE1,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
P_ADDLPARAMVALUE2: {
|
P_ADDLPARAMVALUE2: {
|
||||||
val: body.P_ADDLPARAMVALUE2,
|
val: body.P_ADDLPARAMVALUE2,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
P_ADDLPARAMVALUE3: {
|
P_ADDLPARAMVALUE3: {
|
||||||
val: body.P_ADDLPARAMVALUE3,
|
val: body.P_ADDLPARAMVALUE3,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
P_ADDLPARAMVALUE4: {
|
P_ADDLPARAMVALUE4: {
|
||||||
val: body.P_ADDLPARAMVALUE4,
|
val: body.P_ADDLPARAMVALUE4,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
P_ADDLPARAMVALUE5: {
|
P_ADDLPARAMVALUE5: {
|
||||||
val: body.P_ADDLPARAMVALUE5,
|
val: body.P_ADDLPARAMVALUE5,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
P_SORTSEQ: {
|
P_SORTSEQ: {
|
||||||
val: body.P_SORTSEQ,
|
val: body.P_SORTSEQ,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
P_USERID: {
|
P_USERID: {
|
||||||
val: body.P_USERID,
|
val: body.P_USERID,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
|
|
||||||
p_cursor: {
|
p_cursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
}, {
|
},
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
{
|
||||||
}
|
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
|
|
||||||
|
|
||||||
|
|
||||||
|
return fres;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
return { error: err.message }
|
return { error: err.message };
|
||||||
} finally { }
|
} else {
|
||||||
|
return { error: 'An unknown error occurred' };
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async UPDATEPARAMRECORD(body: UpdateParamRecordDTO) {
|
async UPDATEPARAMRECORD(body: UpdateParamRecordDTO) {
|
||||||
let connection;
|
let connection;
|
||||||
try {
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
connection = await this.oracleDBService.getConnection()
|
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected');
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
@ -231,73 +238,74 @@ export class ParamTableService {
|
|||||||
{
|
{
|
||||||
P_SPID: {
|
P_SPID: {
|
||||||
val: body.P_SPID,
|
val: body.P_SPID,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
P_PARAMID: {
|
P_PARAMID: {
|
||||||
val: body.P_PARAMID,
|
val: body.P_PARAMID,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
P_PARAMDESC: {
|
P_PARAMDESC: {
|
||||||
val: body.P_PARAMDESC,
|
val: body.P_PARAMDESC,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
P_ADDLPARAMVALUE1: {
|
P_ADDLPARAMVALUE1: {
|
||||||
val: body.P_ADDLPARAMVALUE1,
|
val: body.P_ADDLPARAMVALUE1,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
P_ADDLPARAMVALUE2: {
|
P_ADDLPARAMVALUE2: {
|
||||||
val: body.P_ADDLPARAMVALUE2,
|
val: body.P_ADDLPARAMVALUE2,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
P_ADDLPARAMVALUE3: {
|
P_ADDLPARAMVALUE3: {
|
||||||
val: body.P_ADDLPARAMVALUE3,
|
val: body.P_ADDLPARAMVALUE3,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
P_ADDLPARAMVALUE4: {
|
P_ADDLPARAMVALUE4: {
|
||||||
val: body.P_ADDLPARAMVALUE4,
|
val: body.P_ADDLPARAMVALUE4,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
P_ADDLPARAMVALUE5: {
|
P_ADDLPARAMVALUE5: {
|
||||||
val: body.P_ADDLPARAMVALUE5,
|
val: body.P_ADDLPARAMVALUE5,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
P_SORTSEQ: {
|
P_SORTSEQ: {
|
||||||
val: body.P_SORTSEQ,
|
val: body.P_SORTSEQ,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
P_USERID: {
|
P_USERID: {
|
||||||
val: body.P_USERID,
|
val: body.P_USERID,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
|
|
||||||
p_cursor: {
|
p_cursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
}, {
|
},
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
{
|
||||||
}
|
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
|
|
||||||
|
|
||||||
|
|
||||||
|
return fres;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
return { error: err.message }
|
return { error: err.message };
|
||||||
} finally { }
|
} else {
|
||||||
|
return { error: 'An unknown error occurred' };
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async INACTIVATEPARAMRECORD(body: ActivateOrInactivateParamRecordDTO) {
|
async INACTIVATEPARAMRECORD(body: ActivateOrInactivateParamRecordDTO) {
|
||||||
let connection;
|
let connection;
|
||||||
try {
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
connection = await this.oracleDBService.getConnection()
|
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected');
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
@ -309,32 +317,32 @@ export class ParamTableService {
|
|||||||
{
|
{
|
||||||
P_PARAMID: {
|
P_PARAMID: {
|
||||||
val: body.P_PARAMID,
|
val: body.P_PARAMID,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
P_USERID: {
|
P_USERID: {
|
||||||
val: body.P_USERID,
|
val: body.P_USERID,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
|
||||||
);
|
);
|
||||||
await connection.commit();
|
await connection.commit();
|
||||||
|
|
||||||
return "SP Executed Successfully"
|
return 'SP Executed Successfully';
|
||||||
|
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
return { error: err.message }
|
return { error: err.message };
|
||||||
} finally { }
|
} else {
|
||||||
|
return { error: 'An unknown error occurred' };
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async REACTIVATEPARAMRECORD(body: ActivateOrInactivateParamRecordDTO) {
|
async REACTIVATEPARAMRECORD(body: ActivateOrInactivateParamRecordDTO) {
|
||||||
let connection;
|
let connection;
|
||||||
try {
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
connection = await this.oracleDBService.getConnection()
|
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected');
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
@ -346,22 +354,23 @@ export class ParamTableService {
|
|||||||
{
|
{
|
||||||
P_PARAMID: {
|
P_PARAMID: {
|
||||||
val: body.P_PARAMID,
|
val: body.P_PARAMID,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
P_USERID: {
|
P_USERID: {
|
||||||
val: body.P_USERID,
|
val: body.P_USERID,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
await connection.commit();
|
await connection.commit();
|
||||||
|
|
||||||
return "SP Executed Successfully"
|
return 'SP Executed Successfully';
|
||||||
|
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
return { error: err.message }
|
return { error: err.message };
|
||||||
} finally { }
|
} else {
|
||||||
|
return { error: 'An unknown error occurred' };
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,22 +1,24 @@
|
|||||||
import { Body, Controller, Get, Param, ParseIntPipe, Post, Query } from '@nestjs/common';
|
import { Body, Controller, Get, Post, Query } from '@nestjs/common';
|
||||||
import { CreateCarnetSequenceDTO, GetCarnetSequenceDTO } from './carnet-sequence.dto';
|
import {
|
||||||
|
CreateCarnetSequenceDTO,
|
||||||
|
GetCarnetSequenceDTO,
|
||||||
|
} from './carnet-sequence.dto';
|
||||||
import { ApiTags } from '@nestjs/swagger';
|
import { ApiTags } from '@nestjs/swagger';
|
||||||
import { CarnetSequenceService } from './carnet-sequence.service';
|
import { CarnetSequenceService } from './carnet-sequence.service';
|
||||||
|
|
||||||
@Controller('carnet-sequence')
|
@Controller('carnet-sequence')
|
||||||
export class CarnetSequenceController {
|
export class CarnetSequenceController {
|
||||||
|
constructor(private readonly carnetSequenceService: CarnetSequenceService) {}
|
||||||
constructor(private readonly carnetSequenceService:CarnetSequenceService){}
|
|
||||||
|
|
||||||
@ApiTags('Carnet Sequence - Oracle')
|
@ApiTags('Carnet Sequence - Oracle')
|
||||||
@Post('/CreateCarnetSequence/')
|
@Post('/CreateCarnetSequence/')
|
||||||
createCarnetSequence(@Body() body: CreateCarnetSequenceDTO) {
|
createCarnetSequence(@Body() body: CreateCarnetSequenceDTO) {
|
||||||
return this.carnetSequenceService.createCarnetSequence(body)
|
return this.carnetSequenceService.createCarnetSequence(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Carnet Sequence - Oracle')
|
@ApiTags('Carnet Sequence - Oracle')
|
||||||
@Get('/GetCarnetSequence')
|
@Get('/GetCarnetSequence')
|
||||||
getCarnetSequence(@Query() body: GetCarnetSequenceDTO) {
|
getCarnetSequence(@Query() body: GetCarnetSequenceDTO) {
|
||||||
return this.carnetSequenceService.getCarnetSequence(body)
|
return this.carnetSequenceService.getCarnetSequence(body);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,42 +1,42 @@
|
|||||||
import { ApiProperty } from "@nestjs/swagger";
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
import { Transform } from "class-transformer";
|
import { Transform } from 'class-transformer';
|
||||||
import { IsDefined, IsInt, IsNumber, IsString, Min } from "class-validator";
|
import { IsDefined, IsInt, IsNumber, IsString, Min } from 'class-validator';
|
||||||
|
|
||||||
export class CreateCarnetSequenceDTO {
|
export class CreateCarnetSequenceDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||||
@IsDefined({ message: "Property p_spid is required" })
|
@IsDefined({ message: 'Property p_spid is required' })
|
||||||
p_spid: number;
|
p_spid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber({}, { message: "Property p_regionid must be a number" })
|
@IsNumber({}, { message: 'Property p_regionid must be a number' })
|
||||||
@IsDefined({ message: "Property p_regionid is required" })
|
@IsDefined({ message: 'Property p_regionid is required' })
|
||||||
p_regionid: number;
|
p_regionid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber({}, { message: "Property p_startnumber must be a number" })
|
@IsNumber({}, { message: 'Property p_startnumber must be a number' })
|
||||||
@IsDefined({ message: "Property p_startnumber is required" })
|
@IsDefined({ message: 'Property p_startnumber is required' })
|
||||||
@Min(0, { message: "Property p_startnumber must be at least 0" })
|
@Min(0, { message: 'Property p_startnumber must be at least 0' })
|
||||||
p_startnumber: number;
|
p_startnumber: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber({}, { message: "Property p_endnumber must be a number" })
|
@IsNumber({}, { message: 'Property p_endnumber must be a number' })
|
||||||
@IsDefined({ message: "Property p_endnumber is required" })
|
@IsDefined({ message: 'Property p_endnumber is required' })
|
||||||
@Min(0, { message: "Property p_endnumber must be at least 0" })
|
@Min(0, { message: 'Property p_endnumber must be at least 0' })
|
||||||
p_endnumber: number;
|
p_endnumber: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_carnettype must be a string" })
|
@IsString({ message: 'Property p_carnettype must be a string' })
|
||||||
@IsDefined({ message: "Property p_carnettype is required" })
|
@IsDefined({ message: 'Property p_carnettype is required' })
|
||||||
p_carnettype: string;
|
p_carnettype: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetCarnetSequenceDTO{
|
export class GetCarnetSequenceDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Min(0, { message: "Property p_spid must be at least 0" })
|
@Min(0, { message: 'Property p_spid must be at least 0' })
|
||||||
@IsInt({ message: "Property p_SPid must be a whole number" })
|
@IsInt({ message: 'Property p_SPid must be a whole number' })
|
||||||
@Transform(({ value }) => Number(value))
|
@Transform(({ value }) => Number(value))
|
||||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||||
@IsDefined({ message: "Property p_spid is required" })
|
@IsDefined({ message: 'Property p_spid is required' })
|
||||||
p_spid:number;
|
p_spid: number;
|
||||||
}
|
}
|
||||||
@ -4,6 +4,6 @@ import { CarnetSequenceService } from './carnet-sequence.service';
|
|||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
controllers: [CarnetSequenceController],
|
controllers: [CarnetSequenceController],
|
||||||
providers: [CarnetSequenceService]
|
providers: [CarnetSequenceService],
|
||||||
})
|
})
|
||||||
export class CarnetSequenceModule {}
|
export class CarnetSequenceModule {}
|
||||||
|
|||||||
@ -1,19 +1,21 @@
|
|||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import * as oracledb from 'oracledb';
|
import * as oracledb from 'oracledb';
|
||||||
import { OracleDBService } from 'src/db/db.service';
|
import { OracleDBService } from 'src/db/db.service';
|
||||||
import { CreateCarnetSequenceDTO, GetCarnetSequenceDTO } from './carnet-sequence.dto';
|
import {
|
||||||
|
CreateCarnetSequenceDTO,
|
||||||
|
GetCarnetSequenceDTO,
|
||||||
|
} from './carnet-sequence.dto';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class CarnetSequenceService {
|
export class CarnetSequenceService {
|
||||||
|
constructor(private readonly oracleDBService: OracleDBService) {}
|
||||||
|
|
||||||
constructor(private readonly oracleDBService:OracleDBService){}
|
async createCarnetSequence(body: CreateCarnetSequenceDTO) {
|
||||||
|
|
||||||
async createCarnetSequence(body:CreateCarnetSequenceDTO) {
|
|
||||||
let connection;
|
let connection;
|
||||||
try {
|
try {
|
||||||
connection = await this.oracleDBService.getConnection()
|
connection = await this.oracleDBService.getConnection();
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected');
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
@ -25,48 +27,52 @@ export class CarnetSequenceService {
|
|||||||
:p_endnumber,
|
:p_endnumber,
|
||||||
:p_carnettype,
|
:p_carnettype,
|
||||||
:p_cursor);
|
:p_cursor);
|
||||||
END;`, {
|
END;`,
|
||||||
|
{
|
||||||
p_spid: {
|
p_spid: {
|
||||||
val: body.p_spid,
|
val: body.p_spid,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
p_regionid: {
|
p_regionid: {
|
||||||
val: body.p_regionid,
|
val: body.p_regionid,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
p_startnumber: {
|
p_startnumber: {
|
||||||
val: body.p_startnumber,
|
val: body.p_startnumber,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
p_endnumber: {
|
p_endnumber: {
|
||||||
val: body.p_endnumber,
|
val: body.p_endnumber,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
p_carnettype: {
|
p_carnettype: {
|
||||||
val: body.p_carnettype,
|
val: body.p_carnettype,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_cursor: {
|
p_cursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
}, {
|
},
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
{
|
||||||
}
|
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
|
|
||||||
|
|
||||||
|
return fres;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
return { error: err.message }
|
return { error: err.message };
|
||||||
} finally { }
|
} else {
|
||||||
|
return { error: 'An unknown error occurred' };
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async getCarnetSequence(body: GetCarnetSequenceDTO) {
|
async getCarnetSequence(body: GetCarnetSequenceDTO) {
|
||||||
@ -74,9 +80,9 @@ export class CarnetSequenceService {
|
|||||||
let rows = [];
|
let rows = [];
|
||||||
try {
|
try {
|
||||||
// Connect to the Oracle database using oracledb
|
// Connect to the Oracle database using oracledb
|
||||||
connection = await this.oracleDBService.getConnection()
|
connection = await this.oracleDBService.getConnection();
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected');
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
@ -90,12 +96,12 @@ export class CarnetSequenceService {
|
|||||||
},
|
},
|
||||||
p_cursor: {
|
p_cursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result.outBinds && result.outBinds.p_cursor) {
|
if (result.outBinds && result.outBinds.p_cursor) {
|
||||||
@ -107,17 +113,18 @@ export class CarnetSequenceService {
|
|||||||
rows = rows.concat(rowsBatch);
|
rows = rows.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
await cursor.close();
|
await cursor.close();
|
||||||
} else {
|
} else {
|
||||||
throw new Error('No cursor returned from the stored procedure');
|
throw new Error('No cursor returned from the stored procedure');
|
||||||
}
|
}
|
||||||
|
|
||||||
return rows;
|
return rows;
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
return { error: err.message }
|
return { error: err.message };
|
||||||
} finally { }
|
} else {
|
||||||
|
return { error: 'An unknown error occurred' };
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,22 +1,13 @@
|
|||||||
import { RegionService } from './region.service';
|
import { RegionService } from './region.service';
|
||||||
|
|
||||||
import {
|
import { Get, Post, Body, Controller, Patch } from '@nestjs/common';
|
||||||
Get,
|
|
||||||
Post,
|
|
||||||
Body,
|
|
||||||
Controller,
|
|
||||||
Patch,
|
|
||||||
} from '@nestjs/common';
|
|
||||||
|
|
||||||
import { ApiTags } from '@nestjs/swagger';
|
import { ApiTags } from '@nestjs/swagger';
|
||||||
import { InsertRegionsDto, UpdateRegionDto } from './region.dto';
|
import { InsertRegionsDto, UpdateRegionDto } from './region.dto';
|
||||||
|
|
||||||
@Controller('oracle')
|
@Controller('oracle')
|
||||||
export class RegionController {
|
export class RegionController {
|
||||||
|
constructor(private readonly regionService: RegionService) {}
|
||||||
constructor(
|
|
||||||
private readonly regionService: RegionService
|
|
||||||
) { }
|
|
||||||
|
|
||||||
@ApiTags('Regions - Oracle')
|
@ApiTags('Regions - Oracle')
|
||||||
@Post('/InsertRegions')
|
@Post('/InsertRegions')
|
||||||
|
|||||||
@ -1,26 +1,26 @@
|
|||||||
import { IsDefined, IsNumber,IsString } from "class-validator";
|
import { IsDefined, IsNumber, IsString } from 'class-validator';
|
||||||
import { ApiProperty } from "@nestjs/swagger";
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
|
|
||||||
export class InsertRegionsDto {
|
export class InsertRegionsDto {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_region must be a string" })
|
@IsString({ message: 'Property p_region must be a string' })
|
||||||
@IsDefined({ message: "Property p_region is required" })
|
@IsDefined({ message: 'Property p_region is required' })
|
||||||
p_region: string;
|
p_region: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_name must be a string" })
|
@IsString({ message: 'Property p_name must be a string' })
|
||||||
@IsDefined({ message: "Property p_name is required" })
|
@IsDefined({ message: 'Property p_name is required' })
|
||||||
p_name: string;
|
p_name: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class UpdateRegionDto {
|
export class UpdateRegionDto {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber({}, { message: "Property p_regionID must be a number" })
|
@IsNumber({}, { message: 'Property p_regionID must be a number' })
|
||||||
@IsDefined({ message: "Property p_regionID is required" })
|
@IsDefined({ message: 'Property p_regionID is required' })
|
||||||
p_regionID: number;
|
p_regionID: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_name must be a string" })
|
@IsString({ message: 'Property p_name must be a string' })
|
||||||
@IsDefined({ message: "Property p_name is required" })
|
@IsDefined({ message: 'Property p_name is required' })
|
||||||
p_name: string;
|
p_name: string;
|
||||||
}
|
}
|
||||||
@ -4,6 +4,6 @@ import { RegionService } from './region.service';
|
|||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
controllers: [RegionController],
|
controllers: [RegionController],
|
||||||
providers: [RegionService]
|
providers: [RegionService],
|
||||||
})
|
})
|
||||||
export class RegionModule {}
|
export class RegionModule {}
|
||||||
|
|||||||
@ -1,95 +1,100 @@
|
|||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { OracleDBService } from 'src/db/db.service';
|
import { OracleDBService } from 'src/db/db.service';
|
||||||
import * as oracledb from 'oracledb'
|
import * as oracledb from 'oracledb';
|
||||||
import { InsertRegionsDto, UpdateRegionDto } from './region.dto';
|
import { InsertRegionsDto, UpdateRegionDto } from './region.dto';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class RegionService {
|
export class RegionService {
|
||||||
|
constructor(private readonly oracleDBService: OracleDBService) {}
|
||||||
constructor(private readonly oracleDBService: OracleDBService) { }
|
|
||||||
|
|
||||||
async insertRegions(body: InsertRegionsDto) {
|
async insertRegions(body: InsertRegionsDto) {
|
||||||
let connection;
|
let connection;
|
||||||
try {
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
connection = await this.oracleDBService.getConnection()
|
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected');
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
`BEGIN
|
`BEGIN
|
||||||
USCIB_Managed_Pkg.InsertNewRegion(:p_region,:p_name,:p_cursor);
|
USCIB_Managed_Pkg.InsertNewRegion(:p_region,:p_name,:p_cursor);
|
||||||
END;`, {
|
END;`,
|
||||||
|
{
|
||||||
p_region: {
|
p_region: {
|
||||||
val: body.p_region,
|
val: body.p_region,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_name: {
|
p_name: {
|
||||||
val: body.p_name,
|
val: body.p_name,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_cursor: {
|
p_cursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
}, {
|
},
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
{
|
||||||
}
|
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
|
|
||||||
|
|
||||||
|
return fres;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
return { error: err.message }
|
return { error: err.message };
|
||||||
} finally { }
|
} else {
|
||||||
|
return { error: 'An unknown error occurred' };
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateRegions(body: UpdateRegionDto) {
|
async updateRegions(body: UpdateRegionDto) {
|
||||||
let connection;
|
let connection;
|
||||||
try {
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
connection = await this.oracleDBService.getConnection()
|
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected');
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
`BEGIN
|
`BEGIN
|
||||||
USCIB_Managed_Pkg.UpdateRegion(:p_regionID,:p_name,:p_cursor);
|
USCIB_Managed_Pkg.UpdateRegion(:p_regionID,:p_name,:p_cursor);
|
||||||
END;`, {
|
END;`,
|
||||||
|
{
|
||||||
p_regionID: {
|
p_regionID: {
|
||||||
val: body.p_regionID,
|
val: body.p_regionID,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
p_name: {
|
p_name: {
|
||||||
val: body.p_name,
|
val: body.p_name,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_cursor: {
|
p_cursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
}, {
|
},
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
{
|
||||||
}
|
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
|
|
||||||
|
|
||||||
|
return fres;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
return { error: err.message }
|
return { error: err.message };
|
||||||
} finally { }
|
} else {
|
||||||
|
return { error: 'An unknown error occurred' };
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async getRegions() {
|
async getRegions() {
|
||||||
@ -97,11 +102,10 @@ export class RegionService {
|
|||||||
let rows = [];
|
let rows = [];
|
||||||
try {
|
try {
|
||||||
try {
|
try {
|
||||||
connection = await this.oracleDBService.getConnection()
|
connection = await this.oracleDBService.getConnection();
|
||||||
}
|
} catch (err) {
|
||||||
catch (err) {
|
console.log('DB ERROR: ', err);
|
||||||
console.log("DB ERROR: ", err);
|
return { error: 'Error while connecting to DB' };
|
||||||
return { error: "Error while connecting to DB" }
|
|
||||||
}
|
}
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
`BEGIN
|
`BEGIN
|
||||||
@ -110,12 +114,12 @@ export class RegionService {
|
|||||||
{
|
{
|
||||||
p_cursor: {
|
p_cursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result.outBinds && result.outBinds.p_cursor) {
|
if (result.outBinds && result.outBinds.p_cursor) {
|
||||||
@ -133,10 +137,12 @@ export class RegionService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return rows;
|
return rows;
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
return { error: err.message }
|
return { error: err.message };
|
||||||
} finally { }
|
} else {
|
||||||
|
return { error: 'An unknown error occurred' };
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,43 +1,46 @@
|
|||||||
import { SpContactsService } from './sp-contacts.service';
|
import { SpContactsService } from './sp-contacts.service';
|
||||||
import { Body, Controller, Get, Param, ParseIntPipe, Post, Put, Query } from '@nestjs/common';
|
import { Body, Controller, Get, Post, Put, Query } from '@nestjs/common';
|
||||||
import { getSPDefaultcontactDTO, inactivateSPContactDTO, InsertSPContactsDTO, setSPDefaultcontactDTO, UpdateSPContactsDTO } from './sp-contacts.dto';
|
import {
|
||||||
|
getSPDefaultcontactDTO,
|
||||||
|
inactivateSPContactDTO,
|
||||||
|
InsertSPContactsDTO,
|
||||||
|
setSPDefaultcontactDTO,
|
||||||
|
UpdateSPContactsDTO,
|
||||||
|
} from './sp-contacts.dto';
|
||||||
import { ApiTags } from '@nestjs/swagger';
|
import { ApiTags } from '@nestjs/swagger';
|
||||||
|
|
||||||
@Controller('oracle')
|
@Controller('oracle')
|
||||||
export class SpContactsController {
|
export class SpContactsController {
|
||||||
|
constructor(private readonly spContactsService: SpContactsService) {}
|
||||||
constructor(
|
|
||||||
private readonly spContactsService: SpContactsService,
|
|
||||||
) { }
|
|
||||||
|
|
||||||
@ApiTags('SPContacts - Oracle')
|
@ApiTags('SPContacts - Oracle')
|
||||||
@Post('/InsertSPContacts')
|
@Post('/InsertSPContacts')
|
||||||
insertSPContacts(@Body() body: InsertSPContactsDTO) {
|
insertSPContacts(@Body() body: InsertSPContactsDTO) {
|
||||||
return this.spContactsService.insertSPContacts(body)
|
return this.spContactsService.insertSPContacts(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('SPContacts - Oracle')
|
@ApiTags('SPContacts - Oracle')
|
||||||
@Post('/SetSPDefaultcontact')
|
@Post('/SetSPDefaultcontact')
|
||||||
setSPDefaultcontact(@Query() body:setSPDefaultcontactDTO) {
|
setSPDefaultcontact(@Query() body: setSPDefaultcontactDTO) {
|
||||||
return this.spContactsService.setSPDefaultcontact(body)
|
return this.spContactsService.setSPDefaultcontact(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('SPContacts - Oracle')
|
@ApiTags('SPContacts - Oracle')
|
||||||
@Put('/UpdateSPContacts')
|
@Put('/UpdateSPContacts')
|
||||||
updateSPContacts(@Body() body: UpdateSPContactsDTO) {
|
updateSPContacts(@Body() body: UpdateSPContactsDTO) {
|
||||||
return this.spContactsService.updateSPContacts(body)
|
return this.spContactsService.updateSPContacts(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('SPContacts - Oracle')
|
@ApiTags('SPContacts - Oracle')
|
||||||
@Post('/InactivateSPContact')
|
@Post('/InactivateSPContact')
|
||||||
inactivateSPContact(@Query() body:inactivateSPContactDTO) {
|
inactivateSPContact(@Query() body: inactivateSPContactDTO) {
|
||||||
return this.spContactsService.inactivateSPContact(body)
|
return this.spContactsService.inactivateSPContact(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('SPContacts - Oracle')
|
@ApiTags('SPContacts - Oracle')
|
||||||
@Get('/GetSPDefaultcontact')
|
@Get('/GetSPDefaultcontact')
|
||||||
getSPDefaultcontact(@Query() body:getSPDefaultcontactDTO) {
|
getSPDefaultcontact(@Query() body: getSPDefaultcontactDTO) {
|
||||||
return this.spContactsService.getSPDefaultcontacts(body)
|
return this.spContactsService.getSPDefaultcontacts(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Get('/GetAllSPcontacts')
|
// @Get('/GetAllSPcontacts')
|
||||||
|
|||||||
@ -1,6 +1,13 @@
|
|||||||
import { ApiProperty } from '@nestjs/swagger';
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
import { Transform } from 'class-transformer';
|
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 {
|
export class InsertSPContactsDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@ -90,23 +97,23 @@ export class UpdateSPContactsDTO {
|
|||||||
p_user_id: string;
|
p_user_id: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class setSPDefaultcontactDTO{
|
export class setSPDefaultcontactDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Min(0, { message: "Property p_spcontactid must be at least 0" })
|
@Min(0, { message: 'Property p_spcontactid must be at least 0' })
|
||||||
@IsInt({ message: "Property p_SPid must be a whole number" })
|
@IsInt({ message: 'Property p_SPid must be a whole number' })
|
||||||
@Transform(({ value }) => Number(value))
|
@Transform(({ value }) => Number(value))
|
||||||
@IsNumber({}, { message: "Property p_spcontactid must be a number" })
|
@IsNumber({}, { message: 'Property p_spcontactid must be a number' })
|
||||||
@IsDefined({ message: "Property p_spcontactid is required" })
|
@IsDefined({ message: 'Property p_spcontactid is required' })
|
||||||
p_spcontactid:number;
|
p_spcontactid: number;
|
||||||
}
|
}
|
||||||
export class inactivateSPContactDTO extends setSPDefaultcontactDTO{}
|
export class inactivateSPContactDTO extends setSPDefaultcontactDTO {}
|
||||||
|
|
||||||
export class getSPDefaultcontactDTO {
|
export class getSPDefaultcontactDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Min(0, { message: "Property p_SPid must be at least 0" })
|
@Min(0, { message: 'Property p_SPid must be at least 0' })
|
||||||
@IsInt({ message: "Property p_SPid must be a whole number" })
|
@IsInt({ message: 'Property p_SPid must be a whole number' })
|
||||||
@Transform(({ value }) => Number(value))
|
@Transform(({ value }) => Number(value))
|
||||||
@IsNumber({}, { message: "Property p_SPid must be a number" })
|
@IsNumber({}, { message: 'Property p_SPid must be a number' })
|
||||||
@IsDefined({ message: "Property p_SPid is required" })
|
@IsDefined({ message: 'Property p_SPid is required' })
|
||||||
p_SPid:number;
|
p_SPid: number;
|
||||||
}
|
}
|
||||||
@ -4,8 +4,8 @@ import { SpContactsController } from './sp-contacts.controller';
|
|||||||
import { DbModule } from 'src/db/db.module';
|
import { DbModule } from 'src/db/db.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports:[DbModule],
|
imports: [DbModule],
|
||||||
providers: [SpContactsService],
|
providers: [SpContactsService],
|
||||||
controllers: [SpContactsController]
|
controllers: [SpContactsController],
|
||||||
})
|
})
|
||||||
export class SpContactsModule {}
|
export class SpContactsModule {}
|
||||||
|
|||||||
@ -1,26 +1,24 @@
|
|||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { OracleDBService } from 'src/db/db.service';
|
import { OracleDBService } from 'src/db/db.service';
|
||||||
import * as oracledb from 'oracledb'
|
import * as oracledb from 'oracledb';
|
||||||
import {
|
import {
|
||||||
getSPDefaultcontactDTO,
|
getSPDefaultcontactDTO,
|
||||||
inactivateSPContactDTO,
|
inactivateSPContactDTO,
|
||||||
InsertSPContactsDTO,
|
InsertSPContactsDTO,
|
||||||
setSPDefaultcontactDTO,
|
setSPDefaultcontactDTO,
|
||||||
UpdateSPContactsDTO
|
UpdateSPContactsDTO,
|
||||||
} from './sp-contacts.dto';
|
} from './sp-contacts.dto';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class SpContactsService {
|
export class SpContactsService {
|
||||||
|
constructor(private readonly oracleDBService: OracleDBService) {}
|
||||||
constructor(private readonly oracleDBService: OracleDBService) { }
|
|
||||||
|
|
||||||
async insertSPContacts(body: InsertSPContactsDTO) {
|
async insertSPContacts(body: InsertSPContactsDTO) {
|
||||||
let connection;
|
let connection;
|
||||||
try {
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
connection = await this.oracleDBService.getConnection()
|
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected');
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
@ -38,80 +36,82 @@ export class SpContactsService {
|
|||||||
:p_emailaddress,
|
:p_emailaddress,
|
||||||
:p_user_id,
|
:p_user_id,
|
||||||
:p_cursor);
|
:p_cursor);
|
||||||
END;`, {
|
END;`,
|
||||||
|
{
|
||||||
p_spid: {
|
p_spid: {
|
||||||
val: body.p_spid,
|
val: body.p_spid,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
p_defcontactflag: {
|
p_defcontactflag: {
|
||||||
val: body.p_defcontactflag,
|
val: body.p_defcontactflag,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_firstname: {
|
p_firstname: {
|
||||||
val: body.p_firstname,
|
val: body.p_firstname,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_lastname: {
|
p_lastname: {
|
||||||
val: body.p_lastname,
|
val: body.p_lastname,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
P_MIDDLEINITIAL: {
|
P_MIDDLEINITIAL: {
|
||||||
val: body.P_MIDDLEINITIAL,
|
val: body.P_MIDDLEINITIAL,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_title: {
|
p_title: {
|
||||||
val: body.p_title,
|
val: body.p_title,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_phoneno: {
|
p_phoneno: {
|
||||||
val: body.p_phoneno,
|
val: body.p_phoneno,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_mobileno: {
|
p_mobileno: {
|
||||||
val: body.p_mobileno,
|
val: body.p_mobileno,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_faxno: {
|
p_faxno: {
|
||||||
val: body.p_faxno,
|
val: body.p_faxno,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_emailaddress: {
|
p_emailaddress: {
|
||||||
val: body.p_emailaddress,
|
val: body.p_emailaddress,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_user_id: {
|
p_user_id: {
|
||||||
val: body.p_user_id,
|
val: body.p_user_id,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_cursor: {
|
p_cursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
}, {
|
},
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
{
|
||||||
}
|
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
|
|
||||||
|
|
||||||
|
return fres;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
return { error: err.message }
|
return { error: err.message };
|
||||||
} finally { }
|
} else {
|
||||||
|
return { error: 'An unknown error occurred' };
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async setSPDefaultcontact(body: setSPDefaultcontactDTO) {
|
async setSPDefaultcontact(body: setSPDefaultcontactDTO) {
|
||||||
|
|
||||||
let connection;
|
let connection;
|
||||||
try {
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
connection = await this.oracleDBService.getConnection()
|
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected');
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
@ -121,29 +121,29 @@ export class SpContactsService {
|
|||||||
{
|
{
|
||||||
p_spcontactid: {
|
p_spcontactid: {
|
||||||
val: body.p_spcontactid,
|
val: body.p_spcontactid,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
|
||||||
await connection.commit();
|
await connection.commit();
|
||||||
|
|
||||||
return "SP executed successfully"
|
return 'SP executed successfully';
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
return { error: err.message }
|
return { error: err.message };
|
||||||
} finally { }
|
} else {
|
||||||
|
return { error: 'An unknown error occurred' };
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateSPContacts(body: UpdateSPContactsDTO) {
|
async updateSPContacts(body: UpdateSPContactsDTO) {
|
||||||
let connection;
|
let connection;
|
||||||
try {
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
connection = await this.oracleDBService.getConnection()
|
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected');
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
@ -160,109 +160,111 @@ export class SpContactsService {
|
|||||||
:p_emailaddress,
|
:p_emailaddress,
|
||||||
:p_user_id,
|
:p_user_id,
|
||||||
:p_cursor);
|
:p_cursor);
|
||||||
END;`, {
|
END;`,
|
||||||
|
{
|
||||||
p_spcontactid: {
|
p_spcontactid: {
|
||||||
val: body.p_spcontactid,
|
val: body.p_spcontactid,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
p_firstname: {
|
p_firstname: {
|
||||||
val: body.p_firstname,
|
val: body.p_firstname,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_lastname: {
|
p_lastname: {
|
||||||
val: body.p_lastname,
|
val: body.p_lastname,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
P_MIDDLEINITIAL: {
|
P_MIDDLEINITIAL: {
|
||||||
val: body.P_MIDDLEINITIAL,
|
val: body.P_MIDDLEINITIAL,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_title: {
|
p_title: {
|
||||||
val: body.p_title,
|
val: body.p_title,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_phoneno: {
|
p_phoneno: {
|
||||||
val: body.p_phoneno,
|
val: body.p_phoneno,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_mobileno: {
|
p_mobileno: {
|
||||||
val: body.p_mobileno,
|
val: body.p_mobileno,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_faxno: {
|
p_faxno: {
|
||||||
val: body.p_faxno,
|
val: body.p_faxno,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_emailaddress: {
|
p_emailaddress: {
|
||||||
val: body.p_emailaddress,
|
val: body.p_emailaddress,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_user_id: {
|
p_user_id: {
|
||||||
val: body.p_user_id,
|
val: body.p_user_id,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_cursor: {
|
p_cursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
}, {
|
},
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
{
|
||||||
}
|
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
|
|
||||||
|
|
||||||
|
return fres;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
return { error: err.message }
|
return { error: err.message };
|
||||||
} finally { }
|
} else {
|
||||||
|
return { error: 'An unknown error occurred' };
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async inactivateSPContact(body: inactivateSPContactDTO) {
|
async inactivateSPContact(body: inactivateSPContactDTO) {
|
||||||
|
|
||||||
let connection;
|
let connection;
|
||||||
try {
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
connection = await this.oracleDBService.getConnection()
|
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected');
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
`BEGIN
|
`BEGIN
|
||||||
USCIB_Managed_Pkg.InActivateSPContacts(:p_spcontactid);
|
USCIB_Managed_Pkg.InActivateSPContacts(:p_spcontactid);
|
||||||
END;`, {
|
END;`,
|
||||||
|
{
|
||||||
p_spcontactid: {
|
p_spcontactid: {
|
||||||
val: body.p_spcontactid,
|
val: body.p_spcontactid,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
await connection.commit();
|
await connection.commit();
|
||||||
|
|
||||||
return "SP executed successfully"
|
return 'SP executed successfully';
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
return { error: err.message }
|
return { error: err.message };
|
||||||
} finally { }
|
} else {
|
||||||
|
return { error: 'An unknown error occurred' };
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async getSPDefaultcontacts(body: getSPDefaultcontactDTO) {
|
async getSPDefaultcontacts(body: getSPDefaultcontactDTO) {
|
||||||
|
|
||||||
let connection;
|
let connection;
|
||||||
let rows = [];
|
let rows = [];
|
||||||
try {
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
connection = await this.oracleDBService.getConnection()
|
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected');
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
@ -276,12 +278,12 @@ export class SpContactsService {
|
|||||||
},
|
},
|
||||||
p_cursor: {
|
p_cursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result.outBinds && result.outBinds.p_cursor) {
|
if (result.outBinds && result.outBinds.p_cursor) {
|
||||||
@ -293,29 +295,28 @@ export class SpContactsService {
|
|||||||
rows = rows.concat(rowsBatch);
|
rows = rows.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
await cursor.close();
|
await cursor.close();
|
||||||
} else {
|
} else {
|
||||||
throw new Error('No cursor returned from the stored procedure');
|
throw new Error('No cursor returned from the stored procedure');
|
||||||
}
|
}
|
||||||
|
|
||||||
return rows;
|
return rows;
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
return { error: err.message }
|
return { error: err.message };
|
||||||
} finally { }
|
} else {
|
||||||
|
return { error: 'An unknown error occurred' };
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async getSPcontacts() {
|
async getSPcontacts() {
|
||||||
let connection;
|
let connection;
|
||||||
let rows = [];
|
let rows = [];
|
||||||
try {
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
connection = await this.oracleDBService.getConnection()
|
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected');
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
@ -325,12 +326,12 @@ export class SpContactsService {
|
|||||||
{
|
{
|
||||||
p_cursor: {
|
p_cursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result.outBinds && result.outBinds.p_cursor) {
|
if (result.outBinds && result.outBinds.p_cursor) {
|
||||||
@ -342,19 +343,18 @@ export class SpContactsService {
|
|||||||
rows = rows.concat(rowsBatch);
|
rows = rows.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
await cursor.close();
|
await cursor.close();
|
||||||
} else {
|
} else {
|
||||||
throw new Error('No cursor returned from the stored procedure');
|
throw new Error('No cursor returned from the stored procedure');
|
||||||
}
|
}
|
||||||
|
|
||||||
return rows;
|
return rows;
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
return { error: err.message }
|
return { error: err.message };
|
||||||
} finally { }
|
} else {
|
||||||
|
return { error: 'An unknown error occurred' };
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,25 +1,26 @@
|
|||||||
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 { SpService } from './sp.service';
|
||||||
import { ApiTags } from '@nestjs/swagger';
|
import { ApiTags } from '@nestjs/swagger';
|
||||||
import { getSelectedServiceproviderDTO, InsertNewServiceProviderDTO, UpdateServiceProviderDTO } from './sp.dto';
|
import {
|
||||||
|
getSelectedServiceproviderDTO,
|
||||||
|
InsertNewServiceProviderDTO,
|
||||||
|
UpdateServiceProviderDTO,
|
||||||
|
} from './sp.dto';
|
||||||
|
|
||||||
@Controller('oracle')
|
@Controller('oracle')
|
||||||
export class SpController {
|
export class SpController {
|
||||||
|
constructor(private readonly spService: SpService) {}
|
||||||
constructor(
|
|
||||||
private readonly spService: SpService
|
|
||||||
) { }
|
|
||||||
|
|
||||||
@ApiTags('SP - Oracle')
|
@ApiTags('SP - Oracle')
|
||||||
@Post('/InsertNewServiceProvider')
|
@Post('/InsertNewServiceProvider')
|
||||||
insertNewServiceProvider(@Body() body: InsertNewServiceProviderDTO) {
|
insertNewServiceProvider(@Body() body: InsertNewServiceProviderDTO) {
|
||||||
return this.spService.insertNewServiceProvider(body)
|
return this.spService.insertNewServiceProvider(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('SP - Oracle')
|
@ApiTags('SP - Oracle')
|
||||||
@Put('/UpdateServiceProvider')
|
@Put('/UpdateServiceProvider')
|
||||||
updateServiceProider(@Body() body: UpdateServiceProviderDTO) {
|
updateServiceProider(@Body() body: UpdateServiceProviderDTO) {
|
||||||
return this.spService.updateServiceProvider(body)
|
return this.spService.updateServiceProvider(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('SP - Oracle')
|
@ApiTags('SP - Oracle')
|
||||||
@ -30,7 +31,7 @@ export class SpController {
|
|||||||
|
|
||||||
@ApiTags('SP - Oracle')
|
@ApiTags('SP - Oracle')
|
||||||
@Get('/GetSelectedServiceprovider')
|
@Get('/GetSelectedServiceprovider')
|
||||||
getSelectedServiceprovider(@Query() body:getSelectedServiceproviderDTO) {
|
getSelectedServiceprovider(@Query() body: getSelectedServiceproviderDTO) {
|
||||||
return this.spService.getServiceproviderByID(body);
|
return this.spService.getServiceproviderByID(body);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,183 +1,189 @@
|
|||||||
import { ApiProperty } from '@nestjs/swagger';
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
import { Transform } from 'class-transformer';
|
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 {
|
export class InsertNewServiceProviderDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_name must be a string" })
|
@IsString({ message: 'Property p_name must be a string' })
|
||||||
@IsDefined({ message: "Property p_name is required" })
|
@IsDefined({ message: 'Property p_name is required' })
|
||||||
p_name: string;
|
p_name: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_lookupcode must be a string" })
|
@IsString({ message: 'Property p_lookupcode must be a string' })
|
||||||
@IsDefined({ message: "Property p_lookupcode is required" })
|
@IsDefined({ message: 'Property p_lookupcode is required' })
|
||||||
p_lookupcode: string;
|
p_lookupcode: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_address1 must be a string" })
|
@IsString({ message: 'Property p_address1 must be a string' })
|
||||||
@IsDefined({ message: "Property p_address1 is required" })
|
@IsDefined({ message: 'Property p_address1 is required' })
|
||||||
p_address1: string;
|
p_address1: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@IsString({ message: "Property p_address2 must be a string" })
|
@IsString({ message: 'Property p_address2 must be a string' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_address2?: string;
|
p_address2?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_city must be a string" })
|
@IsString({ message: 'Property p_city must be a string' })
|
||||||
@IsDefined({ message: "Property p_city is required" })
|
@IsDefined({ message: 'Property p_city is required' })
|
||||||
p_city: string;
|
p_city: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_state must be a string" })
|
@IsString({ message: 'Property p_state must be a string' })
|
||||||
@IsDefined({ message: "Property p_state is required" })
|
@IsDefined({ message: 'Property p_state is required' })
|
||||||
p_state: string;
|
p_state: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_zip must be a string" })
|
@IsString({ message: 'Property p_zip must be a string' })
|
||||||
@IsDefined({ message: "Property p_zip is required" })
|
@IsDefined({ message: 'Property p_zip is required' })
|
||||||
p_zip: string;
|
p_zip: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_country must be a string" })
|
@IsString({ message: 'Property p_country must be a string' })
|
||||||
@IsDefined({ message: "Property p_country is required" })
|
@IsDefined({ message: 'Property p_country is required' })
|
||||||
p_country: string;
|
p_country: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_issuingregion must be a string" })
|
@IsString({ message: 'Property p_issuingregion must be a string' })
|
||||||
@IsDefined({ message: "Property p_issuingregion is required" })
|
@IsDefined({ message: 'Property p_issuingregion is required' })
|
||||||
p_issuingregion: string;
|
p_issuingregion: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_replacementregion must be a string" })
|
@IsString({ message: 'Property p_replacementregion must be a string' })
|
||||||
@IsDefined({ message: "Property p_replacementregion is required" })
|
@IsDefined({ message: 'Property p_replacementregion is required' })
|
||||||
p_replacementregion: string;
|
p_replacementregion: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_bondsurety must be a string" })
|
@IsString({ message: 'Property p_bondsurety must be a string' })
|
||||||
@IsDefined({ message: "Property p_bondsurety is required" })
|
@IsDefined({ message: 'Property p_bondsurety is required' })
|
||||||
p_bondsurety: string;
|
p_bondsurety: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_cargopolicyno must be a string" })
|
@IsString({ message: 'Property p_cargopolicyno must be a string' })
|
||||||
@IsDefined({ message: "Property p_cargopolicyno is required" })
|
@IsDefined({ message: 'Property p_cargopolicyno is required' })
|
||||||
p_cargopolicyno: string;
|
p_cargopolicyno: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_cargosurety must be a string" })
|
@IsString({ message: 'Property p_cargosurety must be a string' })
|
||||||
@IsDefined({ message: "Property p_cargosurety is required" })
|
@IsDefined({ message: 'Property p_cargosurety is required' })
|
||||||
p_cargosurety: string;
|
p_cargosurety: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_user_id must be a string" })
|
@IsString({ message: 'Property p_user_id must be a string' })
|
||||||
@IsDefined({ message: "Property p_user_id is required" })
|
@IsDefined({ message: 'Property p_user_id is required' })
|
||||||
p_user_id: string;
|
p_user_id: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@IsString({ message: "Property P_NOTES must be a string" })
|
@IsString({ message: 'Property P_NOTES must be a string' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
P_NOTES?: string;
|
P_NOTES?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@IsString({ message: "Property P_FILEIDS must be a string" })
|
@IsString({ message: 'Property P_FILEIDS must be a string' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
P_FILEIDS?: string;
|
P_FILEIDS?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class UpdateServiceProviderDTO {
|
export class UpdateServiceProviderDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||||
@IsDefined({ message: "Property p_spid is required" })
|
@IsDefined({ message: 'Property p_spid is required' })
|
||||||
p_spid: number;
|
p_spid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_name must be a string" })
|
@IsString({ message: 'Property p_name must be a string' })
|
||||||
@IsDefined({ message: "Property p_name is required" })
|
@IsDefined({ message: 'Property p_name is required' })
|
||||||
p_name: string;
|
p_name: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_lookupcode must be a string" })
|
@IsString({ message: 'Property p_lookupcode must be a string' })
|
||||||
@IsDefined({ message: "Property p_lookupcode is required" })
|
@IsDefined({ message: 'Property p_lookupcode is required' })
|
||||||
p_lookupcode: string;
|
p_lookupcode: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_address1 must be a string" })
|
@IsString({ message: 'Property p_address1 must be a string' })
|
||||||
@IsDefined({ message: "Property p_address1 is required" })
|
@IsDefined({ message: 'Property p_address1 is required' })
|
||||||
p_address1: string;
|
p_address1: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@IsString({ message: "Property p_address2 must be a string" })
|
@IsString({ message: 'Property p_address2 must be a string' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_address2?: string;
|
p_address2?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_city must be a string" })
|
@IsString({ message: 'Property p_city must be a string' })
|
||||||
@IsDefined({ message: "Property p_city is required" })
|
@IsDefined({ message: 'Property p_city is required' })
|
||||||
p_city: string;
|
p_city: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_state must be a string" })
|
@IsString({ message: 'Property p_state must be a string' })
|
||||||
@IsDefined({ message: "Property p_state is required" })
|
@IsDefined({ message: 'Property p_state is required' })
|
||||||
p_state: string;
|
p_state: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_zip must be a string" })
|
@IsString({ message: 'Property p_zip must be a string' })
|
||||||
@IsDefined({ message: "Property p_zip is required" })
|
@IsDefined({ message: 'Property p_zip is required' })
|
||||||
p_zip: string;
|
p_zip: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_country must be a string" })
|
@IsString({ message: 'Property p_country must be a string' })
|
||||||
@IsDefined({ message: "Property p_country is required" })
|
@IsDefined({ message: 'Property p_country is required' })
|
||||||
p_country: string;
|
p_country: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_issuingregion must be a string" })
|
@IsString({ message: 'Property p_issuingregion must be a string' })
|
||||||
@IsDefined({ message: "Property p_issuingregion is required" })
|
@IsDefined({ message: 'Property p_issuingregion is required' })
|
||||||
p_issuingregion: string;
|
p_issuingregion: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_replacementregion must be a string" })
|
@IsString({ message: 'Property p_replacementregion must be a string' })
|
||||||
@IsDefined({ message: "Property p_replacementregion is required" })
|
@IsDefined({ message: 'Property p_replacementregion is required' })
|
||||||
p_replacementregion: string;
|
p_replacementregion: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_bondsurety must be a string" })
|
@IsString({ message: 'Property p_bondsurety must be a string' })
|
||||||
@IsDefined({ message: "Property p_bondsurety is required" })
|
@IsDefined({ message: 'Property p_bondsurety is required' })
|
||||||
p_bondsurety: string;
|
p_bondsurety: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_cargopolicyno must be a string" })
|
@IsString({ message: 'Property p_cargopolicyno must be a string' })
|
||||||
@IsDefined({ message: "Property p_cargopolicyno is required" })
|
@IsDefined({ message: 'Property p_cargopolicyno is required' })
|
||||||
p_cargopolicyno: string;
|
p_cargopolicyno: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_cargosurety must be a string" })
|
@IsString({ message: 'Property p_cargosurety must be a string' })
|
||||||
@IsDefined({ message: "Property p_cargosurety is required" })
|
@IsDefined({ message: 'Property p_cargosurety is required' })
|
||||||
p_cargosurety: string;
|
p_cargosurety: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_user_id must be a string" })
|
@IsString({ message: 'Property p_user_id must be a string' })
|
||||||
@IsDefined({ message: "Property p_user_id is required" })
|
@IsDefined({ message: 'Property p_user_id is required' })
|
||||||
p_user_id: string;
|
p_user_id: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@IsString({ message: "Property P_NOTES must be a string" })
|
@IsString({ message: 'Property P_NOTES must be a string' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
P_NOTES?: string;
|
P_NOTES?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@IsString({ message: "Property P_FILEIDS must be a string" })
|
@IsString({ message: 'Property P_FILEIDS must be a string' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
P_FILEIDS?: string;
|
P_FILEIDS?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class getSelectedServiceproviderDTO{
|
export class getSelectedServiceproviderDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Min(0, { message: "Property p_spid must be at least 0" })
|
@Min(0, { message: 'Property p_spid must be at least 0' })
|
||||||
@IsInt({ message: "Property p_SPid must be a whole number" })
|
@IsInt({ message: 'Property p_SPid must be a whole number' })
|
||||||
@Transform(({ value }) => Number(value))
|
@Transform(({ value }) => Number(value))
|
||||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||||
@IsDefined({ message: "Property p_spid is required" })
|
@IsDefined({ message: 'Property p_spid is required' })
|
||||||
p_spid:number;
|
p_spid: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,6 @@ import { SpService } from './sp.service';
|
|||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
controllers: [SpController],
|
controllers: [SpController],
|
||||||
providers: [SpService]
|
providers: [SpService],
|
||||||
})
|
})
|
||||||
export class SpModule {}
|
export class SpModule {}
|
||||||
|
|||||||
@ -1,21 +1,22 @@
|
|||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { OracleDBService } from 'src/db/db.service';
|
import { OracleDBService } from 'src/db/db.service';
|
||||||
import * as oracledb from 'oracledb'
|
import * as oracledb from 'oracledb';
|
||||||
import { getSelectedServiceproviderDTO, InsertNewServiceProviderDTO, UpdateServiceProviderDTO } from './sp.dto';
|
import {
|
||||||
|
getSelectedServiceproviderDTO,
|
||||||
|
InsertNewServiceProviderDTO,
|
||||||
|
UpdateServiceProviderDTO,
|
||||||
|
} from './sp.dto';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class SpService {
|
export class SpService {
|
||||||
|
constructor(private readonly oracleDBService: OracleDBService) {}
|
||||||
constructor(private readonly oracleDBService: OracleDBService) { }
|
|
||||||
|
|
||||||
async insertNewServiceProvider(body: InsertNewServiceProviderDTO) {
|
async insertNewServiceProvider(body: InsertNewServiceProviderDTO) {
|
||||||
|
|
||||||
let connection;
|
let connection;
|
||||||
try {
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
connection = await this.oracleDBService.getConnection()
|
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected');
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
@ -38,101 +39,102 @@ export class SpService {
|
|||||||
:P_NOTES,
|
:P_NOTES,
|
||||||
:P_FILEIDS,
|
:P_FILEIDS,
|
||||||
:p_cursor);
|
:p_cursor);
|
||||||
END;`, {
|
END;`,
|
||||||
|
{
|
||||||
p_name: {
|
p_name: {
|
||||||
val: body.p_name,
|
val: body.p_name,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_lookupcode: {
|
p_lookupcode: {
|
||||||
val: body.p_lookupcode,
|
val: body.p_lookupcode,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_address1: {
|
p_address1: {
|
||||||
val: body.p_address1,
|
val: body.p_address1,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_address2: {
|
p_address2: {
|
||||||
val: body.p_address2,
|
val: body.p_address2,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_city: {
|
p_city: {
|
||||||
val: body.p_city,
|
val: body.p_city,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_state: {
|
p_state: {
|
||||||
val: body.p_state,
|
val: body.p_state,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_zip: {
|
p_zip: {
|
||||||
val: body.p_zip,
|
val: body.p_zip,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_country: {
|
p_country: {
|
||||||
val: body.p_country,
|
val: body.p_country,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_issuingregion: {
|
p_issuingregion: {
|
||||||
val: body.p_issuingregion,
|
val: body.p_issuingregion,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_replacementregion: {
|
p_replacementregion: {
|
||||||
val: body.p_replacementregion,
|
val: body.p_replacementregion,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_bondsurety: {
|
p_bondsurety: {
|
||||||
val: body.p_bondsurety,
|
val: body.p_bondsurety,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_cargopolicyno: {
|
p_cargopolicyno: {
|
||||||
val: body.p_cargopolicyno,
|
val: body.p_cargopolicyno,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_cargosurety: {
|
p_cargosurety: {
|
||||||
val: body.p_cargosurety,
|
val: body.p_cargosurety,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_user_id: {
|
p_user_id: {
|
||||||
val: body.p_user_id,
|
val: body.p_user_id,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
P_NOTES: {
|
P_NOTES: {
|
||||||
val: body.P_NOTES,
|
val: body.P_NOTES,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
P_FILEIDS: {
|
P_FILEIDS: {
|
||||||
val: body.P_FILEIDS,
|
val: body.P_FILEIDS,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
|
|
||||||
p_cursor: {
|
p_cursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
}, {
|
},
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
{
|
||||||
}
|
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
|
|
||||||
|
|
||||||
|
return fres;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
return { error: err.message }
|
return { error: err.message };
|
||||||
} finally { }
|
} else {
|
||||||
|
return { error: 'An unknown error occurred' };
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateServiceProvider(body: UpdateServiceProviderDTO) {
|
async updateServiceProvider(body: UpdateServiceProviderDTO) {
|
||||||
|
|
||||||
let connection;
|
let connection;
|
||||||
try {
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
connection = await this.oracleDBService.getConnection()
|
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected');
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
@ -156,106 +158,107 @@ export class SpService {
|
|||||||
:P_NOTES,
|
:P_NOTES,
|
||||||
:P_FILEIDS,
|
:P_FILEIDS,
|
||||||
:p_cursor);
|
:p_cursor);
|
||||||
END;`, {
|
END;`,
|
||||||
|
{
|
||||||
p_spid: {
|
p_spid: {
|
||||||
val: body.p_spid,
|
val: body.p_spid,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
p_name: {
|
p_name: {
|
||||||
val: body.p_name,
|
val: body.p_name,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_lookupcode: {
|
p_lookupcode: {
|
||||||
val: body.p_lookupcode,
|
val: body.p_lookupcode,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_address1: {
|
p_address1: {
|
||||||
val: body.p_address1,
|
val: body.p_address1,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_address2: {
|
p_address2: {
|
||||||
val: body.p_address2,
|
val: body.p_address2,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_city: {
|
p_city: {
|
||||||
val: body.p_city,
|
val: body.p_city,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_state: {
|
p_state: {
|
||||||
val: body.p_state,
|
val: body.p_state,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_zip: {
|
p_zip: {
|
||||||
val: body.p_zip,
|
val: body.p_zip,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_country: {
|
p_country: {
|
||||||
val: body.p_country,
|
val: body.p_country,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_issuingregion: {
|
p_issuingregion: {
|
||||||
val: body.p_issuingregion,
|
val: body.p_issuingregion,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_replacementregion: {
|
p_replacementregion: {
|
||||||
val: body.p_replacementregion,
|
val: body.p_replacementregion,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_bondsurety: {
|
p_bondsurety: {
|
||||||
val: body.p_bondsurety,
|
val: body.p_bondsurety,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_cargopolicyno: {
|
p_cargopolicyno: {
|
||||||
val: body.p_cargopolicyno,
|
val: body.p_cargopolicyno,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_cargosurety: {
|
p_cargosurety: {
|
||||||
val: body.p_cargosurety,
|
val: body.p_cargosurety,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_user_id: {
|
p_user_id: {
|
||||||
val: body.p_user_id,
|
val: body.p_user_id,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
P_NOTES: {
|
P_NOTES: {
|
||||||
val: body.P_NOTES,
|
val: body.P_NOTES,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
P_FILEIDS: {
|
P_FILEIDS: {
|
||||||
val: body.P_FILEIDS,
|
val: body.P_FILEIDS,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
p_cursor: {
|
p_cursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
}, {
|
},
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
{
|
||||||
}
|
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
|
|
||||||
|
|
||||||
|
return fres;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
return { error: err.message }
|
return { error: err.message };
|
||||||
} finally { }
|
} else {
|
||||||
|
return { error: 'An unknown error occurred' };
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async getAllServiceproviders() {
|
async getAllServiceproviders() {
|
||||||
|
|
||||||
let connection;
|
let connection;
|
||||||
let rows = [];
|
let rows = [];
|
||||||
try {
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
connection = await this.oracleDBService.getConnection()
|
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected');
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
@ -265,12 +268,12 @@ export class SpService {
|
|||||||
{
|
{
|
||||||
p_cursor: {
|
p_cursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result.outBinds && result.outBinds.p_cursor) {
|
if (result.outBinds && result.outBinds.p_cursor) {
|
||||||
@ -282,30 +285,28 @@ export class SpService {
|
|||||||
rows = rows.concat(rowsBatch);
|
rows = rows.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
await cursor.close();
|
await cursor.close();
|
||||||
|
|
||||||
return rows;
|
return rows;
|
||||||
} else {
|
} else {
|
||||||
throw new Error('No cursor returned from the stored procedure');
|
throw new Error('No cursor returned from the stored procedure');
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
return { error: err.message }
|
return { error: err.message };
|
||||||
} finally { }
|
} else {
|
||||||
|
return { error: 'An unknown error occurred' };
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async getServiceproviderByID(body:getSelectedServiceproviderDTO) {
|
async getServiceproviderByID(body: getSelectedServiceproviderDTO) {
|
||||||
|
|
||||||
let connection;
|
let connection;
|
||||||
let rows = [];
|
let rows = [];
|
||||||
try {
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
connection = await this.oracleDBService.getConnection()
|
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected');
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
@ -319,12 +320,12 @@ export class SpService {
|
|||||||
},
|
},
|
||||||
p_cursor: {
|
p_cursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result.outBinds && result.outBinds.p_cursor) {
|
if (result.outBinds && result.outBinds.p_cursor) {
|
||||||
@ -342,11 +343,12 @@ export class SpService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return rows;
|
return rows;
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
return { error: err.message }
|
return { error: err.message };
|
||||||
} finally { }
|
} else {
|
||||||
|
return { error: 'An unknown error occurred' };
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,6 @@ import { CarnetSequenceModule } from './carnet-sequence/carnet-sequence.module';
|
|||||||
@Module({
|
@Module({
|
||||||
controllers: [],
|
controllers: [],
|
||||||
providers: [],
|
providers: [],
|
||||||
imports: [RegionModule, SpModule, SpContactsModule, CarnetSequenceModule]
|
imports: [RegionModule, SpModule, SpContactsModule, CarnetSequenceModule],
|
||||||
})
|
})
|
||||||
export class UscibManagedSpModule {}
|
export class UscibManagedSpModule {}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user