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';
|
||||
|
||||
@Module({
|
||||
imports: [ AuthModule, DbModule, OracleModule],
|
||||
imports: [AuthModule, DbModule, OracleModule],
|
||||
controllers: [],
|
||||
providers: [],
|
||||
})
|
||||
|
||||
@ -5,12 +5,11 @@ import { AuthLoginDTO } from './auth.dto';
|
||||
|
||||
@Controller()
|
||||
export class AuthController {
|
||||
|
||||
constructor(private readonly authService:AuthService){}
|
||||
constructor(private readonly authService: AuthService) {}
|
||||
|
||||
@ApiTags('Auth')
|
||||
@Post('/login')
|
||||
login(@Body() body:AuthLoginDTO){
|
||||
login(@Body() body: AuthLoginDTO) {
|
||||
return this.authService.login(body);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,13 +1,12 @@
|
||||
import { ApiProperty } from "@nestjs/swagger";
|
||||
import { IsString } from "class-validator";
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString } from 'class-validator';
|
||||
|
||||
export class AuthLoginDTO{
|
||||
|
||||
@ApiProperty({required:true})
|
||||
export class AuthLoginDTO {
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
p_emailaddr:string;
|
||||
p_emailaddr: string;
|
||||
|
||||
@ApiProperty({required:true})
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
p_password:string;
|
||||
p_password: string;
|
||||
}
|
||||
@ -1,12 +1,11 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { AuthService } from './auth.service';
|
||||
import { AuthController } from './auth.controller';
|
||||
import { OracleDBService } from 'src/db/db.service';
|
||||
import { DbModule } from 'src/db/db.module';
|
||||
|
||||
@Module({
|
||||
imports:[DbModule],
|
||||
imports: [DbModule],
|
||||
providers: [AuthService],
|
||||
controllers: [AuthController]
|
||||
controllers: [AuthController],
|
||||
})
|
||||
export class AuthModule {}
|
||||
|
||||
@ -1,21 +1,19 @@
|
||||
import { BadRequestException, Injectable } from '@nestjs/common';
|
||||
import { OracleDBService } from 'src/db/db.service';
|
||||
import { AuthLoginDTO } from './auth.dto';
|
||||
import * as oracledb from 'oracledb'
|
||||
import * as oracledb from 'oracledb';
|
||||
|
||||
@Injectable()
|
||||
export class AuthService {
|
||||
constructor(private readonly oracleDBService: OracleDBService) {}
|
||||
|
||||
constructor(private readonly oracleDBService: OracleDBService) { }
|
||||
|
||||
async login(body:AuthLoginDTO) {
|
||||
async login(body: AuthLoginDTO) {
|
||||
let connection;
|
||||
let rows = [];
|
||||
let crows:any = [];
|
||||
try {
|
||||
connection = await this.oracleDBService.getConnection()
|
||||
connection = await this.oracleDBService.getConnection();
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
throw new Error('No DB Connected');
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
@ -25,20 +23,20 @@ export class AuthService {
|
||||
{
|
||||
p_emailaddr: {
|
||||
val: body.p_emailaddr,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_password: {
|
||||
val: body.p_password,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_login_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) {
|
||||
@ -52,19 +50,18 @@ export class AuthService {
|
||||
|
||||
await cursor.close();
|
||||
} 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"]){
|
||||
return {error:"Invalid username or password!"}
|
||||
if (rows[0]['ERRORMESG']) {
|
||||
return { error: 'Invalid username or password!' };
|
||||
}
|
||||
return {msg:"Logged in successfully"}
|
||||
|
||||
return { msg: 'Logged in successfully' };
|
||||
} catch (err) {
|
||||
console.error('Error fetching users: ', err.message);
|
||||
return {error:"Invalid username or password"}
|
||||
} finally { }
|
||||
|
||||
|
||||
return { error: 'Invalid username or password' };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@ import { MssqlDBService, OracleDBService } from './db.service';
|
||||
|
||||
@Global()
|
||||
@Module({
|
||||
providers: [OracleDBService,MssqlDBService],
|
||||
exports:[OracleDBService,MssqlDBService]
|
||||
providers: [OracleDBService, MssqlDBService],
|
||||
exports: [OracleDBService, MssqlDBService],
|
||||
})
|
||||
export class DbModule {}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { MssqlConfig , OracleConfig} from 'ormconfig';
|
||||
import { createPool, Pool, Connection as cob, } from 'oracledb';
|
||||
import { MssqlConfig, OracleConfig } from 'ormconfig';
|
||||
import { createPool, Pool, Connection as cob } from 'oracledb';
|
||||
import { Connection, ConnectionPool } from 'mssql';
|
||||
import { Global, Injectable } from '@nestjs/common';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
|
||||
@Injectable()
|
||||
export class OracleDBService {
|
||||
@ -32,7 +32,7 @@ export class MssqlDBService {
|
||||
private pool: ConnectionPool;
|
||||
private readonly config = {
|
||||
...MssqlConfig,
|
||||
server: "localhost",
|
||||
server: 'localhost',
|
||||
pool: {
|
||||
max: 10,
|
||||
min: 0,
|
||||
@ -44,7 +44,7 @@ export class MssqlDBService {
|
||||
this.initializePool();
|
||||
}
|
||||
|
||||
private async initializePool() {
|
||||
private initializePool() {
|
||||
this.pool = new ConnectionPool(this.config);
|
||||
}
|
||||
|
||||
|
||||
46
src/main.ts
46
src/main.ts
@ -1,17 +1,21 @@
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { AppModule } from './app.module';
|
||||
import { BadRequestException, ValidationError, ValidationPipe } from '@nestjs/common';
|
||||
import {
|
||||
BadRequestException,
|
||||
ValidationError,
|
||||
ValidationPipe,
|
||||
} from '@nestjs/common';
|
||||
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
|
||||
import { SwaggerDocumentOptions } from '@nestjs/swagger';
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule, {
|
||||
cors: {
|
||||
"origin": "*",
|
||||
"methods": "GET,HEAD,PUT,PATCH,POST,DELETE",
|
||||
"preflightContinue": false,
|
||||
"optionsSuccessStatus": 204
|
||||
}
|
||||
origin: '*',
|
||||
methods: 'GET,HEAD,PUT,PATCH,POST,DELETE',
|
||||
preflightContinue: false,
|
||||
optionsSuccessStatus: 204,
|
||||
},
|
||||
});
|
||||
|
||||
function extractConstraints(validationErrors: ValidationError[]) {
|
||||
@ -41,39 +45,49 @@ async function bootstrap() {
|
||||
}
|
||||
|
||||
const customExceptionFactory = (validationErrors: ValidationError[]) => {
|
||||
const res = extractConstraints(validationErrors);
|
||||
|
||||
let res = extractConstraints(validationErrors);
|
||||
|
||||
let newResult = res.map(x => {
|
||||
const newResult = res
|
||||
.map((x) => {
|
||||
const errorMessage = x[Object.keys(x)[0]];
|
||||
|
||||
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,
|
||||
exceptionFactory: customExceptionFactory,
|
||||
whitelist: true,
|
||||
stopAtFirstError: true,
|
||||
forbidNonWhitelisted: true,
|
||||
}));
|
||||
}),
|
||||
);
|
||||
|
||||
// app.useGlobalPipes(new ValidationPipe({ exceptionFactory:customExceptionFactory, whitelist: true, forbidNonWhitelisted: true, transform: true }));
|
||||
const config = new DocumentBuilder()
|
||||
.setTitle('API')
|
||||
.setDescription('API description')
|
||||
.setVersion('1.0')
|
||||
.addServer("http://localhost:3000", "Development Server 1")
|
||||
.addServer("https://dev.alphaomegainfosys.com/test-api", "Development Server 2")
|
||||
.addServer('http://localhost:3000', 'Development Server 1')
|
||||
.addServer(
|
||||
'https://dev.alphaomegainfosys.com/test-api',
|
||||
'Development Server 2',
|
||||
)
|
||||
.build();
|
||||
|
||||
const options: SwaggerDocumentOptions = {
|
||||
autoTagControllers: false,
|
||||
};
|
||||
const documentFactory = () => SwaggerModule.createDocument(app, config, options);
|
||||
const documentFactory = () =>
|
||||
SwaggerModule.createDocument(app, config, options);
|
||||
SwaggerModule.setup('api', app, documentFactory);
|
||||
|
||||
await app.listen(process.env.PORT ?? 3000);
|
||||
|
||||
@ -5,7 +5,7 @@ import {
|
||||
Param,
|
||||
Controller,
|
||||
ParseIntPipe,
|
||||
BadRequestException
|
||||
BadRequestException,
|
||||
} from '@nestjs/common';
|
||||
|
||||
import { HomePageService } from './home-page.service';
|
||||
@ -14,14 +14,12 @@ import { ApiTags } from '@nestjs/swagger';
|
||||
import {
|
||||
SaveCarnetApplicationDTO,
|
||||
TransmitApplicationtoProcessDTO,
|
||||
GetCarnetDetailsbyCarnetStatusDTO
|
||||
GetCarnetDetailsbyCarnetStatusDTO,
|
||||
} from './home-page.dto';
|
||||
|
||||
@Controller()
|
||||
export class HomePageController {
|
||||
constructor(
|
||||
private readonly homePageService: HomePageService
|
||||
) { }
|
||||
constructor(private readonly homePageService: HomePageService) {}
|
||||
|
||||
@ApiTags('HomePage - Oracle')
|
||||
@Get('/oracle/GetHomePageData/:id')
|
||||
@ -36,29 +34,36 @@ export class HomePageController {
|
||||
}
|
||||
|
||||
@ApiTags('HomePage - Oracle')
|
||||
@Get('/oracle/GetCarnetDetailsbyCarnetStatus/:p_spid/:p_userid/:p_CarnetStatus')
|
||||
@Get(
|
||||
'/oracle/GetCarnetDetailsbyCarnetStatus/:p_spid/:p_userid/:p_CarnetStatus',
|
||||
)
|
||||
GetCarnetDetailsbyCarnetStatus(
|
||||
@Param('p_spid', ParseIntPipe) p_spid: number,
|
||||
@Param('p_userid') p_userid: string,
|
||||
@Param('p_CarnetStatus') p_CarnetStatus: string
|
||||
@Param('p_CarnetStatus') p_CarnetStatus: string,
|
||||
) {
|
||||
if (!p_spid || !p_userid || !p_CarnetStatus) {
|
||||
throw new BadRequestException('spid, userid and Carnet Status are required');
|
||||
}
|
||||
else if (Number(p_userid) || Number(p_CarnetStatus)) {
|
||||
throw new BadRequestException('Param p_userid and p_CarnetStatus should be string');
|
||||
throw new BadRequestException(
|
||||
'spid, userid and Carnet Status are required',
|
||||
);
|
||||
} else if (Number(p_userid) || Number(p_CarnetStatus)) {
|
||||
throw new BadRequestException(
|
||||
'Param p_userid and p_CarnetStatus should be string',
|
||||
);
|
||||
}
|
||||
try {
|
||||
const body: GetCarnetDetailsbyCarnetStatusDTO = {
|
||||
p_spid: p_spid,
|
||||
p_userid: p_userid,
|
||||
p_CarnetStatus: p_CarnetStatus
|
||||
p_CarnetStatus: p_CarnetStatus,
|
||||
};
|
||||
|
||||
return this.homePageService.GetCarnetDetailsbyCarnetStatus(body);
|
||||
}
|
||||
catch (err) {
|
||||
return new BadRequestException({ message: 'Validation faileda', error: err.message })
|
||||
} catch (err) {
|
||||
return new BadRequestException({
|
||||
message: 'Validation faileda',
|
||||
error: err.message,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,6 +78,4 @@ export class HomePageController {
|
||||
TransmitApplicationtoProcess(@Body() body: TransmitApplicationtoProcessDTO) {
|
||||
return this.homePageService.TransmitApplicationtoProcess(body);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,33 +1,48 @@
|
||||
import { ApiProperty } from "@nestjs/swagger";
|
||||
import { Type } from "class-transformer";
|
||||
import { IsArray, IsDefined, IsInt, IsNumber, IsOptional, IsString, Length, Max, Min, ValidateNested } from "class-validator";
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { Type } from 'class-transformer';
|
||||
import {
|
||||
IsArray,
|
||||
IsDefined,
|
||||
IsInt,
|
||||
IsNumber,
|
||||
IsOptional,
|
||||
IsString,
|
||||
Length,
|
||||
Max,
|
||||
Min,
|
||||
ValidateNested,
|
||||
} from 'class-validator';
|
||||
|
||||
export class p_gltableDTO {
|
||||
@ApiProperty({ required: true })
|
||||
@Max(999999999, { message: "Property ItemNo must not exceed 999999999" })
|
||||
@Min(0, { message: "Property ItemNo must be at least 0 or more" })
|
||||
@Max(999999999, { message: 'Property ItemNo must not exceed 999999999' })
|
||||
@Min(0, { message: 'Property ItemNo must be at least 0 or more' })
|
||||
@IsInt()
|
||||
@IsNumber({}, { message: "Property ItemNo must be a number" })
|
||||
@IsDefined({ message: "Property ItemNo is required" })
|
||||
@IsNumber({}, { message: 'Property ItemNo must be a number' })
|
||||
@IsDefined({ message: 'Property ItemNo is required' })
|
||||
ItemNo: number;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 1000, { message: "Property ItemDescription must be between 1 and 1000 characters" })
|
||||
@IsString({ message: "Property ItemDescription should be string" })
|
||||
@IsDefined({ message: "Property ItemDescription is required" })
|
||||
@Length(0, 1000, {
|
||||
message: 'Property ItemDescription must be between 1 and 1000 characters',
|
||||
})
|
||||
@IsString({ message: 'Property ItemDescription should be string' })
|
||||
@IsDefined({ message: 'Property ItemDescription is required' })
|
||||
ItemDescription: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsNumber({},{ message: "Property ItemValue should be number" })
|
||||
@IsDefined({ message: "Property ItemValue is required" })
|
||||
@IsNumber({}, { message: 'Property ItemValue should be number' })
|
||||
@IsDefined({ message: 'Property ItemValue is required' })
|
||||
ItemValue: number;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Max(99999999999, { message: "Property Noofpieces must not exceed 99999999999" })
|
||||
@Min(0, { message: "Property Noofpieces must be at least 0 or more" })
|
||||
@Max(99999999999, {
|
||||
message: 'Property Noofpieces must not exceed 99999999999',
|
||||
})
|
||||
@Min(0, { message: 'Property Noofpieces must be at least 0 or more' })
|
||||
@IsInt()
|
||||
@IsNumber({}, { message: "Property Noofpieces must be a number" })
|
||||
@IsDefined({ message: "Property Noofpieces is required" })
|
||||
@IsNumber({}, { message: 'Property Noofpieces must be a number' })
|
||||
@IsDefined({ message: 'Property Noofpieces is required' })
|
||||
Noofpieces: number;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@ -36,120 +51,147 @@ export class p_gltableDTO {
|
||||
ItemWeight?: number;
|
||||
|
||||
@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()
|
||||
@IsOptional()
|
||||
ItemWeightUOM?: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 2, { message: "Property GoodsOriginCountry must be between 0 and 2 characters" })
|
||||
@IsString({ message: "Property GoodsOriginCountry should be string" })
|
||||
@IsDefined({ message: "Property name is required" })
|
||||
@Length(0, 2, {
|
||||
message: 'Property GoodsOriginCountry must be between 0 and 2 characters',
|
||||
})
|
||||
@IsString({ message: 'Property GoodsOriginCountry should be string' })
|
||||
@IsDefined({ message: 'Property name is required' })
|
||||
GoodsOriginCountry: string;
|
||||
}
|
||||
|
||||
export class p_countrytableDTO {
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 1, { message: "Property VisitTransitInd must be 0 to 1 characters" })
|
||||
@Length(0, 1, {
|
||||
message: 'Property VisitTransitInd must be 0 to 1 characters',
|
||||
})
|
||||
@IsString()
|
||||
@IsDefined({ message: "Property VisitTransitInd is required" })
|
||||
@IsDefined({ message: 'Property VisitTransitInd is required' })
|
||||
VisitTransitInd: string;
|
||||
|
||||
@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()
|
||||
@IsDefined({ message: "Property CountryCode is required" })
|
||||
@IsDefined({ message: 'Property CountryCode is required' })
|
||||
CountryCode: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Max(999, { message: "Property NoOfTimesEntLeave must not exceed 999" })
|
||||
@Min(0, { message: "Property NoOfTimesEntLeave must be at least 0 or more" })
|
||||
@Max(999, { message: 'Property NoOfTimesEntLeave must not exceed 999' })
|
||||
@Min(0, { message: 'Property NoOfTimesEntLeave must be at least 0 or more' })
|
||||
@IsInt()
|
||||
@IsNumber({}, { message: "Property NoOfTimesEntLeave must be a number" })
|
||||
@IsDefined({ message: "Property NoOfTimesEntLeave is required" })
|
||||
@IsNumber({}, { message: 'Property NoOfTimesEntLeave must be a number' })
|
||||
@IsDefined({ message: 'Property NoOfTimesEntLeave is required' })
|
||||
NoOfTimesEntLeave: number;
|
||||
}
|
||||
|
||||
export class SaveCarnetApplicationDTO {
|
||||
@ApiProperty({ required: true })
|
||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
||||
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||
@IsInt()
|
||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
||||
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||
p_spid: number;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Max(999999999, { message: "Property p_clientid must not exceed 999999999" })
|
||||
@Min(0, { message: "Property p_clientid must be at least 0 or more" })
|
||||
@Max(999999999, { message: 'Property p_clientid must not exceed 999999999' })
|
||||
@Min(0, { message: 'Property p_clientid must be at least 0 or more' })
|
||||
@IsInt()
|
||||
@IsNumber({}, { message: "Property p_clientid must be a number" })
|
||||
@IsNumber({}, { message: 'Property p_clientid must be a number' })
|
||||
p_clientid: number;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Max(999999999, { message: "Property p_locationid must not exceed 999999999" })
|
||||
@Min(0, { message: "Property p_locationid must be at least 0 or more" })
|
||||
@Max(999999999, {
|
||||
message: 'Property p_locationid must not exceed 999999999',
|
||||
})
|
||||
@Min(0, { message: 'Property p_locationid must be at least 0 or more' })
|
||||
@IsInt()
|
||||
@IsNumber({}, { message: "Property p_locationid must be a number" })
|
||||
@IsNumber({}, { message: 'Property p_locationid must be a number' })
|
||||
p_locationid: number;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 50, { message: "Property p_userid must be between 0 to 50 characters" })
|
||||
@Length(0, 50, {
|
||||
message: 'Property p_userid must be between 0 to 50 characters',
|
||||
})
|
||||
@IsString()
|
||||
p_userid: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Max(999999999, { message: "Property p_headerid must not exceed 999999999" })
|
||||
@Min(0, { message: "Property p_headerid must be at least 0 or more" })
|
||||
@Max(999999999, { message: 'Property p_headerid must not exceed 999999999' })
|
||||
@Min(0, { message: 'Property p_headerid must be at least 0 or more' })
|
||||
@IsInt()
|
||||
@IsNumber({}, { message: "Property p_headerid must be a number" })
|
||||
@IsNumber({}, { message: 'Property p_headerid must be a number' })
|
||||
@IsOptional()
|
||||
p_headerid?: number;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 50, { message: "Property p_applicationname must be between 0 to 50 characters" })
|
||||
@Length(0, 50, {
|
||||
message: 'Property p_applicationname must be between 0 to 50 characters',
|
||||
})
|
||||
@IsString()
|
||||
p_applicationname: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Max(999999999, { message: "Property p_holderid must not exceed 999999999" })
|
||||
@Min(0, { message: "Property p_holderid must be at least 0 or more" })
|
||||
@Max(999999999, { message: 'Property p_holderid must not exceed 999999999' })
|
||||
@Min(0, { message: 'Property p_holderid must be at least 0 or more' })
|
||||
@IsInt()
|
||||
@IsNumber({}, { message: "Property p_holderid must be a number" })
|
||||
@IsNumber({}, { message: 'Property p_holderid must be a number' })
|
||||
@IsOptional()
|
||||
p_holderid?: number;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Length(0, 1, { message: "Property p_commercialsampleflag must be between 0 to 1 characters" })
|
||||
@Length(0, 1, {
|
||||
message:
|
||||
'Property p_commercialsampleflag must be between 0 to 1 characters',
|
||||
})
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
p_commercialsampleflag?: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Length(0, 1, { message: "Property p_profequipmentflag must be between 0 to 1 characters" })
|
||||
@Length(0, 1, {
|
||||
message: 'Property p_profequipmentflag must be between 0 to 1 characters',
|
||||
})
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
p_profequipmentflag?: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Length(0, 1, { message: "Property p_exhibitionsfairflag must be between 0 to 1 characters" })
|
||||
@Length(0, 1, {
|
||||
message: 'Property p_exhibitionsfairflag must be between 0 to 1 characters',
|
||||
})
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
p_exhibitionsfairflag?: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Length(0, 1, { message: "Property p_autoflag must be between 0 to 1 characters" })
|
||||
@Length(0, 1, {
|
||||
message: 'Property p_autoflag must be between 0 to 1 characters',
|
||||
})
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
p_autoflag?: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Length(0, 1, { message: "Property p_horseflag must be between 0 to 1 characters" })
|
||||
@Length(0, 1, {
|
||||
message: 'Property p_horseflag must be between 0 to 1 characters',
|
||||
})
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
p_horseflag?: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Length(0, 200, { message: "Property p_authrep must be between 0 to 200 characters" })
|
||||
@Length(0, 200, {
|
||||
message: 'Property p_authrep must be between 0 to 200 characters',
|
||||
})
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
p_authrep?: string;
|
||||
@ -163,10 +205,10 @@ export class SaveCarnetApplicationDTO {
|
||||
p_gltable?: p_gltableDTO[];
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Max(99999, { message: "Property p_ussets must not exceed 99999" })
|
||||
@Min(0, { message: "Property p_ussets must be at least 0 or more" })
|
||||
@Max(99999, { message: 'Property p_ussets must not exceed 99999' })
|
||||
@Min(0, { message: 'Property p_ussets must be at least 0 or more' })
|
||||
@IsInt()
|
||||
@IsNumber({}, { message: "Property p_ussets must be a number" })
|
||||
@IsNumber({}, { message: 'Property p_ussets must be a number' })
|
||||
@IsOptional()
|
||||
p_ussets?: number;
|
||||
|
||||
@ -178,69 +220,91 @@ export class SaveCarnetApplicationDTO {
|
||||
p_countrytable?: p_countrytableDTO[];
|
||||
|
||||
@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()
|
||||
@IsOptional()
|
||||
p_shiptotype?: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Max(999999999, { message: "Property p_shipaddrid must not exceed 999999999" })
|
||||
@Min(0, { message: "Property p_shipaddrid must be at least 0 or more" })
|
||||
@Max(999999999, {
|
||||
message: 'Property p_shipaddrid must not exceed 999999999',
|
||||
})
|
||||
@Min(0, { message: 'Property p_shipaddrid must be at least 0 or more' })
|
||||
@IsInt()
|
||||
@IsNumber({}, { message: "Property p_shipaddrid must be a number" })
|
||||
@IsNumber({}, { message: 'Property p_shipaddrid must be a number' })
|
||||
@IsOptional()
|
||||
p_shipaddrid?: number;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Length(0, 1, { message: "Property p_formofsecurity must be between 0 to 1 characters" })
|
||||
@Length(0, 1, {
|
||||
message: 'Property p_formofsecurity must be between 0 to 1 characters',
|
||||
})
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
p_formofsecurity?: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Length(0, 10, { message: "Property p_insprotection must be between 0 to 10 characters" })
|
||||
@Length(0, 10, {
|
||||
message: 'Property p_insprotection must be between 0 to 10 characters',
|
||||
})
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
p_insprotection?: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Length(0, 10, { message: "Property p_ldiprotection must be between 0 to 10 characters" })
|
||||
@Length(0, 10, {
|
||||
message: 'Property p_ldiprotection must be between 0 to 10 characters',
|
||||
})
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
p_ldiprotection?: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Length(0, 10, { message: "Property p_deliverytype must be between 0 to 10 characters" })
|
||||
@Length(0, 10, {
|
||||
message: 'Property p_deliverytype must be between 0 to 10 characters',
|
||||
})
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
p_deliverytype?: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Length(0, 10, { message: "Property p_deliverymethod must be between 0 to 10 characters" })
|
||||
@Length(0, 10, {
|
||||
message: 'Property p_deliverymethod must be between 0 to 10 characters',
|
||||
})
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
p_deliverymethod?: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Length(0, 10, { message: "Property p_paymentmethod must be between 0 to 10 characters" })
|
||||
@Length(0, 10, {
|
||||
message: 'Property p_paymentmethod must be between 0 to 10 characters',
|
||||
})
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
p_paymentmethod?: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Length(0, 20, { message: "Property p_custcourierno must be between 0 to 20 characters" })
|
||||
@Length(0, 20, {
|
||||
message: 'Property p_custcourierno must be between 0 to 20 characters',
|
||||
})
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
p_custcourierno?: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Length(0, 20, { message: "Property p_refno must be between 0 to 20 characters" })
|
||||
@Length(0, 20, {
|
||||
message: 'Property p_refno must be between 0 to 20 characters',
|
||||
})
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
p_refno?: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Length(0, 2000, { message: "Property p_notes must be between 0 to 2000 characters" })
|
||||
@Length(0, 2000, {
|
||||
message: 'Property p_notes must be between 0 to 2000 characters',
|
||||
})
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
p_notes?: string;
|
||||
@ -248,46 +312,52 @@ export class SaveCarnetApplicationDTO {
|
||||
|
||||
export class TransmitApplicationtoProcessDTO {
|
||||
@ApiProperty({ required: true })
|
||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
||||
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||
@IsInt()
|
||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
||||
@IsDefined({message:"Property p_spid is required"})
|
||||
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||
@IsDefined({ message: 'Property p_spid is required' })
|
||||
p_spid: number;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 50, { message: "Property p_userid must be between 0 to 50 characters" })
|
||||
@Length(0, 50, {
|
||||
message: 'Property p_userid must be between 0 to 50 characters',
|
||||
})
|
||||
@IsString()
|
||||
@IsDefined({message:"Property p_userid is required"})
|
||||
@IsDefined({ message: 'Property p_userid is required' })
|
||||
p_userid: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
||||
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||
@IsInt()
|
||||
@IsNumber({}, { message: "Property p_headerid must be a number" })
|
||||
@IsDefined({message:"Property p_headerid is required"})
|
||||
@IsNumber({}, { message: 'Property p_headerid must be a number' })
|
||||
@IsDefined({ message: 'Property p_headerid is required' })
|
||||
p_headerid: number;
|
||||
}
|
||||
|
||||
export class GetCarnetDetailsbyCarnetStatusDTO {
|
||||
@ApiProperty({ required: true })
|
||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
||||
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||
@IsInt()
|
||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
||||
@IsDefined({message:"Property p_spid is required"})
|
||||
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||
@IsDefined({ message: 'Property p_spid is required' })
|
||||
p_spid: number;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 50, { message: "Property p_userid must be between 0 to 50 characters" })
|
||||
@IsString({ message: "Property p_userid must be string" })
|
||||
@IsDefined({message:"Property p_userid is required"})
|
||||
@Length(0, 50, {
|
||||
message: 'Property p_userid must be between 0 to 50 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_userid must be string' })
|
||||
@IsDefined({ message: 'Property p_userid is required' })
|
||||
p_userid: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 20, { message: "Property p_CarnetStatus must be between 0 to 20 characters" })
|
||||
@Length(0, 20, {
|
||||
message: 'Property p_CarnetStatus must be between 0 to 20 characters',
|
||||
})
|
||||
@IsString()
|
||||
@IsDefined({message:"Property p_CarnetStatus is required"})
|
||||
@IsDefined({ message: 'Property p_CarnetStatus is required' })
|
||||
p_CarnetStatus: string;
|
||||
}
|
||||
@ -4,8 +4,8 @@ import { HomePageController } from './home-page.controller';
|
||||
import { DbModule } from 'src/db/db.module';
|
||||
|
||||
@Module({
|
||||
imports:[DbModule],
|
||||
providers: [ HomePageService],
|
||||
controllers: [HomePageController]
|
||||
imports: [DbModule],
|
||||
providers: [HomePageService],
|
||||
controllers: [HomePageController],
|
||||
})
|
||||
export class HomePageModule {}
|
||||
|
||||
@ -1,23 +1,21 @@
|
||||
import { Injectable } from "@nestjs/common";
|
||||
import { OracleDBService } from "src/db/db.service";
|
||||
import * as oracledb from 'oracledb'
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { OracleDBService } from 'src/db/db.service';
|
||||
import * as oracledb from 'oracledb';
|
||||
import {
|
||||
p_gltableDTO,
|
||||
p_countrytableDTO,
|
||||
SaveCarnetApplicationDTO,
|
||||
TransmitApplicationtoProcessDTO,
|
||||
GetCarnetDetailsbyCarnetStatusDTO,
|
||||
} from "./home-page.dto";
|
||||
} from './home-page.dto';
|
||||
|
||||
@Injectable()
|
||||
export class HomePageService {
|
||||
|
||||
constructor(private readonly oracleDBService: OracleDBService) { }
|
||||
constructor(private readonly oracleDBService: OracleDBService) {}
|
||||
|
||||
async GetHomePageData(P_spid: number) {
|
||||
let connection;
|
||||
let p_basic_details = [];
|
||||
let p_contacts = []
|
||||
let p_contacts = [];
|
||||
let p_sequence = [];
|
||||
let p_fees_comm = [];
|
||||
let p_bf_fee = [];
|
||||
@ -29,9 +27,9 @@ export class HomePageService {
|
||||
let p_region = [];
|
||||
|
||||
try {
|
||||
connection = await this.oracleDBService.getConnection()
|
||||
connection = await this.oracleDBService.getConnection();
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
throw new Error('No DB Connected');
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
@ -58,52 +56,52 @@ export class HomePageService {
|
||||
},
|
||||
p_basic_details_cur: {
|
||||
type: oracledb.CURSOR,
|
||||
dir: oracledb.BIND_OUT
|
||||
dir: oracledb.BIND_OUT,
|
||||
},
|
||||
p_contacts_cur: {
|
||||
type: oracledb.CURSOR,
|
||||
dir: oracledb.BIND_OUT
|
||||
dir: oracledb.BIND_OUT,
|
||||
},
|
||||
p_sequence_cur: {
|
||||
type: oracledb.CURSOR,
|
||||
dir: oracledb.BIND_OUT
|
||||
dir: oracledb.BIND_OUT,
|
||||
},
|
||||
p_fees_comm_cur: {
|
||||
type: oracledb.CURSOR,
|
||||
dir: oracledb.BIND_OUT
|
||||
dir: oracledb.BIND_OUT,
|
||||
},
|
||||
p_bf_fee_cur: {
|
||||
type: oracledb.CURSOR,
|
||||
dir: oracledb.BIND_OUT
|
||||
dir: oracledb.BIND_OUT,
|
||||
},
|
||||
p_cf_Fee_cur: {
|
||||
type: oracledb.CURSOR,
|
||||
dir: oracledb.BIND_OUT
|
||||
dir: oracledb.BIND_OUT,
|
||||
},
|
||||
p_cont_sheet_fee_cur: {
|
||||
type: oracledb.CURSOR,
|
||||
dir: oracledb.BIND_OUT
|
||||
dir: oracledb.BIND_OUT,
|
||||
},
|
||||
p_ef_fee_cur: {
|
||||
type: oracledb.CURSOR,
|
||||
dir: oracledb.BIND_OUT
|
||||
dir: oracledb.BIND_OUT,
|
||||
},
|
||||
p_security_deposit_cur: {
|
||||
type: oracledb.CURSOR,
|
||||
dir: oracledb.BIND_OUT
|
||||
dir: oracledb.BIND_OUT,
|
||||
},
|
||||
p_param_cur: {
|
||||
type: oracledb.CURSOR,
|
||||
dir: oracledb.BIND_OUT
|
||||
dir: oracledb.BIND_OUT,
|
||||
},
|
||||
p_region_cur: {
|
||||
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) {
|
||||
@ -115,7 +113,6 @@ export class HomePageService {
|
||||
p_basic_details = p_basic_details.concat(rowsBatch);
|
||||
} while (rowsBatch.length > 0);
|
||||
|
||||
|
||||
await cursor.close();
|
||||
}
|
||||
|
||||
@ -128,7 +125,6 @@ export class HomePageService {
|
||||
p_contacts = p_contacts.concat(rowsBatch);
|
||||
} while (rowsBatch.length > 0);
|
||||
|
||||
|
||||
await cursor.close();
|
||||
}
|
||||
|
||||
@ -141,7 +137,6 @@ export class HomePageService {
|
||||
p_sequence = p_sequence.concat(rowsBatch);
|
||||
} while (rowsBatch.length > 0);
|
||||
|
||||
|
||||
await cursor.close();
|
||||
}
|
||||
|
||||
@ -154,7 +149,6 @@ export class HomePageService {
|
||||
p_fees_comm = p_fees_comm.concat(rowsBatch);
|
||||
} while (rowsBatch.length > 0);
|
||||
|
||||
|
||||
await cursor.close();
|
||||
}
|
||||
|
||||
@ -167,7 +161,6 @@ export class HomePageService {
|
||||
p_bf_fee = p_bf_fee.concat(rowsBatch);
|
||||
} while (rowsBatch.length > 0);
|
||||
|
||||
|
||||
await cursor.close();
|
||||
}
|
||||
|
||||
@ -180,7 +173,6 @@ export class HomePageService {
|
||||
p_cf_Fee = p_cf_Fee.concat(rowsBatch);
|
||||
} while (rowsBatch.length > 0);
|
||||
|
||||
|
||||
await cursor.close();
|
||||
}
|
||||
|
||||
@ -193,7 +185,6 @@ export class HomePageService {
|
||||
p_cont_sheet_fee = p_cont_sheet_fee.concat(rowsBatch);
|
||||
} while (rowsBatch.length > 0);
|
||||
|
||||
|
||||
await cursor.close();
|
||||
}
|
||||
|
||||
@ -206,7 +197,6 @@ export class HomePageService {
|
||||
p_ef_fee = p_ef_fee.concat(rowsBatch);
|
||||
} while (rowsBatch.length > 0);
|
||||
|
||||
|
||||
await cursor.close();
|
||||
}
|
||||
|
||||
@ -219,7 +209,6 @@ export class HomePageService {
|
||||
p_security_deposit = p_security_deposit.concat(rowsBatch);
|
||||
} while (rowsBatch.length > 0);
|
||||
|
||||
|
||||
await cursor.close();
|
||||
}
|
||||
|
||||
@ -232,7 +221,6 @@ export class HomePageService {
|
||||
p_param = p_param.concat(rowsBatch);
|
||||
} while (rowsBatch.length > 0);
|
||||
|
||||
|
||||
await cursor.close();
|
||||
}
|
||||
|
||||
@ -245,15 +233,12 @@ export class HomePageService {
|
||||
p_region = p_region.concat(rowsBatch);
|
||||
} while (rowsBatch.length > 0);
|
||||
|
||||
|
||||
await cursor.close();
|
||||
}
|
||||
|
||||
else {
|
||||
} else {
|
||||
throw new Error('No cursor returned from the stored procedure');
|
||||
}
|
||||
|
||||
let tableData = {
|
||||
const tableData = {
|
||||
p_basic_details,
|
||||
p_contacts,
|
||||
p_sequence,
|
||||
@ -267,16 +252,17 @@ export class HomePageService {
|
||||
p_region,
|
||||
};
|
||||
|
||||
let output = {}
|
||||
const output = {};
|
||||
|
||||
for (const key in tableData) {
|
||||
// console.log(key);
|
||||
|
||||
output[key] = tableData[key].map(obj => {
|
||||
output[key] = tableData[key].map((obj) => {
|
||||
const newObj = { ...obj };
|
||||
for (const innerKey in obj) {
|
||||
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
|
||||
newObj[newKey] = obj[innerKey]; // Add the new key
|
||||
delete newObj[innerKey]; // Remove the old key
|
||||
@ -288,22 +274,22 @@ export class HomePageService {
|
||||
}
|
||||
|
||||
return output;
|
||||
|
||||
} catch (err) {
|
||||
|
||||
return { error: err.message }
|
||||
} finally { }
|
||||
if (err instanceof Error) {
|
||||
return { error: err.message };
|
||||
} else {
|
||||
return { error: 'An unknown error occurred' };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async GetCarnetSummaryData(p_emailaddr: string) {
|
||||
|
||||
let connection;
|
||||
let rows: any = [];
|
||||
try {
|
||||
|
||||
connection = await this.oracleDBService.getConnection()
|
||||
connection = await this.oracleDBService.getConnection();
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
throw new Error('No DB Connected');
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
@ -317,12 +303,12 @@ export class HomePageService {
|
||||
},
|
||||
p_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) {
|
||||
@ -334,20 +320,19 @@ export class HomePageService {
|
||||
rows = rows.concat(rowsBatch);
|
||||
} while (rowsBatch.length > 0);
|
||||
|
||||
|
||||
await cursor.close();
|
||||
} else {
|
||||
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
|
||||
let newObj = {};
|
||||
const newObj = {};
|
||||
|
||||
// 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
|
||||
let newKey = key.replace(/ /g, "_");
|
||||
const newKey = key.replace(/ /g, '_');
|
||||
newObj[newKey] = obj[key];
|
||||
}
|
||||
|
||||
@ -356,19 +341,23 @@ export class HomePageService {
|
||||
|
||||
rows = rows.reduce((acc, curr) => {
|
||||
// Find if the current item already exists in the accumulator
|
||||
let existing = acc.find(item => item["Service_Provider_Name"] === curr["Service_Provider_Name"] && item.SPID === curr.SPID);
|
||||
const existing = acc.find(
|
||||
(item) =>
|
||||
item['Service_Provider_Name'] === curr['Service_Provider_Name'] &&
|
||||
item.SPID === curr.SPID,
|
||||
);
|
||||
|
||||
if (existing) {
|
||||
// If it exists, push the current "cs" and "c c" values into the arrays
|
||||
existing.CARNETSTATUS.push(curr.CARNETSTATUS);
|
||||
existing["Carnet_Count"].push(curr["Carnet_Count"]);
|
||||
existing['Carnet_Count'].push(curr['Carnet_Count']);
|
||||
} else {
|
||||
// If it doesn't exist, create a new entry
|
||||
acc.push({
|
||||
"Service_Provider_Name": curr["Service_Provider_Name"],
|
||||
Service_Provider_Name: curr['Service_Provider_Name'],
|
||||
SPID: curr.SPID,
|
||||
CARNETSTATUS: [curr.CARNETSTATUS],
|
||||
"Carnet_Count": [curr["Carnet_Count"]]
|
||||
Carnet_Count: [curr['Carnet_Count']],
|
||||
});
|
||||
}
|
||||
|
||||
@ -376,48 +365,48 @@ export class HomePageService {
|
||||
}, []);
|
||||
|
||||
return rows;
|
||||
|
||||
} catch (err) {
|
||||
|
||||
return { error: err.message }
|
||||
} finally { }
|
||||
|
||||
if (err instanceof Error) {
|
||||
return { error: err.message };
|
||||
} else {
|
||||
return { error: 'An unknown error occurred' };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 = {
|
||||
"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));
|
||||
const reqBody = JSON.parse(JSON.stringify(body));
|
||||
|
||||
function setEmptyStringsToNull(obj) {
|
||||
Object.keys(obj).forEach(key => {
|
||||
Object.keys(obj).forEach((key) => {
|
||||
if (typeof obj[key] === 'object' && obj[key] !== null) {
|
||||
setEmptyStringsToNull(obj[key]);
|
||||
} else if (obj[key] === "") {
|
||||
} else if (obj[key] === '') {
|
||||
obj[key] = null;
|
||||
}
|
||||
});
|
||||
@ -430,17 +419,25 @@ export class HomePageService {
|
||||
let connection;
|
||||
let rows = [];
|
||||
try {
|
||||
|
||||
connection = await this.oracleDBService.getConnection()
|
||||
connection = await this.oracleDBService.getConnection();
|
||||
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`);
|
||||
|
||||
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(
|
||||
`SELECT CARNETSYS.GLARRAY(:itemNo, :itemDescription, :itemValue, :noOfPieces, :itemWeight, :itemWeightUOM, :goodsOriginCountry) FROM dual`,
|
||||
{
|
||||
@ -450,31 +447,37 @@ export class HomePageService {
|
||||
noOfPieces,
|
||||
itemWeight,
|
||||
itemWeightUOM,
|
||||
goodsOriginCountry
|
||||
}
|
||||
goodsOriginCountry,
|
||||
},
|
||||
);
|
||||
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(
|
||||
`SELECT CARNETSYS.CARNETCOUNTRYARRAY(:visitTransitInd, :countryCode, :noOfTimesEntLeave) FROM dual`,
|
||||
{
|
||||
visitTransitInd,
|
||||
countryCode,
|
||||
noOfTimesEntLeave
|
||||
}
|
||||
noOfTimesEntLeave,
|
||||
},
|
||||
);
|
||||
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 GLARRAY = await connection.getDbObjectClass('CARNETSYS.GLARRAY');
|
||||
const GLTABLE = await connection.getDbObjectClass('CARNETSYS.GLTABLE');
|
||||
// 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
|
||||
if (typeof GLTABLE !== 'function') {
|
||||
@ -485,16 +488,40 @@ export class HomePageService {
|
||||
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) => {
|
||||
return await createGLArrayInstance(connection, x.ItemNo, x.ItemDescription, x.ItemValue, x.Noofpieces, x.ItemWeight, x.ItemWeightUOM, x.GoodsOriginCountry);
|
||||
})) : [];
|
||||
const GLTABLE_ARRAY = finalBody.p_gltable
|
||||
? 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) => {
|
||||
return await createCarnetCountryArrayInstance(connection, x.VisitTransitInd, x.CountryCode, x.NoOfTimesEntLeave);
|
||||
})) : [];
|
||||
const CARNETCOUNTRYTABLE_ARRAY = finalBody.p_countrytable
|
||||
? 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 CARNETCOUNTRYTABLE_INSTANCE = new CARNETCOUNTRYTABLE(CARNETCOUNTRYTABLE_ARRAY);
|
||||
const CARNETCOUNTRYTABLE_INSTANCE = new CARNETCOUNTRYTABLE(
|
||||
CARNETCOUNTRYTABLE_ARRAY,
|
||||
);
|
||||
|
||||
const result = await connection.execute(
|
||||
`BEGIN
|
||||
@ -532,120 +559,129 @@ export class HomePageService {
|
||||
{
|
||||
p_spid: {
|
||||
val: finalBody.p_spid ? finalBody.p_spid : null,
|
||||
type: oracledb.DB_TYPE_NUMBER
|
||||
type: oracledb.DB_TYPE_NUMBER,
|
||||
},
|
||||
p_clientid: {
|
||||
val: finalBody.p_clientid ? finalBody.p_clientid : null,
|
||||
type: oracledb.DB_TYPE_NUMBER
|
||||
type: oracledb.DB_TYPE_NUMBER,
|
||||
},
|
||||
p_locationid: {
|
||||
val: finalBody.p_locationid ? finalBody.p_locationid : null,
|
||||
type: oracledb.DB_TYPE_NUMBER
|
||||
type: oracledb.DB_TYPE_NUMBER,
|
||||
},
|
||||
p_userid: {
|
||||
val: finalBody.p_userid ? finalBody.p_userid : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_headerid: {
|
||||
val: finalBody.p_headerid ? finalBody.p_headerid : null,
|
||||
type: oracledb.DB_TYPE_NUMBER
|
||||
type: oracledb.DB_TYPE_NUMBER,
|
||||
},
|
||||
p_applicationname: {
|
||||
val: finalBody.p_applicationname ? finalBody.p_applicationname : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
val: finalBody.p_applicationname
|
||||
? finalBody.p_applicationname
|
||||
: null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_holderid: {
|
||||
val: finalBody.p_holderid ? finalBody.p_holderid : null,
|
||||
type: oracledb.DB_TYPE_NUMBER
|
||||
type: oracledb.DB_TYPE_NUMBER,
|
||||
},
|
||||
p_commercialsampleflag: {
|
||||
val: finalBody.p_commercialsampleflag ? finalBody.p_commercialsampleflag : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
val: finalBody.p_commercialsampleflag
|
||||
? finalBody.p_commercialsampleflag
|
||||
: null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_profequipmentflag: {
|
||||
val: finalBody.p_profequipmentflag ? finalBody.p_profequipmentflag : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
val: finalBody.p_profequipmentflag
|
||||
? finalBody.p_profequipmentflag
|
||||
: null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_exhibitionsfairflag: {
|
||||
val: finalBody.p_exhibitionsfairflag ? finalBody.p_exhibitionsfairflag : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
val: finalBody.p_exhibitionsfairflag
|
||||
? finalBody.p_exhibitionsfairflag
|
||||
: null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_autoflag: {
|
||||
val: finalBody.p_autoflag ? finalBody.p_autoflag : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_horseflag: {
|
||||
val: finalBody.p_horseflag ? finalBody.p_horseflag : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_authrep: {
|
||||
val: finalBody.p_authrep ? finalBody.p_authrep : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_gltable: {
|
||||
val: GLTABLE_INSTANCE,
|
||||
type: oracledb.DB_TYPE_OBJECT
|
||||
type: oracledb.DB_TYPE_OBJECT,
|
||||
},
|
||||
p_ussets: {
|
||||
val: finalBody.p_ussets ? finalBody.p_ussets : null,
|
||||
type: oracledb.DB_TYPE_NUMBER
|
||||
type: oracledb.DB_TYPE_NUMBER,
|
||||
},
|
||||
p_countrytable: {
|
||||
val: CARNETCOUNTRYTABLE_INSTANCE,
|
||||
type: oracledb.DB_TYPE_OBJECT
|
||||
type: oracledb.DB_TYPE_OBJECT,
|
||||
},
|
||||
p_shiptotype: {
|
||||
val: finalBody.p_shiptotype ? finalBody.p_shiptotype : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_shipaddrid: {
|
||||
val: finalBody.p_shipaddrid ? finalBody.p_shipaddrid : null,
|
||||
type: oracledb.DB_TYPE_NUMBER
|
||||
type: oracledb.DB_TYPE_NUMBER,
|
||||
},
|
||||
p_formofsecurity: {
|
||||
val: finalBody.p_formofsecurity ? finalBody.p_formofsecurity : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_insprotection: {
|
||||
val: finalBody.p_insprotection ? finalBody.p_insprotection : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_ldiprotection: {
|
||||
val: finalBody.p_ldiprotection ? finalBody.p_ldiprotection : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_deliverytype: {
|
||||
val: finalBody.p_deliverytype ? finalBody.p_deliverytype : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_deliverymethod: {
|
||||
val: finalBody.p_deliverymethod ? finalBody.p_deliverymethod : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_paymentmethod: {
|
||||
val: finalBody.p_paymentmethod ? finalBody.p_paymentmethod : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_custcourierno: {
|
||||
val: finalBody.p_custcourierno ? finalBody.p_custcourierno : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_refno: {
|
||||
val: finalBody.p_refno ? finalBody.p_refno : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_notes: {
|
||||
val: finalBody.p_notes ? finalBody.p_notes : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
|
||||
P_cursor: {
|
||||
type: oracledb.CURSOR,
|
||||
dir: oracledb.BIND_OUT
|
||||
}
|
||||
}, {
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
||||
}
|
||||
dir: oracledb.BIND_OUT,
|
||||
},
|
||||
},
|
||||
{
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||
},
|
||||
);
|
||||
await connection.commit();
|
||||
|
||||
@ -658,29 +694,28 @@ export class HomePageService {
|
||||
rows = rows.concat(rowsBatch);
|
||||
} while (rowsBatch.length > 0);
|
||||
|
||||
|
||||
await cursor.close();
|
||||
} else {
|
||||
throw new Error('No cursor returned from the stored procedure');
|
||||
}
|
||||
|
||||
return rows;
|
||||
|
||||
} catch (err) {
|
||||
|
||||
return { error: err.message }
|
||||
} finally { }
|
||||
if (err instanceof Error) {
|
||||
return { error: err.message };
|
||||
} else {
|
||||
return { error: 'An unknown error occurred' };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async TransmitApplicationtoProcess(body: TransmitApplicationtoProcessDTO) {
|
||||
|
||||
let connection;
|
||||
let rows = [];
|
||||
try {
|
||||
|
||||
connection = await this.oracleDBService.getConnection()
|
||||
connection = await this.oracleDBService.getConnection();
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
throw new Error('No DB Connected');
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
@ -695,23 +730,24 @@ export class HomePageService {
|
||||
{
|
||||
p_spid: {
|
||||
val: body.p_spid,
|
||||
type: oracledb.DB_TYPE_NUMBER
|
||||
type: oracledb.DB_TYPE_NUMBER,
|
||||
},
|
||||
p_userid: {
|
||||
val: body.p_userid,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_headerid: {
|
||||
val: body.p_headerid,
|
||||
type: oracledb.DB_TYPE_NUMBER
|
||||
type: oracledb.DB_TYPE_NUMBER,
|
||||
},
|
||||
P_cursor: {
|
||||
type: oracledb.CURSOR,
|
||||
dir: oracledb.BIND_OUT
|
||||
}
|
||||
}, {
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
||||
}
|
||||
dir: oracledb.BIND_OUT,
|
||||
},
|
||||
},
|
||||
{
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||
},
|
||||
);
|
||||
await connection.commit();
|
||||
|
||||
@ -724,7 +760,6 @@ export class HomePageService {
|
||||
rows = rows.concat(rowsBatch);
|
||||
} while (rowsBatch.length > 0);
|
||||
|
||||
|
||||
await cursor.close();
|
||||
} else {
|
||||
throw new Error('No cursor returned from the stored procedure');
|
||||
@ -733,23 +768,24 @@ export class HomePageService {
|
||||
return rows;
|
||||
|
||||
// return fres
|
||||
|
||||
} catch (err) {
|
||||
|
||||
return { error: err.message }
|
||||
} finally { }
|
||||
|
||||
|
||||
if (err instanceof Error) {
|
||||
return { error: err.message };
|
||||
} else {
|
||||
return { error: 'An unknown error occurred' };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async GetCarnetDetailsbyCarnetStatus(body: GetCarnetDetailsbyCarnetStatusDTO) {
|
||||
async GetCarnetDetailsbyCarnetStatus(
|
||||
body: GetCarnetDetailsbyCarnetStatusDTO,
|
||||
) {
|
||||
let connection;
|
||||
let rows: any = [];
|
||||
try {
|
||||
|
||||
connection = await this.oracleDBService.getConnection()
|
||||
connection = await this.oracleDBService.getConnection();
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
throw new Error('No DB Connected');
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
@ -771,12 +807,12 @@ export class HomePageService {
|
||||
},
|
||||
P_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) {
|
||||
@ -788,17 +824,18 @@ export class HomePageService {
|
||||
rows = rows.concat(rowsBatch);
|
||||
} while (rowsBatch.length > 0);
|
||||
|
||||
|
||||
await cursor.close();
|
||||
} else {
|
||||
throw new Error('No cursor returned from the stored procedure');
|
||||
}
|
||||
|
||||
return rows;
|
||||
|
||||
} catch (err) {
|
||||
|
||||
return { error: err.message }
|
||||
} finally { }
|
||||
if (err instanceof Error) {
|
||||
return { error: err.message };
|
||||
} else {
|
||||
return { error: 'An unknown error occurred' };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,70 +1,84 @@
|
||||
import { Body, Controller, Get, Post, Put, Query } from '@nestjs/common';
|
||||
import { ManageClientsService } from './manage-clients.service';
|
||||
import { CreateAdditionalClientContactsDTO, CreateAdditionalClientLocationsDTO, CreateClientDataDTO, GetPreparerByClientidContactsByClientidLocByClientidDTO, GetPreparersDTO, UpdateClientContactsDTO, UpdateClientDTO, UpdateClientLocationsDTO } from './manage-clients.dto';
|
||||
import {
|
||||
CreateAdditionalClientContactsDTO,
|
||||
CreateAdditionalClientLocationsDTO,
|
||||
CreateClientDataDTO,
|
||||
GetPreparerByClientidContactsByClientidLocByClientidDTO,
|
||||
GetPreparersDTO,
|
||||
UpdateClientContactsDTO,
|
||||
UpdateClientDTO,
|
||||
UpdateClientLocationsDTO,
|
||||
} from './manage-clients.dto';
|
||||
import { ApiTags } from '@nestjs/swagger';
|
||||
|
||||
@Controller('oracle')
|
||||
export class ManageClientsController {
|
||||
|
||||
constructor(private readonly manageClientsService:ManageClientsService){}
|
||||
constructor(private readonly manageClientsService: ManageClientsService) {}
|
||||
|
||||
@ApiTags('Manage Clients - Oracle')
|
||||
@Post('CreateNewClients')
|
||||
async CreateClientData(@Body() body:CreateClientDataDTO){
|
||||
async CreateClientData(@Body() body: CreateClientDataDTO) {
|
||||
return this.manageClientsService.CreateClientData(body);
|
||||
}
|
||||
|
||||
@ApiTags('Manage Clients - Oracle')
|
||||
@Put('UpdateClient')
|
||||
async UpdateClient(@Body() body:UpdateClientDTO){
|
||||
async UpdateClient(@Body() body: UpdateClientDTO) {
|
||||
return this.manageClientsService.UpdateClient(body);
|
||||
}
|
||||
|
||||
@ApiTags('Manage Clients - Oracle')
|
||||
@Put('UpdateClientContacts')
|
||||
UpdateClientContacts(@Body() body:UpdateClientContactsDTO){
|
||||
UpdateClientContacts(@Body() body: UpdateClientContactsDTO) {
|
||||
return this.manageClientsService.UpdateClientContacts(body);
|
||||
}
|
||||
|
||||
@ApiTags('Manage Clients - Oracle')
|
||||
@Put('UpdateClientLocations')
|
||||
UpdateClientLocations(@Body() body:UpdateClientLocationsDTO){
|
||||
UpdateClientLocations(@Body() body: UpdateClientLocationsDTO) {
|
||||
return this.manageClientsService.UpdateClientLocations(body);
|
||||
}
|
||||
|
||||
@ApiTags('Manage Clients - Oracle')
|
||||
@Post('CreateAdditionalClientContacts')
|
||||
CreateClientContact(@Body() body:CreateAdditionalClientContactsDTO){
|
||||
CreateClientContact(@Body() body: CreateAdditionalClientContactsDTO) {
|
||||
return this.manageClientsService.CreateClientContact(body);
|
||||
}
|
||||
|
||||
@ApiTags('Manage Clients - Oracle')
|
||||
@Post('CreateAdditionalClientLocations')
|
||||
CreateClientLocation(@Body() body:CreateAdditionalClientLocationsDTO){
|
||||
CreateClientLocation(@Body() body: CreateAdditionalClientLocationsDTO) {
|
||||
return this.manageClientsService.CreateClientLocation(body);
|
||||
}
|
||||
|
||||
@ApiTags('Manage Clients - Oracle')
|
||||
@Get('GetPreparers')
|
||||
async GetPreparers(@Query() query:GetPreparersDTO) {
|
||||
return await this.manageClientsService.GetPreparers(query)
|
||||
async GetPreparers(@Query() query: GetPreparersDTO) {
|
||||
return await this.manageClientsService.GetPreparers(query);
|
||||
}
|
||||
|
||||
@ApiTags('Manage Clients - Oracle')
|
||||
@Get('GetPreparerByClientid')
|
||||
GetPreparerByClientid(@Query() body:GetPreparerByClientidContactsByClientidLocByClientidDTO){
|
||||
GetPreparerByClientid(
|
||||
@Query() body: GetPreparerByClientidContactsByClientidLocByClientidDTO,
|
||||
) {
|
||||
return this.manageClientsService.GetPreparerByClientid(body);
|
||||
}
|
||||
|
||||
@ApiTags('Manage Clients - Oracle')
|
||||
@Get('GetPreparerContactsByClientid')
|
||||
GetPreparerContactsByClientid(@Query() body:GetPreparerByClientidContactsByClientidLocByClientidDTO){
|
||||
GetPreparerContactsByClientid(
|
||||
@Query() body: GetPreparerByClientidContactsByClientidLocByClientidDTO,
|
||||
) {
|
||||
return body;
|
||||
}
|
||||
|
||||
@ApiTags('Manage Clients - Oracle')
|
||||
@Get('GetPreparerLocByClientid')
|
||||
GetPreparerLocByClientid(@Query() body:GetPreparerByClientidContactsByClientidLocByClientidDTO){
|
||||
GetPreparerLocByClientid(
|
||||
@Query() body: GetPreparerByClientidContactsByClientidLocByClientidDTO,
|
||||
) {
|
||||
return body;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,60 +1,81 @@
|
||||
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 { p_contactstableDTO } from '../manage-holders/manage-holders.dto';
|
||||
|
||||
|
||||
export class p_clientlocaddresstableDTO {
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 50, { message: "Property Nameof must be between 0 to 50 characters" })
|
||||
@IsString({ message: "Property Nameof must be a string" })
|
||||
@IsDefined({ message: "Property Nameof is required" })
|
||||
@Length(0, 50, {
|
||||
message: 'Property Nameof must be between 0 to 50 characters',
|
||||
})
|
||||
@IsString({ message: 'Property Nameof must be a string' })
|
||||
@IsDefined({ message: 'Property Nameof is required' })
|
||||
Nameof: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 50, { message: "Property Address1 must be between 0 to 50 characters" })
|
||||
@IsString({ message: "Property Address1 must be a string" })
|
||||
@IsDefined({ message: "Property Address1 is required" })
|
||||
@Length(0, 50, {
|
||||
message: 'Property Address1 must be between 0 to 50 characters',
|
||||
})
|
||||
@IsString({ message: 'Property Address1 must be a string' })
|
||||
@IsDefined({ message: 'Property Address1 is required' })
|
||||
Address1: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Length(0, 50, { message: "Property Address2 must be between 0 to 50 characters" })
|
||||
@IsString({ message: "Property Address2 must be a string" })
|
||||
@Length(0, 50, {
|
||||
message: 'Property Address2 must be between 0 to 50 characters',
|
||||
})
|
||||
@IsString({ message: 'Property Address2 must be a string' })
|
||||
@IsOptional()
|
||||
Address2?: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 30, { message: "Property City must be between 0 to 30 characters" })
|
||||
@IsString({ message: "Property City must be a string" })
|
||||
@IsDefined({ message: "Property City is required" })
|
||||
@Length(0, 30, {
|
||||
message: 'Property City must be between 0 to 30 characters',
|
||||
})
|
||||
@IsString({ message: 'Property City must be a string' })
|
||||
@IsDefined({ message: 'Property City is required' })
|
||||
City: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 2, { message: "Property State must be between 0 to 2 characters" })
|
||||
@IsString({ message: "Property State must be a string" })
|
||||
@IsDefined({ message: "Property State is required" })
|
||||
@Length(0, 2, { message: 'Property State must be between 0 to 2 characters' })
|
||||
@IsString({ message: 'Property State must be a string' })
|
||||
@IsDefined({ message: 'Property State is required' })
|
||||
State: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 10, { message: "Property Zip must be between 0 to 10 characters" })
|
||||
@IsString({ message: "Property Zip must be a string" })
|
||||
@IsDefined({ message: "Property Zip is required" })
|
||||
@Length(0, 10, { message: 'Property Zip must be between 0 to 10 characters' })
|
||||
@IsString({ message: 'Property Zip must be a string' })
|
||||
@IsDefined({ message: 'Property Zip is required' })
|
||||
Zip: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 2, { message: "Property Country must be between 0 to 2 characters" })
|
||||
@IsString({ message: "Property Country must be a string" })
|
||||
@IsDefined({ message: "Property Country is required" })
|
||||
@Length(0, 2, {
|
||||
message: 'Property Country must be between 0 to 2 characters',
|
||||
})
|
||||
@IsString({ message: 'Property Country must be a string' })
|
||||
@IsDefined({ message: 'Property Country is required' })
|
||||
Country: string;
|
||||
}
|
||||
|
||||
export class CreateClientDataDTO {
|
||||
@ApiProperty({ required: true })
|
||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
||||
@IsInt({ message: "Property p_spid allows only whole numbers" })
|
||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
||||
@IsDefined({ message: "Property p_spid is required" })
|
||||
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||
@IsInt({ message: 'Property p_spid allows only whole numbers' })
|
||||
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||
@IsDefined({ message: 'Property p_spid is required' })
|
||||
p_spid: number;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@ -63,427 +84,530 @@ export class CreateClientDataDTO {
|
||||
// @IsInt({ message: "Property p_clientname allows only whole numbers" })
|
||||
// @IsNumber({}, { message: "Property p_clientname must be a number" })
|
||||
// @IsDefined({ message: "Property p_clientname is required" })
|
||||
@Length(0, 50, { message: "Property p_clientname must be between 0 to 50 characters" })
|
||||
@IsString({ message: "Property p_clientname must be a string" })
|
||||
@IsDefined({ message: "Property p_clientname is required" })
|
||||
@Length(0, 50, {
|
||||
message: 'Property p_clientname must be between 0 to 50 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_clientname must be a string' })
|
||||
@IsDefined({ message: 'Property p_clientname is required' })
|
||||
p_clientname: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 20, { message: "Property p_lookupcode must be between 0 to 20 characters" })
|
||||
@IsString({ message: "Property p_lookupcode must be a string" })
|
||||
@IsDefined({ message: "Property p_lookupcode is required" })
|
||||
@Length(0, 20, {
|
||||
message: 'Property p_lookupcode must be between 0 to 20 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_lookupcode must be a string' })
|
||||
@IsDefined({ message: 'Property p_lookupcode is required' })
|
||||
p_lookupcode: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 50, { message: "Property p_address1 must be between 0 to 50 characters" })
|
||||
@IsString({ message: "Property p_address1 must be a string" })
|
||||
@IsDefined({ message: "Property p_address1 is required" })
|
||||
@Length(0, 50, {
|
||||
message: 'Property p_address1 must be between 0 to 50 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_address1 must be a string' })
|
||||
@IsDefined({ message: 'Property p_address1 is required' })
|
||||
p_address1: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Length(0, 50, { message: "Property p_address2 must be between 0 to 50 characters" })
|
||||
@IsString({ message: "Property p_address2 must be a string" })
|
||||
@Length(0, 50, {
|
||||
message: 'Property p_address2 must be between 0 to 50 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_address2 must be a string' })
|
||||
@IsOptional()
|
||||
p_address2?: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 30, { message: "Property p_city must be between 0 to 30 characters" })
|
||||
@IsString({ message: "Property p_city must be a string" })
|
||||
@IsDefined({ message: "Property p_city is required" })
|
||||
@Length(0, 30, {
|
||||
message: 'Property p_city must be between 0 to 30 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_city must be a string' })
|
||||
@IsDefined({ message: 'Property p_city is required' })
|
||||
p_city: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 2, { message: "Property p_state must be between 0 to 2 characters" })
|
||||
@IsString({ message: "Property p_state must be a string" })
|
||||
@IsDefined({ message: "Property p_state is required" })
|
||||
@Length(0, 2, {
|
||||
message: 'Property p_state must be between 0 to 2 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_state must be a string' })
|
||||
@IsDefined({ message: 'Property p_state is required' })
|
||||
p_state: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Length(0, 10, { message: "Property p_zip must be between 0 to 10 characters" })
|
||||
@IsString({ message: "Property p_zip must be a string" })
|
||||
@Length(0, 10, {
|
||||
message: 'Property p_zip must be between 0 to 10 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_zip must be a string' })
|
||||
@IsOptional()
|
||||
p_zip?: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Length(0, 2, { message: "Property p_country must be between 0 to 2 characters" })
|
||||
@IsString({ message: "Property p_country must be a string" })
|
||||
@Length(0, 2, {
|
||||
message: 'Property p_country must be between 0 to 2 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_country must be a string' })
|
||||
@IsOptional()
|
||||
p_country?: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 2, { message: "Property p_issuingregion must be between 0 to 2 characters" })
|
||||
@IsString({ message: "Property p_issuingregion must be a string" })
|
||||
@IsDefined({ message: "Property p_issuingregion is required" })
|
||||
@Length(0, 2, {
|
||||
message: 'Property p_issuingregion must be between 0 to 2 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_issuingregion must be a string' })
|
||||
@IsDefined({ message: 'Property p_issuingregion is required' })
|
||||
p_issuingregion: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 2, { message: "Property p_revenuelocation must be between 0 to 2 characters" })
|
||||
@IsString({ message: "Property p_revenuelocation must be a string" })
|
||||
@IsDefined({ message: "Property p_revenuelocation is required" })
|
||||
@Length(0, 2, {
|
||||
message: 'Property p_revenuelocation must be between 0 to 2 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_revenuelocation must be a string' })
|
||||
@IsDefined({ message: 'Property p_revenuelocation is required' })
|
||||
p_revenuelocation: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 100, { message: "Property p_userid must be between 0 to 100 characters" })
|
||||
@IsString({ message: "Property p_userid must be a string" })
|
||||
@IsDefined({ message: "Property p_userid is required" })
|
||||
@Length(0, 100, {
|
||||
message: 'Property p_userid must be between 0 to 100 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_userid must be a string' })
|
||||
@IsDefined({ message: 'Property p_userid is required' })
|
||||
p_userid: string;
|
||||
|
||||
@ApiProperty({ required: true, type: () => [p_contactstableDTO] })
|
||||
@Type(() => p_contactstableDTO)
|
||||
@ValidateNested({ each: true })
|
||||
@IsArray({ message: "Property p_contactstable allows only array type" })
|
||||
@IsDefined({ message: "Property p_contactstable is required" })
|
||||
@IsArray({ message: 'Property p_contactstable allows only array type' })
|
||||
@IsDefined({ message: 'Property p_contactstable is required' })
|
||||
p_contactstable: p_contactstableDTO[];
|
||||
|
||||
@ApiProperty({ required: true, type: () => [p_clientlocaddresstableDTO] })
|
||||
@Type(() => p_clientlocaddresstableDTO)
|
||||
@ValidateNested({ each: true })
|
||||
@IsArray({ message: "Property p_clientlocaddresstable allows only array type" })
|
||||
@IsDefined({ message: "Property p_clientlocaddresstable is required" })
|
||||
@IsArray({
|
||||
message: 'Property p_clientlocaddresstable allows only array type',
|
||||
})
|
||||
@IsDefined({ message: 'Property p_clientlocaddresstable is required' })
|
||||
p_clientlocaddresstable: p_clientlocaddresstableDTO[];
|
||||
}
|
||||
|
||||
export class UpdateClientDTO {
|
||||
@ApiProperty({ required: true })
|
||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
||||
@IsInt({ message: "Property p_spid allows only whole numbers" })
|
||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
||||
@IsDefined({ message: "Property p_spid is required" })
|
||||
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||
@IsInt({ message: 'Property p_spid allows only whole numbers' })
|
||||
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||
@IsDefined({ message: 'Property p_spid is required' })
|
||||
p_spid: number;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Max(999999999, { message: "Property p_clientid must not exceed 999999999" })
|
||||
@Min(0, { message: "Property p_clientid must be at least 0 or more" })
|
||||
@IsInt({ message: "Property p_clientid allows only whole numbers" })
|
||||
@IsNumber({}, { message: "Property p_clientid must be a number" })
|
||||
@IsDefined({ message: "Property p_clientid is required" })
|
||||
@Max(999999999, { message: 'Property p_clientid must not exceed 999999999' })
|
||||
@Min(0, { message: 'Property p_clientid must be at least 0 or more' })
|
||||
@IsInt({ message: 'Property p_clientid allows only whole numbers' })
|
||||
@IsNumber({}, { message: 'Property p_clientid must be a number' })
|
||||
@IsDefined({ message: 'Property p_clientid is required' })
|
||||
p_clientid: number;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 50, { message: "Property p_preparername must be between 0 to 50 characters" })
|
||||
@IsString({ message: "Property p_preparername must be a string" })
|
||||
@IsDefined({ message: "Property p_preparername is required" })
|
||||
@Length(0, 50, {
|
||||
message: 'Property p_preparername must be between 0 to 50 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_preparername must be a string' })
|
||||
@IsDefined({ message: 'Property p_preparername is required' })
|
||||
p_preparername: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 50, { message: "Property p_address1 must be between 0 to 50 characters" })
|
||||
@IsString({ message: "Property p_address1 must be a string" })
|
||||
@IsDefined({ message: "Property p_address1 is required" })
|
||||
@Length(0, 50, {
|
||||
message: 'Property p_address1 must be between 0 to 50 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_address1 must be a string' })
|
||||
@IsDefined({ message: 'Property p_address1 is required' })
|
||||
p_address1: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Length(0, 50, { message: "Property p_address2 must be between 0 to 50 characters" })
|
||||
@IsString({ message: "Property p_address2 must be a string" })
|
||||
@Length(0, 50, {
|
||||
message: 'Property p_address2 must be between 0 to 50 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_address2 must be a string' })
|
||||
@IsOptional()
|
||||
p_address2?: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 30, { message: "Property p_city must be between 0 to 30 characters" })
|
||||
@IsString({ message: "Property p_city must be a string" })
|
||||
@IsDefined({ message: "Property p_city is required" })
|
||||
@Length(0, 30, {
|
||||
message: 'Property p_city must be between 0 to 30 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_city must be a string' })
|
||||
@IsDefined({ message: 'Property p_city is required' })
|
||||
p_city: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 2, { message: "Property p_state must be between 0 to 2 characters" })
|
||||
@IsString({ message: "Property p_state must be a string" })
|
||||
@IsDefined({ message: "Property p_state is required" })
|
||||
@Length(0, 2, {
|
||||
message: 'Property p_state must be between 0 to 2 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_state must be a string' })
|
||||
@IsDefined({ message: 'Property p_state is required' })
|
||||
p_state: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 10, { message: "Property p_zip must be between 0 to 10 characters" })
|
||||
@IsString({ message: "Property p_zip must be a string" })
|
||||
@IsDefined({ message: "Property p_zip is required" })
|
||||
@Length(0, 10, {
|
||||
message: 'Property p_zip must be between 0 to 10 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_zip must be a string' })
|
||||
@IsDefined({ message: 'Property p_zip is required' })
|
||||
p_zip: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 2, { message: "Property p_country must be between 0 to 2 characters" })
|
||||
@IsString({ message: "Property p_country must be a string" })
|
||||
@IsDefined({ message: "Property p_country is required" })
|
||||
@Length(0, 2, {
|
||||
message: 'Property p_country must be between 0 to 2 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_country must be a string' })
|
||||
@IsDefined({ message: 'Property p_country is required' })
|
||||
p_country: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 2, { message: "Property p_revenuelocation must be between 0 to 2 characters" })
|
||||
@IsString({ message: "Property p_revenuelocation must be a string" })
|
||||
@IsDefined({ message: "Property p_revenuelocation is required" })
|
||||
@Length(0, 2, {
|
||||
message: 'Property p_revenuelocation must be between 0 to 2 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_revenuelocation must be a string' })
|
||||
@IsDefined({ message: 'Property p_revenuelocation is required' })
|
||||
p_revenuelocation: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 100, { message: "Property p_userid must be between 0 to 100 characters" })
|
||||
@IsString({ message: "Property p_userid must be a string" })
|
||||
@IsDefined({ message: "Property p_userid is required" })
|
||||
@Length(0, 100, {
|
||||
message: 'Property p_userid must be between 0 to 100 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_userid must be a string' })
|
||||
@IsDefined({ message: 'Property p_userid is required' })
|
||||
p_userid: string;
|
||||
}
|
||||
|
||||
export class UpdateClientContactsDTO {
|
||||
@ApiProperty({ required: true })
|
||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
||||
@IsInt({ message: "Property p_spid allows only whole numbers" })
|
||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
||||
@IsDefined({ message: "Property p_spid is required" })
|
||||
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||
@IsInt({ message: 'Property p_spid allows only whole numbers' })
|
||||
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||
@IsDefined({ message: 'Property p_spid is required' })
|
||||
p_spid: number;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Max(999999999, { message: "Property p_clientcontactid must not exceed 999999999" })
|
||||
@Min(0, { message: "Property p_clientcontactid must be at least 0 or more" })
|
||||
@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" })
|
||||
@Max(999999999, {
|
||||
message: 'Property p_clientcontactid must not exceed 999999999',
|
||||
})
|
||||
@Min(0, { message: 'Property p_clientcontactid must be at least 0 or more' })
|
||||
@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;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 50, { message: "Property p_firstname must be between 0 to 50 characters" })
|
||||
@IsString({ message: "Property p_firstname must be a string" })
|
||||
@IsDefined({ message: "Property p_firstname is required" })
|
||||
@Length(0, 50, {
|
||||
message: 'Property p_firstname must be between 0 to 50 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_firstname must be a string' })
|
||||
@IsDefined({ message: 'Property p_firstname is required' })
|
||||
p_firstname: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 50, { message: "Property p_lastname must be between 0 to 50 characters" })
|
||||
@IsString({ message: "Property p_lastname must be a string" })
|
||||
@IsDefined({ message: "Property p_lastname is required" })
|
||||
@Length(0, 50, {
|
||||
message: 'Property p_lastname must be between 0 to 50 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_lastname must be a string' })
|
||||
@IsDefined({ message: 'Property p_lastname is required' })
|
||||
p_lastname: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Length(0, 3, { message: "Property p_middleinitial must be between 0 to 3 characters" })
|
||||
@IsString({ message: "Property p_middleinitial must be a string" })
|
||||
@Length(0, 3, {
|
||||
message: 'Property p_middleinitial must be between 0 to 3 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_middleinitial must be a string' })
|
||||
@IsOptional()
|
||||
p_middleinitial?: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Length(0, 50, { message: "Property p_title must be between 0 to 50 characters" })
|
||||
@IsString({ message: "Property p_title must be a string" })
|
||||
@Length(0, 50, {
|
||||
message: 'Property p_title must be between 0 to 50 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_title must be a string' })
|
||||
@IsOptional()
|
||||
p_title?: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 20, { message: "Property p_phone must be between 0 to 20 characters" })
|
||||
@IsString({ message: "Property p_phone must be a string" })
|
||||
@IsDefined({ message: "Property p_phone is required" })
|
||||
@Length(0, 20, {
|
||||
message: 'Property p_phone must be between 0 to 20 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_phone must be a string' })
|
||||
@IsDefined({ message: 'Property p_phone is required' })
|
||||
p_phone: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 20, { message: "Property p_fax must be between 0 to 20 characters" })
|
||||
@IsString({ message: "Property p_fax must be a string" })
|
||||
@IsDefined({ message: "Property p_fax is required" })
|
||||
@Length(0, 20, {
|
||||
message: 'Property p_fax must be between 0 to 20 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_fax must be a string' })
|
||||
@IsDefined({ message: 'Property p_fax is required' })
|
||||
p_fax: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Length(0, 20, { message: "Property p_mobileno must be between 0 to 20 characters" })
|
||||
@IsString({ message: "Property p_mobileno must be a string" })
|
||||
@Length(0, 20, {
|
||||
message: 'Property p_mobileno must be between 0 to 20 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_mobileno must be a string' })
|
||||
@IsOptional()
|
||||
p_mobileno?: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 100, { message: "Property p_emailaddress must be between 0 to 100 characters" })
|
||||
@IsEmail({}, { message: "Property p_emailaddress must be a valid email address" })
|
||||
@IsDefined({ message: "Property p_emailaddress is required" })
|
||||
@Length(0, 100, {
|
||||
message: 'Property p_emailaddress must be between 0 to 100 characters',
|
||||
})
|
||||
@IsEmail(
|
||||
{},
|
||||
{ message: 'Property p_emailaddress must be a valid email address' },
|
||||
)
|
||||
@IsDefined({ message: 'Property p_emailaddress is required' })
|
||||
p_emailaddress: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 100, { message: "Property p_userid must be between 0 to 100 characters" })
|
||||
@IsString({ message: "Property p_userid must be a string" })
|
||||
@IsDefined({ message: "Property p_userid is required" })
|
||||
@Length(0, 100, {
|
||||
message: 'Property p_userid must be between 0 to 100 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_userid must be a string' })
|
||||
@IsDefined({ message: 'Property p_userid is required' })
|
||||
p_userid: string;
|
||||
}
|
||||
|
||||
export class GetPreparersDTO {
|
||||
@ApiProperty({ required: true })
|
||||
@Transform(({ value }) => Number(value))
|
||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
||||
@IsInt({ message: "Property p_spid allows only whole numbers" })
|
||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
||||
@IsDefined({ message: "Property p_spid is required" })
|
||||
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||
@IsInt({ message: 'Property p_spid allows only whole numbers' })
|
||||
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||
@IsDefined({ message: 'Property p_spid is required' })
|
||||
p_spid: number;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Length(0, 50, { message: "Property p_name must be between 0 to 50 characters" })
|
||||
@IsString({ message: "Property p_name must be a string" })
|
||||
@Length(0, 50, {
|
||||
message: 'Property p_name must be between 0 to 50 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_name must be a string' })
|
||||
@IsOptional()
|
||||
p_name?: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Length(0, 30, { message: "Property p_lookupcode must be between 0 to 30 characters" })
|
||||
@IsString({ message: "Property p_lookupcode must be a string" })
|
||||
@Length(0, 30, {
|
||||
message: 'Property p_lookupcode must be between 0 to 30 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_lookupcode must be a string' })
|
||||
@IsOptional()
|
||||
p_lookupcode?: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Length(0, 20, { message: "Property p_city must be between 0 to 20 characters" })
|
||||
@IsString({ message: "Property p_city must be a string" })
|
||||
@Length(0, 20, {
|
||||
message: 'Property p_city must be between 0 to 20 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_city must be a string' })
|
||||
@IsOptional()
|
||||
p_city?: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Length(0, 2, { message: "Property p_state must be between 0 to 2 characters" })
|
||||
@IsString({ message: "Property p_state must be a string" })
|
||||
@Length(0, 2, {
|
||||
message: 'Property p_state must be between 0 to 2 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_state must be a string' })
|
||||
@IsOptional()
|
||||
p_state?: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 10, { message: "Property p_status must be between 0 to 10 characters" })
|
||||
@IsString({ message: "Property p_status must be a string" })
|
||||
@IsDefined({ message: "Property p_status is required" })
|
||||
@Length(0, 10, {
|
||||
message: 'Property p_status must be between 0 to 10 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_status must be a string' })
|
||||
@IsDefined({ message: 'Property p_status is required' })
|
||||
p_status: string;
|
||||
}
|
||||
|
||||
export class UpdateClientLocationsDTO {
|
||||
@ApiProperty({ required: true })
|
||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
||||
@IsInt({ message: "Property p_spid allows only whole numbers" })
|
||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
||||
@IsDefined({ message: "Property p_spid is required" })
|
||||
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||
@IsInt({ message: 'Property p_spid allows only whole numbers' })
|
||||
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||
@IsDefined({ message: 'Property p_spid is required' })
|
||||
p_spid: number;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Max(999999999, { message: "Property p_clientlocationid must not exceed 999999999" })
|
||||
@Min(0, { message: "Property p_clientlocationid must be at least 0 or more" })
|
||||
@IsInt({ message: "Property p_clientlocationid allows only whole numbers" })
|
||||
@IsNumber({}, { message: "Property p_clientlocationid must be a number" })
|
||||
@IsDefined({ message: "Property p_clientlocationid is required" })
|
||||
@Max(999999999, {
|
||||
message: 'Property p_clientlocationid must not exceed 999999999',
|
||||
})
|
||||
@Min(0, { message: 'Property p_clientlocationid must be at least 0 or more' })
|
||||
@IsInt({ message: 'Property p_clientlocationid allows only whole numbers' })
|
||||
@IsNumber({}, { message: 'Property p_clientlocationid must be a number' })
|
||||
@IsDefined({ message: 'Property p_clientlocationid is required' })
|
||||
p_clientlocationid: number;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 50, { message: "Property p_lcoationname must be between 0 to 50 characters" })
|
||||
@IsString({ message: "Property p_lcoationname must be a string" })
|
||||
@IsDefined({ message: "Property p_lcoationname is required" })
|
||||
@Length(0, 50, {
|
||||
message: 'Property p_lcoationname must be between 0 to 50 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_lcoationname must be a string' })
|
||||
@IsDefined({ message: 'Property p_lcoationname is required' })
|
||||
p_lcoationname: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 50, { message: "Property p_address1 must be between 0 to 50 characters" })
|
||||
@IsString({ message: "Property p_address1 must be a string" })
|
||||
@IsDefined({ message: "Property p_address1 is required" })
|
||||
@Length(0, 50, {
|
||||
message: 'Property p_address1 must be between 0 to 50 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_address1 must be a string' })
|
||||
@IsDefined({ message: 'Property p_address1 is required' })
|
||||
p_address1: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Length(0, 50, { message: "Property p_address2 must be between 0 to 50 characters" })
|
||||
@IsString({ message: "Property p_address2 must be a string" })
|
||||
@Length(0, 50, {
|
||||
message: 'Property p_address2 must be between 0 to 50 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_address2 must be a string' })
|
||||
@IsOptional()
|
||||
p_address2?: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Length(0, 30, { message: "Property p_city must be between 0 to 30 characters" })
|
||||
@IsString({ message: "Property p_city must be a string" })
|
||||
@Length(0, 30, {
|
||||
message: 'Property p_city must be between 0 to 30 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_city must be a string' })
|
||||
@IsOptional()
|
||||
p_city?: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 2, { message: "Property p_state must be between 0 to 2 characters" })
|
||||
@IsString({ message: "Property p_state must be a string" })
|
||||
@IsDefined({ message: "Property p_state is required" })
|
||||
@Length(0, 2, {
|
||||
message: 'Property p_state must be between 0 to 2 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_state must be a string' })
|
||||
@IsDefined({ message: 'Property p_state is required' })
|
||||
p_state: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 10, { message: "Property p_zip must be between 0 to 10 characters" })
|
||||
@IsString({ message: "Property p_zip must be a string" })
|
||||
@IsDefined({ message: "Property p_zip is required" })
|
||||
@Length(0, 10, {
|
||||
message: 'Property p_zip must be between 0 to 10 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_zip must be a string' })
|
||||
@IsDefined({ message: 'Property p_zip is required' })
|
||||
p_zip: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 2, { message: "Property p_country must be between 0 to 2 characters" })
|
||||
@IsString({ message: "Property p_country must be a string" })
|
||||
@IsDefined({ message: "Property p_country is required" })
|
||||
@Length(0, 2, {
|
||||
message: 'Property p_country must be between 0 to 2 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_country must be a string' })
|
||||
@IsDefined({ message: 'Property p_country is required' })
|
||||
p_country: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 100, { message: "Property p_userid must be between 0 to 100 characters" })
|
||||
@IsString({ message: "Property p_userid must be a string" })
|
||||
@IsDefined({ message: "Property p_userid is required" })
|
||||
@Length(0, 100, {
|
||||
message: 'Property p_userid must be between 0 to 100 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_userid must be a string' })
|
||||
@IsDefined({ message: 'Property p_userid is required' })
|
||||
p_userid: string;
|
||||
}
|
||||
|
||||
export class CreateAdditionalClientContactsDTO {
|
||||
@ApiProperty({ required: true })
|
||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
||||
@IsInt({ message: "Property p_spid allows only whole numbers" })
|
||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
||||
@IsDefined({ message: "Property p_spid is required" })
|
||||
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||
@IsInt({ message: 'Property p_spid allows only whole numbers' })
|
||||
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||
@IsDefined({ message: 'Property p_spid is required' })
|
||||
p_spid: number;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Max(999999999, { message: "Property p_clientid must not exceed 999999999" })
|
||||
@Min(0, { message: "Property p_clientid must be at least 0 or more" })
|
||||
@IsInt({ message: "Property p_clientid allows only whole numbers" })
|
||||
@IsNumber({}, { message: "Property p_clientid must be a number" })
|
||||
@IsDefined({ message: "Property p_clientid is required" })
|
||||
@Max(999999999, { message: 'Property p_clientid must not exceed 999999999' })
|
||||
@Min(0, { message: 'Property p_clientid must be at least 0 or more' })
|
||||
@IsInt({ message: 'Property p_clientid allows only whole numbers' })
|
||||
@IsNumber({}, { message: 'Property p_clientid must be a number' })
|
||||
@IsDefined({ message: 'Property p_clientid is required' })
|
||||
p_clientid: number;
|
||||
|
||||
@ApiProperty({ required: true, type: () => [p_contactstableDTO] })
|
||||
@Type(() => p_contactstableDTO)
|
||||
@ValidateNested({ each: true })
|
||||
@IsArray({ message: "Property p_contactstable allows only array type" })
|
||||
@IsDefined({ message: "Property p_contactstable is required" })
|
||||
@IsArray({ message: 'Property p_contactstable allows only array type' })
|
||||
@IsDefined({ message: 'Property p_contactstable is required' })
|
||||
p_contactstable: p_contactstableDTO[];
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 1, { message: "Property p_defcontactflag must be exactly 1 character" })
|
||||
@IsString({ message: "Property p_defcontactflag must be a string" })
|
||||
@IsDefined({ message: "Property p_defcontactflag is required" })
|
||||
@Length(0, 1, {
|
||||
message: 'Property p_defcontactflag must be exactly 1 character',
|
||||
})
|
||||
@IsString({ message: 'Property p_defcontactflag must be a string' })
|
||||
@IsDefined({ message: 'Property p_defcontactflag is required' })
|
||||
p_defcontactflag: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 100, { message: "Property p_userid must be between 0 to 100 characters" })
|
||||
@IsString({ message: "Property p_userid must be a string" })
|
||||
@IsDefined({ message: "Property p_userid is required" })
|
||||
@Length(0, 100, {
|
||||
message: 'Property p_userid must be between 0 to 100 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_userid must be a string' })
|
||||
@IsDefined({ message: 'Property p_userid is required' })
|
||||
p_userid: string;
|
||||
}
|
||||
|
||||
export class CreateAdditionalClientLocationsDTO {
|
||||
@ApiProperty({ required: true })
|
||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
||||
@IsInt({ message: "Property p_spid allows only whole numbers" })
|
||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
||||
@IsDefined({ message: "Property p_spid is required" })
|
||||
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||
@IsInt({ message: 'Property p_spid allows only whole numbers' })
|
||||
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||
@IsDefined({ message: 'Property p_spid is required' })
|
||||
p_spid: number;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Max(999999999, { message: "Property p_clientid must not exceed 999999999" })
|
||||
@Min(0, { message: "Property p_clientid must be at least 0 or more" })
|
||||
@IsInt({ message: "Property p_clientid allows only whole numbers" })
|
||||
@IsNumber({}, { message: "Property p_clientid must be a number" })
|
||||
@IsDefined({ message: "Property p_clientid is required" })
|
||||
@Max(999999999, { message: 'Property p_clientid must not exceed 999999999' })
|
||||
@Min(0, { message: 'Property p_clientid must be at least 0 or more' })
|
||||
@IsInt({ message: 'Property p_clientid allows only whole numbers' })
|
||||
@IsNumber({}, { message: 'Property p_clientid must be a number' })
|
||||
@IsDefined({ message: 'Property p_clientid is required' })
|
||||
p_clientid: number;
|
||||
|
||||
@ApiProperty({ required: true, type: () => [p_clientlocaddresstableDTO] })
|
||||
@Type(() => p_clientlocaddresstableDTO)
|
||||
@ValidateNested({ each: true })
|
||||
@IsArray({ message: "Property p_clientlocaddresstable allows only array type" })
|
||||
@IsDefined({ message: "Property p_clientlocaddresstable is required" })
|
||||
@IsArray({
|
||||
message: 'Property p_clientlocaddresstable allows only array type',
|
||||
})
|
||||
@IsDefined({ message: 'Property p_clientlocaddresstable is required' })
|
||||
p_clientlocaddresstable: p_clientlocaddresstableDTO[];
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 1, { message: "Property p_defcontactflag must be exactly 1 character" })
|
||||
@IsString({ message: "Property p_defcontactflag must be a string" })
|
||||
@IsDefined({ message: "Property p_defcontactflag is required" })
|
||||
@Length(0, 1, {
|
||||
message: 'Property p_defcontactflag must be exactly 1 character',
|
||||
})
|
||||
@IsString({ message: 'Property p_defcontactflag must be a string' })
|
||||
@IsDefined({ message: 'Property p_defcontactflag is required' })
|
||||
p_defcontactflag: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 100, { message: "Property p_userid must be between 0 to 100 characters" })
|
||||
@IsString({ message: "Property p_userid must be a string" })
|
||||
@IsDefined({ message: "Property p_userid is required" })
|
||||
@Length(0, 100, {
|
||||
message: 'Property p_userid must be between 0 to 100 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_userid must be a string' })
|
||||
@IsDefined({ message: 'Property p_userid is required' })
|
||||
p_userid: string;
|
||||
}
|
||||
|
||||
export class GetPreparerByClientidContactsByClientidLocByClientidDTO {
|
||||
@ApiProperty({ required: true })
|
||||
@Transform(({ value }) => Number(value))
|
||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
||||
@IsInt({ message: "Property p_spid allows only whole numbers" })
|
||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
||||
@IsDefined({ message: "Property p_spid is required" })
|
||||
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||
@IsInt({ message: 'Property p_spid allows only whole numbers' })
|
||||
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||
@IsDefined({ message: 'Property p_spid is required' })
|
||||
p_spid: number;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Transform(({ value }) => Number(value))
|
||||
@Max(999999999, { message: "Property p_clientid must not exceed 999999999" })
|
||||
@Min(0, { message: "Property p_clientid must be at least 0 or more" })
|
||||
@IsInt({ message: "Property p_clientid allows only whole numbers" })
|
||||
@IsNumber({}, { message: "Property p_clientid must be a number" })
|
||||
@IsDefined({ message: "Property p_clientid is required" })
|
||||
@Max(999999999, { message: 'Property p_clientid must not exceed 999999999' })
|
||||
@Min(0, { message: 'Property p_clientid must be at least 0 or more' })
|
||||
@IsInt({ message: 'Property p_clientid allows only whole numbers' })
|
||||
@IsNumber({}, { message: 'Property p_clientid must be a number' })
|
||||
@IsDefined({ message: 'Property p_clientid is required' })
|
||||
p_clientid: number;
|
||||
}
|
||||
|
||||
@ -4,6 +4,6 @@ import { ManageClientsService } from './manage-clients.service';
|
||||
|
||||
@Module({
|
||||
controllers: [ManageClientsController],
|
||||
providers: [ManageClientsService]
|
||||
providers: [ManageClientsService],
|
||||
})
|
||||
export class ManageClientsModule {}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -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 { ApiTags } from '@nestjs/swagger';
|
||||
import {
|
||||
@ -16,137 +16,136 @@ import {
|
||||
UpdateCfFeeDTO,
|
||||
UpdateCsFeeDTO,
|
||||
UpdateEfFeeDTO,
|
||||
UpdateFeeCommBodyDTO
|
||||
UpdateFeeCommBodyDTO,
|
||||
} from './manage-fee.dto';
|
||||
|
||||
@Controller('manage-fee')
|
||||
export class ManageFeeController {
|
||||
constructor(private readonly manageFeeService: ManageFeeService) { }
|
||||
|
||||
constructor(private readonly manageFeeService: ManageFeeService) {}
|
||||
|
||||
@ApiTags('Manage Fee - Oracle')
|
||||
@Get('/GetBasicFeeRates')
|
||||
GetBasicFeeRates(@Query() body: GetFeeGeneralDTO) {
|
||||
return this.manageFeeService.GETBASICFEERATES(body)
|
||||
return this.manageFeeService.GETBASICFEERATES(body);
|
||||
}
|
||||
|
||||
@ApiTags('Manage Fee - Oracle')
|
||||
@Get('/GetBondRates')
|
||||
GetBondRates(@Query() body: GetFeeGeneralDTO) {
|
||||
return this.manageFeeService.GETBONDRATES(body)
|
||||
return this.manageFeeService.GETBONDRATES(body);
|
||||
}
|
||||
|
||||
@ApiTags('Manage Fee - Oracle')
|
||||
@Get('/GetCargoRates')
|
||||
GetCargoRates(@Query() body: GetFeeGeneralDTO) {
|
||||
return this.manageFeeService.GETCARGORATES(body)
|
||||
return this.manageFeeService.GETCARGORATES(body);
|
||||
}
|
||||
|
||||
@ApiTags('Manage Fee - Oracle')
|
||||
@Get('/GetCfFeeRates')
|
||||
GetCfFeeRates(@Query() body: GetFeeGeneralDTO) {
|
||||
return this.manageFeeService.GETCFFEERATES(body)
|
||||
return this.manageFeeService.GETCFFEERATES(body);
|
||||
}
|
||||
|
||||
@ApiTags('Manage Fee - Oracle')
|
||||
@Get('/GetCsFeeRates')
|
||||
GetCsFeeRates(@Query() body: GetFeeGeneralDTO) {
|
||||
return this.manageFeeService.GETCSFEERATES(body)
|
||||
return this.manageFeeService.GETCSFEERATES(body);
|
||||
}
|
||||
|
||||
@ApiTags('Manage Fee - Oracle')
|
||||
@Get('/GetEfFeeRates')
|
||||
GetEfFeeRates(@Query() body: GetFeeGeneralDTO) {
|
||||
return this.manageFeeService.GETEFFEERATES(body)
|
||||
return this.manageFeeService.GETEFFEERATES(body);
|
||||
}
|
||||
|
||||
@ApiTags('Manage Fee - Oracle')
|
||||
@Get('/GetFeeComm')
|
||||
GetFeeComm(@Query() body: GetFeeGeneralDTO) {
|
||||
return this.manageFeeService.GETFEECOMM(body)
|
||||
return this.manageFeeService.GETFEECOMM(body);
|
||||
}
|
||||
|
||||
@ApiTags('Manage Fee - Oracle')
|
||||
@Post('/CreateBasicFee')
|
||||
CreateBasicFee(@Body() body: CreateBasicFeeDTO) {
|
||||
return this.manageFeeService.CREATEBASICFEE(body)
|
||||
return this.manageFeeService.CREATEBASICFEE(body);
|
||||
}
|
||||
|
||||
@ApiTags('Manage Fee - Oracle')
|
||||
@Post('/CreateBondRate')
|
||||
CreateBondRate(@Body() body: CreateBondRateDTO) {
|
||||
return this.manageFeeService.CREATEBONDRATE(body)
|
||||
return this.manageFeeService.CREATEBONDRATE(body);
|
||||
}
|
||||
|
||||
@ApiTags('Manage Fee - Oracle')
|
||||
@Post('/CreateCargoRate')
|
||||
CreateCargoRate(@Body() body: CreateCargoRateDTO) {
|
||||
return this.manageFeeService.CREATECARGORATE(body)
|
||||
return this.manageFeeService.CREATECARGORATE(body);
|
||||
}
|
||||
|
||||
@ApiTags('Manage Fee - Oracle')
|
||||
@Post('/CreateCfFee')
|
||||
CreateCfFee(@Body() body: CreateCfFeeDTO) {
|
||||
return this.manageFeeService.CREATECFFEE(body)
|
||||
return this.manageFeeService.CREATECFFEE(body);
|
||||
}
|
||||
|
||||
@ApiTags('Manage Fee - Oracle')
|
||||
@Post('/CreateCsFee')
|
||||
CreateCsFee(@Body() body: CreateCsFeeDTO) {
|
||||
return this.manageFeeService.CREATECSFEE(body)
|
||||
return this.manageFeeService.CREATECSFEE(body);
|
||||
}
|
||||
|
||||
@ApiTags('Manage Fee - Oracle')
|
||||
@Post('/CreateEfFee')
|
||||
CreateEeFee(@Body() body: CreateEfFeeDTO) {
|
||||
return this.manageFeeService.CREATEEFFEE(body)
|
||||
return this.manageFeeService.CREATEEFFEE(body);
|
||||
}
|
||||
|
||||
@ApiTags('Manage Fee - Oracle')
|
||||
@Post('/CreateFeeComm')
|
||||
CreateFeeComm(@Body() body: CreateFeeCommDTO) {
|
||||
return this.manageFeeService.CREATEFEECOMM(body)
|
||||
return this.manageFeeService.CREATEFEECOMM(body);
|
||||
}
|
||||
|
||||
@ApiTags('Manage Fee - Oracle')
|
||||
@Patch('/UpdateBasicFee')
|
||||
UpdateBasicFee(@Body() body: UpdateBasicFeeDTO) {
|
||||
return this.manageFeeService.UPDATEBASICFEE(body)
|
||||
return this.manageFeeService.UPDATEBASICFEE(body);
|
||||
}
|
||||
|
||||
@ApiTags('Manage Fee - Oracle')
|
||||
@Patch('/UpdateBondRate')
|
||||
UpdateBondRate(@Body() body: UpdateBondRateDTO) {
|
||||
return this.manageFeeService.UPDATEBONDRATE(body)
|
||||
return this.manageFeeService.UPDATEBONDRATE(body);
|
||||
}
|
||||
|
||||
@ApiTags('Manage Fee - Oracle')
|
||||
@Patch('/UpdateCargoRate')
|
||||
UpdateCargoRate(@Body() body: UpdateCargoRateDTO) {
|
||||
return this.manageFeeService.UPDATECARGORATE(body)
|
||||
return this.manageFeeService.UPDATECARGORATE(body);
|
||||
}
|
||||
|
||||
@ApiTags('Manage Fee - Oracle')
|
||||
@Patch('/UpdateCfFee')
|
||||
UpdateCfFee(@Body() body: UpdateCfFeeDTO) {
|
||||
return this.manageFeeService.UPDATECFFEE(body)
|
||||
return this.manageFeeService.UPDATECFFEE(body);
|
||||
}
|
||||
|
||||
@ApiTags('Manage Fee - Oracle')
|
||||
@Patch('/UpdateCsFee')
|
||||
UpdateCsFee(@Body() body: UpdateCsFeeDTO) {
|
||||
return this.manageFeeService.UPDATECSFEE(body)
|
||||
return this.manageFeeService.UPDATECSFEE(body);
|
||||
}
|
||||
|
||||
@ApiTags('Manage Fee - Oracle')
|
||||
@Patch('/UpdateEfFee')
|
||||
UpdateEfFee(@Body() body: UpdateEfFeeDTO) {
|
||||
return this.manageFeeService.UPDATEEFFEE(body)
|
||||
return this.manageFeeService.UPDATEEFFEE(body);
|
||||
}
|
||||
|
||||
@ApiTags('Manage Fee - Oracle')
|
||||
@Patch('/UpdateFeeComm')
|
||||
UpdateFeeComm(@Body() body: UpdateFeeCommBodyDTO) {
|
||||
return this.manageFeeService.UPDATEFEECOMM(body)
|
||||
return this.manageFeeService.UPDATEFEECOMM(body);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,19 +1,19 @@
|
||||
import { ApiProperty } from "@nestjs/swagger";
|
||||
import { Transform } from "class-transformer";
|
||||
import { IsDefined, IsInt, IsNumber, IsString, Min } from "class-validator";
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { Transform } from 'class-transformer';
|
||||
import { IsDefined, IsInt, IsNumber, IsString, Min } from 'class-validator';
|
||||
|
||||
export class GetFeeGeneralDTO {
|
||||
@ApiProperty({ required: true })
|
||||
@Transform(({ value }) => Number(value))
|
||||
@Min(0, { message: "Property P_SPID must be at least 0" })
|
||||
@IsInt({ message: "Property P_SPID must be a whole number" })
|
||||
@IsNumber({}, { message: "Property P_SPID must be a number" })
|
||||
@IsDefined({ message: "Property P_SPID is required" })
|
||||
@Min(0, { message: 'Property P_SPID must be at least 0' })
|
||||
@IsInt({ message: 'Property P_SPID must be a whole number' })
|
||||
@IsNumber({}, { message: 'Property P_SPID must be a number' })
|
||||
@IsDefined({ message: 'Property P_SPID is required' })
|
||||
P_SPID: number;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString({ message: "Property P_ACTIVE_INACTIVE must be a string" })
|
||||
@IsDefined({ message: "Property P_ACTIVE_INACTIVE is required" })
|
||||
@IsString({ message: 'Property P_ACTIVE_INACTIVE must be a string' })
|
||||
@IsDefined({ message: 'Property P_ACTIVE_INACTIVE is required' })
|
||||
P_ACTIVE_INACTIVE: string;
|
||||
}
|
||||
|
||||
@ -336,7 +336,6 @@ export class UpdateEfFeeDTO {
|
||||
}
|
||||
|
||||
export class UpdateFeeCommDTO {
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsNumber()
|
||||
P_FEECOMMID: number;
|
||||
|
||||
@ -4,6 +4,6 @@ import { ManageFeeService } from './manage-fee.service';
|
||||
|
||||
@Module({
|
||||
controllers: [ManageFeeController],
|
||||
providers: [ManageFeeService]
|
||||
providers: [ManageFeeService],
|
||||
})
|
||||
export class ManageFeeModule {}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -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 { CreateHoldersDTO, GetHolderContactActivateOrInactivateDTO, GetHolderOrContactDTO, UpdateHolderContactDTO, UpdateHolderDTO } from './manage-holders.dto';
|
||||
import {
|
||||
CreateHoldersDTO,
|
||||
GetHolderContactActivateOrInactivateDTO,
|
||||
GetHolderOrContactDTO,
|
||||
UpdateHolderContactDTO,
|
||||
UpdateHolderDTO,
|
||||
} from './manage-holders.dto';
|
||||
import { ManageHoldersService } from './manage-holders.service';
|
||||
|
||||
@Controller('oracle')
|
||||
export class ManageHoldersController {
|
||||
|
||||
constructor(private readonly manageHoldersService: ManageHoldersService) { }
|
||||
constructor(private readonly manageHoldersService: ManageHoldersService) {}
|
||||
|
||||
@ApiTags('Manage Holders - Oracle')
|
||||
@Post('/CreateHolderData')
|
||||
@ -32,8 +46,8 @@ export class ManageHoldersController {
|
||||
GetHolderMaster(
|
||||
@Param('p_spid', ParseIntPipe) p_spid: 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);
|
||||
}
|
||||
@ -43,8 +57,8 @@ export class ManageHoldersController {
|
||||
GetHolderContacts(
|
||||
@Param('p_spid', ParseIntPipe) p_spid: 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);
|
||||
}
|
||||
@ -54,8 +68,8 @@ export class ManageHoldersController {
|
||||
InactivateHolder(
|
||||
@Param('p_spid', ParseIntPipe) p_spid: 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);
|
||||
}
|
||||
@ -65,8 +79,8 @@ export class ManageHoldersController {
|
||||
ReactivateHolder(
|
||||
@Param('p_spid', ParseIntPipe) p_spid: 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);
|
||||
}
|
||||
@ -76,8 +90,11 @@ export class ManageHoldersController {
|
||||
InactivateHolderContact(
|
||||
@Param('p_spid', ParseIntPipe) p_spid: 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);
|
||||
}
|
||||
@ -87,8 +104,11 @@ export class ManageHoldersController {
|
||||
ReactivateHolderContact(
|
||||
@Param('p_spid', ParseIntPipe) p_spid: 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);
|
||||
}
|
||||
|
||||
@ -1,381 +1,487 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { Type } from 'class-transformer';
|
||||
import { IsString, IsNumber, IsOptional, ValidateNested, IsArray, IsDefined, Length, Max, Min, IsInt } from 'class-validator';
|
||||
import {
|
||||
IsString,
|
||||
IsNumber,
|
||||
IsOptional,
|
||||
ValidateNested,
|
||||
IsArray,
|
||||
IsDefined,
|
||||
Length,
|
||||
Max,
|
||||
Min,
|
||||
IsInt,
|
||||
} from 'class-validator';
|
||||
|
||||
export class p_contactstableDTO {
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 50, { message: "Property FirstName must be between 0 to 50 characters" })
|
||||
@IsString({ message: "Property FirstName must be a string" })
|
||||
@IsDefined({ message: "Property FirstName is required" })
|
||||
@Length(0, 50, {
|
||||
message: 'Property FirstName must be between 0 to 50 characters',
|
||||
})
|
||||
@IsString({ message: 'Property FirstName must be a string' })
|
||||
@IsDefined({ message: 'Property FirstName is required' })
|
||||
FirstName: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 50, { message: "Property LastName must be between 0 to 50 characters" })
|
||||
@IsString({ message: "Property LastName must be a string" })
|
||||
@IsDefined({ message: "Property LastName is required" })
|
||||
@Length(0, 50, {
|
||||
message: 'Property LastName must be between 0 to 50 characters',
|
||||
})
|
||||
@IsString({ message: 'Property LastName must be a string' })
|
||||
@IsDefined({ message: 'Property LastName is required' })
|
||||
LastName: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Length(0, 3, { message: "Property MiddleInitial must be between 0 to 3 characters" })
|
||||
@IsString({ message: "Property MiddleInitial must be a string" })
|
||||
@Length(0, 3, {
|
||||
message: 'Property MiddleInitial must be between 0 to 3 characters',
|
||||
})
|
||||
@IsString({ message: 'Property MiddleInitial must be a string' })
|
||||
@IsOptional()
|
||||
MiddleInitial?: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Length(0, 50, { message: "Property Title must be between 0 to 50 characters" })
|
||||
@IsString({ message: "Property Title must be a string" })
|
||||
@Length(0, 50, {
|
||||
message: 'Property Title must be between 0 to 50 characters',
|
||||
})
|
||||
@IsString({ message: 'Property Title must be a string' })
|
||||
@IsOptional()
|
||||
Title?: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 100, { message: "Property EmailAddress must be between 0 to 100 characters" })
|
||||
@IsString({ message: "Property EmailAddress must be a string" })
|
||||
@IsDefined({ message: "Property EmailAddress is required" })
|
||||
@Length(0, 100, {
|
||||
message: 'Property EmailAddress must be between 0 to 100 characters',
|
||||
})
|
||||
@IsString({ message: 'Property EmailAddress must be a string' })
|
||||
@IsDefined({ message: 'Property EmailAddress is required' })
|
||||
EmailAddress: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 20, { message: "Property PhoneNo must be between 0 to 20 characters" })
|
||||
@IsString({ message: "Property PhoneNo must be a string" })
|
||||
@IsDefined({ message: "Property PhoneNo is required" })
|
||||
@Length(0, 20, {
|
||||
message: 'Property PhoneNo must be between 0 to 20 characters',
|
||||
})
|
||||
@IsString({ message: 'Property PhoneNo must be a string' })
|
||||
@IsDefined({ message: 'Property PhoneNo is required' })
|
||||
PhoneNo: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 20, { message: "Property MobileNo must be between 0 to 20 characters" })
|
||||
@IsString({ message: "Property MobileNo must be a string" })
|
||||
@IsDefined({ message: "Property MobileNo is required" })
|
||||
@Length(0, 20, {
|
||||
message: 'Property MobileNo must be between 0 to 20 characters',
|
||||
})
|
||||
@IsString({ message: 'Property MobileNo must be a string' })
|
||||
@IsDefined({ message: 'Property MobileNo is required' })
|
||||
MobileNo: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Length(0, 20, { message: "Property FaxNo must be between 0 to 20 characters" })
|
||||
@IsString({ message: "Property FaxNo must be a string" })
|
||||
@Length(0, 20, {
|
||||
message: 'Property FaxNo must be between 0 to 20 characters',
|
||||
})
|
||||
@IsString({ message: 'Property FaxNo must be a string' })
|
||||
@IsOptional()
|
||||
FaxNo?: string;
|
||||
}
|
||||
|
||||
export class CreateHoldersDTO {
|
||||
@ApiProperty({ required: true })
|
||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
||||
@IsInt({ message: "Property p_spid allows only whole numbers" })
|
||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
||||
@IsDefined({ message: "Property p_spid is required" })
|
||||
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||
@IsInt({ message: 'Property p_spid allows only whole numbers' })
|
||||
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||
@IsDefined({ message: 'Property p_spid is required' })
|
||||
p_spid: number;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Max(999999999, { message: "Property p_clientlocationid must not exceed 999999999" })
|
||||
@Min(0, { message: "Property p_clientlocationid must be at least 0 or more" })
|
||||
@IsInt({ message: "Property p_clientlocationid allows only whole numbers" })
|
||||
@IsNumber({}, { message: "Property p_clientlocationid must be a number" })
|
||||
@IsDefined({ message: "Property p_clientlocationid is required" })
|
||||
@Max(999999999, {
|
||||
message: 'Property p_clientlocationid must not exceed 999999999',
|
||||
})
|
||||
@Min(0, { message: 'Property p_clientlocationid must be at least 0 or more' })
|
||||
@IsInt({ message: 'Property p_clientlocationid allows only whole numbers' })
|
||||
@IsNumber({}, { message: 'Property p_clientlocationid must be a number' })
|
||||
@IsDefined({ message: 'Property p_clientlocationid is required' })
|
||||
p_clientlocationid: number;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 15, { message: "Property p_holderno must be between 0 to 15 characters" })
|
||||
@IsString({ message: "Property p_holderno must be a string" })
|
||||
@IsDefined({ message: "Property p_holderno is required" })
|
||||
@Length(0, 15, {
|
||||
message: 'Property p_holderno must be between 0 to 15 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_holderno must be a string' })
|
||||
@IsDefined({ message: 'Property p_holderno is required' })
|
||||
p_holderno: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 3, { message: "Property p_holdertype must be between 0 to 3 characters" })
|
||||
@IsString({ message: "Property p_holdertype must be a string" })
|
||||
@IsDefined({ message: "Property p_holdertype is required" })
|
||||
@Length(0, 3, {
|
||||
message: 'Property p_holdertype must be between 0 to 3 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_holdertype must be a string' })
|
||||
@IsDefined({ message: 'Property p_holdertype is required' })
|
||||
p_holdertype: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 1, { message: "Property p_uscibmemberflag must be between 0 to 1 character" })
|
||||
@IsString({ message: "Property p_uscibmemberflag must be a string" })
|
||||
@IsDefined({ message: "Property p_uscibmemberflag is required" })
|
||||
@Length(0, 1, {
|
||||
message: 'Property p_uscibmemberflag must be between 0 to 1 character',
|
||||
})
|
||||
@IsString({ message: 'Property p_uscibmemberflag must be a string' })
|
||||
@IsDefined({ message: 'Property p_uscibmemberflag is required' })
|
||||
p_uscibmemberflag: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 1, { message: "Property p_govagencyflag must be between 0 to 1 character" })
|
||||
@IsString({ message: "Property p_govagencyflag must be a string" })
|
||||
@IsDefined({ message: "Property p_govagencyflag is required" })
|
||||
@Length(0, 1, {
|
||||
message: 'Property p_govagencyflag must be between 0 to 1 character',
|
||||
})
|
||||
@IsString({ message: 'Property p_govagencyflag must be a string' })
|
||||
@IsDefined({ message: 'Property p_govagencyflag is required' })
|
||||
p_govagencyflag: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 50, { message: "Property p_holdername must be between 0 to 50 characters" })
|
||||
@IsString({ message: "Property p_holdername must be a string" })
|
||||
@IsDefined({ message: "Property p_holdername is required" })
|
||||
@Length(0, 50, {
|
||||
message: 'Property p_holdername must be between 0 to 50 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_holdername must be a string' })
|
||||
@IsDefined({ message: 'Property p_holdername is required' })
|
||||
p_holdername: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Length(0, 10, { message: "Property p_namequalifier must be between 0 to 10 characters" })
|
||||
@IsString({ message: "Property p_namequalifier must be a string" })
|
||||
@Length(0, 10, {
|
||||
message: 'Property p_namequalifier must be between 0 to 10 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_namequalifier must be a string' })
|
||||
@IsOptional()
|
||||
p_namequalifier?: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Length(0, 50, { message: "Property p_addlname must be between 0 to 50 characters" })
|
||||
@IsString({ message: "Property p_addlname must be a string" })
|
||||
@Length(0, 50, {
|
||||
message: 'Property p_addlname must be between 0 to 50 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_addlname must be a string' })
|
||||
@IsOptional()
|
||||
p_addlname?: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 50, { message: "Property p_address1 must be between 0 to 50 characters" })
|
||||
@IsString({ message: "Property p_address1 must be a string" })
|
||||
@IsDefined({ message: "Property p_address1 is required" })
|
||||
@Length(0, 50, {
|
||||
message: 'Property p_address1 must be between 0 to 50 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_address1 must be a string' })
|
||||
@IsDefined({ message: 'Property p_address1 is required' })
|
||||
p_address1: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Length(0, 50, { message: "Property p_address2 must be between 0 to 50 characters" })
|
||||
@IsString({ message: "Property p_address2 must be a string" })
|
||||
@Length(0, 50, {
|
||||
message: 'Property p_address2 must be between 0 to 50 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_address2 must be a string' })
|
||||
@IsOptional()
|
||||
p_address2?: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 30, { message: "Property p_city must be between 0 to 30 characters" })
|
||||
@IsString({ message: "Property p_city must be a string" })
|
||||
@IsDefined({ message: "Property p_city is required" })
|
||||
@Length(0, 30, {
|
||||
message: 'Property p_city must be between 0 to 30 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_city must be a string' })
|
||||
@IsDefined({ message: 'Property p_city is required' })
|
||||
p_city: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 2, { message: "Property p_state must be between 0 to 2 characters" })
|
||||
@IsString({ message: "Property p_state must be a string" })
|
||||
@IsDefined({ message: "Property p_state is required" })
|
||||
@Length(0, 2, {
|
||||
message: 'Property p_state must be between 0 to 2 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_state must be a string' })
|
||||
@IsDefined({ message: 'Property p_state is required' })
|
||||
p_state: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 10, { message: "Property p_zip must be between 0 to 10 characters" })
|
||||
@IsString({ message: "Property p_zip must be a string" })
|
||||
@IsDefined({ message: "Property p_zip is required" })
|
||||
@Length(0, 10, {
|
||||
message: 'Property p_zip must be between 0 to 10 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_zip must be a string' })
|
||||
@IsDefined({ message: 'Property p_zip is required' })
|
||||
p_zip: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 50, { message: "Property p_country must be between 0 to 50 characters" })
|
||||
@IsString({ message: "Property p_country must be a string" })
|
||||
@IsDefined({ message: "Property p_country is required" })
|
||||
@Length(0, 50, {
|
||||
message: 'Property p_country must be between 0 to 50 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_country must be a string' })
|
||||
@IsDefined({ message: 'Property p_country is required' })
|
||||
p_country: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 50, { message: "Property p_userid must be between 0 to 50 characters" })
|
||||
@IsString({ message: "Property p_userid must be a string" })
|
||||
@IsDefined({ message: "Property p_userid is required" })
|
||||
@Length(0, 50, {
|
||||
message: 'Property p_userid must be between 0 to 50 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_userid must be a string' })
|
||||
@IsDefined({ message: 'Property p_userid is required' })
|
||||
p_userid: string;
|
||||
|
||||
@ApiProperty({ required: false, type: () => [p_contactstableDTO] })
|
||||
@Type(() => p_contactstableDTO)
|
||||
@ValidateNested({ each: true })
|
||||
@IsArray({ message: "Property p_contactstable allows only array type" })
|
||||
@IsArray({ message: 'Property p_contactstable allows only array type' })
|
||||
@IsOptional()
|
||||
p_contactstable?: p_contactstableDTO[];
|
||||
}
|
||||
|
||||
export class UpdateHolderDTO {
|
||||
@ApiProperty({ required: true })
|
||||
@Max(999999999, { message: "Property p_holderid must not exceed 999999999" })
|
||||
@Min(0, { message: "Property p_holderid must be at least 0 or more" })
|
||||
@IsInt({ message: "Property p_holderid allows only whole numbers" })
|
||||
@IsNumber({}, { message: "Property p_holderid must be a number" })
|
||||
@IsDefined({ message: "Property p_holderid is required" })
|
||||
@Max(999999999, { message: 'Property p_holderid must not exceed 999999999' })
|
||||
@Min(0, { message: 'Property p_holderid must be at least 0 or more' })
|
||||
@IsInt({ message: 'Property p_holderid allows only whole numbers' })
|
||||
@IsNumber({}, { message: 'Property p_holderid must be a number' })
|
||||
@IsDefined({ message: 'Property p_holderid is required' })
|
||||
p_holderid: number;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
||||
@IsInt({ message: "Property p_spid allows only whole numbers" })
|
||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
||||
@IsDefined({ message: "Property p_spid is required" })
|
||||
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||
@IsInt({ message: 'Property p_spid allows only whole numbers' })
|
||||
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||
@IsDefined({ message: 'Property p_spid is required' })
|
||||
p_spid: number;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Max(999999999, { message: "Property p_locationid must not exceed 999999999" })
|
||||
@Min(0, { message: "Property p_locationid must be at least 0 or more" })
|
||||
@IsInt({ message: "Property p_locationid allows only whole numbers" })
|
||||
@IsNumber({}, { message: "Property p_locationid must be a number" })
|
||||
@IsDefined({ message: "Property p_locationid is required" })
|
||||
@Max(999999999, {
|
||||
message: 'Property p_locationid must not exceed 999999999',
|
||||
})
|
||||
@Min(0, { message: 'Property p_locationid must be at least 0 or more' })
|
||||
@IsInt({ message: 'Property p_locationid allows only whole numbers' })
|
||||
@IsNumber({}, { message: 'Property p_locationid must be a number' })
|
||||
@IsDefined({ message: 'Property p_locationid is required' })
|
||||
p_locationid: number;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 15, { message: "Property p_holderno must be between 0 to 15 characters" })
|
||||
@IsString({ message: "Property p_holderno must be a string" })
|
||||
@IsDefined({ message: "Property p_holderno is required" })
|
||||
@Length(0, 15, {
|
||||
message: 'Property p_holderno must be between 0 to 15 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_holderno must be a string' })
|
||||
@IsDefined({ message: 'Property p_holderno is required' })
|
||||
p_holderno: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 3, { message: "Property p_holdertype must be between 0 to 3 characters" })
|
||||
@IsString({ message: "Property p_holdertype must be a string" })
|
||||
@IsDefined({ message: "Property p_holdertype is required" })
|
||||
@Length(0, 3, {
|
||||
message: 'Property p_holdertype must be between 0 to 3 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_holdertype must be a string' })
|
||||
@IsDefined({ message: 'Property p_holdertype is required' })
|
||||
p_holdertype: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 1, { message: "Property p_uscibmemberflag must be between 0 to 1 character" })
|
||||
@IsString({ message: "Property p_uscibmemberflag must be a string" })
|
||||
@IsDefined({ message: "Property p_uscibmemberflag is required" })
|
||||
@Length(0, 1, {
|
||||
message: 'Property p_uscibmemberflag must be between 0 to 1 character',
|
||||
})
|
||||
@IsString({ message: 'Property p_uscibmemberflag must be a string' })
|
||||
@IsDefined({ message: 'Property p_uscibmemberflag is required' })
|
||||
p_uscibmemberflag: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 1, { message: "Property p_govagencyflag must be between 0 to 1 character" })
|
||||
@IsString({ message: "Property p_govagencyflag must be a string" })
|
||||
@IsDefined({ message: "Property p_govagencyflag is required" })
|
||||
@Length(0, 1, {
|
||||
message: 'Property p_govagencyflag must be between 0 to 1 character',
|
||||
})
|
||||
@IsString({ message: 'Property p_govagencyflag must be a string' })
|
||||
@IsDefined({ message: 'Property p_govagencyflag is required' })
|
||||
p_govagencyflag: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 50, { message: "Property p_holdername must be between 0 to 50 characters" })
|
||||
@IsString({ message: "Property p_holdername must be a string" })
|
||||
@IsDefined({ message: "Property p_holdername is required" })
|
||||
@Length(0, 50, {
|
||||
message: 'Property p_holdername must be between 0 to 50 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_holdername must be a string' })
|
||||
@IsDefined({ message: 'Property p_holdername is required' })
|
||||
p_holdername: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Length(0, 10, { message: "Property p_namequalifier must be between 0 to 10 characters" })
|
||||
@IsString({ message: "Property p_namequalifier must be a string" })
|
||||
@Length(0, 10, {
|
||||
message: 'Property p_namequalifier must be between 0 to 10 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_namequalifier must be a string' })
|
||||
@IsOptional()
|
||||
p_namequalifier?: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Length(0, 50, { message: "Property p_addlname must be between 0 to 50 characters" })
|
||||
@IsString({ message: "Property p_addlname must be a string" })
|
||||
@Length(0, 50, {
|
||||
message: 'Property p_addlname must be between 0 to 50 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_addlname must be a string' })
|
||||
@IsOptional()
|
||||
p_addlname?: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 50, { message: "Property p_address1 must be between 0 to 50 characters" })
|
||||
@IsString({ message: "Property p_address1 must be a string" })
|
||||
@IsDefined({ message: "Property p_address1 is required" })
|
||||
@Length(0, 50, {
|
||||
message: 'Property p_address1 must be between 0 to 50 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_address1 must be a string' })
|
||||
@IsDefined({ message: 'Property p_address1 is required' })
|
||||
p_address1: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Length(0, 50, { message: "Property p_address2 must be between 0 to 50 characters" })
|
||||
@IsString({ message: "Property p_address2 must be a string" })
|
||||
@Length(0, 50, {
|
||||
message: 'Property p_address2 must be between 0 to 50 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_address2 must be a string' })
|
||||
@IsOptional()
|
||||
p_address2?: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 30, { message: "Property p_city must be between 0 to 30 characters" })
|
||||
@IsString({ message: "Property p_city must be a string" })
|
||||
@IsDefined({ message: "Property p_city is required" })
|
||||
@Length(0, 30, {
|
||||
message: 'Property p_city must be between 0 to 30 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_city must be a string' })
|
||||
@IsDefined({ message: 'Property p_city is required' })
|
||||
p_city: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 2, { message: "Property p_state must be between 0 to 2 characters" })
|
||||
@IsString({ message: "Property p_state must be a string" })
|
||||
@IsDefined({ message: "Property p_state is required" })
|
||||
@Length(0, 2, {
|
||||
message: 'Property p_state must be between 0 to 2 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_state must be a string' })
|
||||
@IsDefined({ message: 'Property p_state is required' })
|
||||
p_state: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 10, { message: "Property p_zip must be between 0 to 10 characters" })
|
||||
@IsString({ message: "Property p_zip must be a string" })
|
||||
@IsDefined({ message: "Property p_zip is required" })
|
||||
@Length(0, 10, {
|
||||
message: 'Property p_zip must be between 0 to 10 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_zip must be a string' })
|
||||
@IsDefined({ message: 'Property p_zip is required' })
|
||||
p_zip: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 2, { message: "Property p_country must be between 0 to 2 characters" })
|
||||
@IsString({ message: "Property p_country must be a string" })
|
||||
@IsDefined({ message: "Property p_country is required" })
|
||||
@Length(0, 2, {
|
||||
message: 'Property p_country must be between 0 to 2 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_country must be a string' })
|
||||
@IsDefined({ message: 'Property p_country is required' })
|
||||
p_country: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 100, { message: "Property p_userid must be between 0 to 100 characters" })
|
||||
@IsString({ message: "Property p_userid must be a string" })
|
||||
@IsDefined({ message: "Property p_userid is required" })
|
||||
@Length(0, 100, {
|
||||
message: 'Property p_userid must be between 0 to 100 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_userid must be a string' })
|
||||
@IsDefined({ message: 'Property p_userid is required' })
|
||||
p_userid: string;
|
||||
}
|
||||
|
||||
export class UpdateHolderContactDTO {
|
||||
@ApiProperty({ required: true })
|
||||
@Max(999999999, { message: "Property p_holdercontactid must not exceed 999999999" })
|
||||
@Min(0, { message: "Property p_holdercontactid must be at least 0 or more" })
|
||||
@IsInt({ message: "Property p_holdercontactid allows only whole numbers" })
|
||||
@IsNumber({}, { message: "Property p_holdercontactid must be a number" })
|
||||
@IsDefined({ message: "Property p_holdercontactid is required" })
|
||||
@Max(999999999, {
|
||||
message: 'Property p_holdercontactid must not exceed 999999999',
|
||||
})
|
||||
@Min(0, { message: 'Property p_holdercontactid must be at least 0 or more' })
|
||||
@IsInt({ message: 'Property p_holdercontactid allows only whole numbers' })
|
||||
@IsNumber({}, { message: 'Property p_holdercontactid must be a number' })
|
||||
@IsDefined({ message: 'Property p_holdercontactid is required' })
|
||||
p_holdercontactid: number;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
||||
@IsInt({ message: "Property p_spid allows only whole numbers" })
|
||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
||||
@IsDefined({ message: "Property p_spid is required" })
|
||||
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||
@IsInt({ message: 'Property p_spid allows only whole numbers' })
|
||||
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||
@IsDefined({ message: 'Property p_spid is required' })
|
||||
p_spid: number;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 50, { message: "Property p_firstname must be between 0 to 50 characters" })
|
||||
@IsString({ message: "Property p_firstname must be a string" })
|
||||
@IsDefined({ message: "Property p_firstname is required" })
|
||||
@Length(0, 50, {
|
||||
message: 'Property p_firstname must be between 0 to 50 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_firstname must be a string' })
|
||||
@IsDefined({ message: 'Property p_firstname is required' })
|
||||
p_firstname: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 50, { message: "Property p_lastname must be between 0 to 50 characters" })
|
||||
@IsString({ message: "Property p_lastname must be a string" })
|
||||
@IsDefined({ message: "Property p_lastname is required" })
|
||||
@Length(0, 50, {
|
||||
message: 'Property p_lastname must be between 0 to 50 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_lastname must be a string' })
|
||||
@IsDefined({ message: 'Property p_lastname is required' })
|
||||
p_lastname: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Length(0, 3, { message: "Property p_middleinitial must be between 0 to 3 characters" })
|
||||
@IsString({ message: "Property p_middleinitial must be a string" })
|
||||
@Length(0, 3, {
|
||||
message: 'Property p_middleinitial must be between 0 to 3 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_middleinitial must be a string' })
|
||||
@IsOptional()
|
||||
p_middleinitial?: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Length(0, 50, { message: "Property p_title must be between 0 to 50 characters" })
|
||||
@IsString({ message: "Property p_title must be a string" })
|
||||
@Length(0, 50, {
|
||||
message: 'Property p_title must be between 0 to 50 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_title must be a string' })
|
||||
@IsOptional()
|
||||
p_title?: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 20, { message: "Property p_phone must be between 0 to 20 characters" })
|
||||
@IsString({ message: "Property p_phone must be a string" })
|
||||
@IsDefined({ message: "Property p_phone is required" })
|
||||
@Length(0, 20, {
|
||||
message: 'Property p_phone must be between 0 to 20 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_phone must be a string' })
|
||||
@IsDefined({ message: 'Property p_phone is required' })
|
||||
p_phone: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 20, { message: "Property p_mobile must be between 0 to 20 characters" })
|
||||
@IsString({ message: "Property p_mobile must be a string" })
|
||||
@IsDefined({ message: "Property p_mobile is required" })
|
||||
@Length(0, 20, {
|
||||
message: 'Property p_mobile must be between 0 to 20 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_mobile must be a string' })
|
||||
@IsDefined({ message: 'Property p_mobile is required' })
|
||||
p_mobile: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Length(0, 20, { message: "Property p_fax must be between 0 to 20 characters" })
|
||||
@IsString({ message: "Property p_fax must be a string" })
|
||||
@Length(0, 20, {
|
||||
message: 'Property p_fax must be between 0 to 20 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_fax must be a string' })
|
||||
@IsOptional()
|
||||
p_fax?: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 100, { message: "Property p_emailaddress must be between 0 to 100 characters" })
|
||||
@IsString({ message: "Property p_emailaddress must be a string" })
|
||||
@IsDefined({ message: "Property p_emailaddress is required" })
|
||||
@Length(0, 100, {
|
||||
message: 'Property p_emailaddress must be between 0 to 100 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_emailaddress must be a string' })
|
||||
@IsDefined({ message: 'Property p_emailaddress is required' })
|
||||
p_emailaddress: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Length(0, 100, { message: "Property p_userid must be between 0 to 100 characters" })
|
||||
@IsString({ message: "Property p_userid must be a string" })
|
||||
@IsDefined({ message: "Property p_userid is required" })
|
||||
@Length(0, 100, {
|
||||
message: 'Property p_userid must be between 0 to 100 characters',
|
||||
})
|
||||
@IsString({ message: 'Property p_userid must be a string' })
|
||||
@IsDefined({ message: 'Property p_userid is required' })
|
||||
p_userid: string;
|
||||
}
|
||||
|
||||
export class GetHolderOrContactDTO {
|
||||
@ApiProperty({ required: true })
|
||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
||||
@IsInt({ message: "Property p_spid allows only whole numbers" })
|
||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
||||
@IsDefined({ message: "Property p_spid is required" })
|
||||
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||
@IsInt({ message: 'Property p_spid allows only whole numbers' })
|
||||
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||
@IsDefined({ message: 'Property p_spid is required' })
|
||||
p_spid: number;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Max(999999999, { message: "Property p_holderid must not exceed 999999999" })
|
||||
@Min(0, { message: "Property p_holderid must be at least 0 or more" })
|
||||
@IsInt({ message: "Property p_holderid allows only whole numbers" })
|
||||
@IsNumber({}, { message: "Property p_holderid must be a number" })
|
||||
@IsDefined({ message: "Property p_holderid is required" })
|
||||
@Max(999999999, { message: 'Property p_holderid must not exceed 999999999' })
|
||||
@Min(0, { message: 'Property p_holderid must be at least 0 or more' })
|
||||
@IsInt({ message: 'Property p_holderid allows only whole numbers' })
|
||||
@IsNumber({}, { message: 'Property p_holderid must be a number' })
|
||||
@IsDefined({ message: 'Property p_holderid is required' })
|
||||
p_holderid: number;
|
||||
}
|
||||
|
||||
export class GetHolderContactActivateOrInactivateDTO {
|
||||
@ApiProperty({ required: true })
|
||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
||||
@IsInt({ message: "Property p_spid allows only whole numbers" })
|
||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
||||
@IsDefined({ message: "Property p_spid is required" })
|
||||
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||
@IsInt({ message: 'Property p_spid allows only whole numbers' })
|
||||
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||
@IsDefined({ message: 'Property p_spid is required' })
|
||||
p_spid: number;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@Max(999999999, { message: "Property p_holderid must not exceed 999999999" })
|
||||
@Min(0, { message: "Property p_holderid must be at least 0 or more" })
|
||||
@IsInt({ message: "Property p_holderid allows only whole numbers" })
|
||||
@IsNumber({}, { message: "Property p_holderid must be a number" })
|
||||
@IsDefined({ message: "Property p_holderid is required" })
|
||||
@Max(999999999, { message: 'Property p_holderid must not exceed 999999999' })
|
||||
@Min(0, { message: 'Property p_holderid must be at least 0 or more' })
|
||||
@IsInt({ message: 'Property p_holderid allows only whole numbers' })
|
||||
@IsNumber({}, { message: 'Property p_holderid must be a number' })
|
||||
@IsDefined({ message: 'Property p_holderid is required' })
|
||||
p_holderContactid: number;
|
||||
}
|
||||
|
||||
|
||||
@ -4,8 +4,8 @@ import { ManageHoldersController } from './manage-holders.controller';
|
||||
import { DbModule } from 'src/db/db.module';
|
||||
|
||||
@Module({
|
||||
imports:[DbModule],
|
||||
imports: [DbModule],
|
||||
providers: [ManageHoldersService],
|
||||
controllers: [ManageHoldersController]
|
||||
controllers: [ManageHoldersController],
|
||||
})
|
||||
export class ManageHoldersModule {}
|
||||
|
||||
@ -1,42 +1,47 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { OracleDBService } from 'src/db/db.service';
|
||||
import { CreateHoldersDTO, GetHolderContactActivateOrInactivateDTO, GetHolderOrContactDTO, p_contactstableDTO, UpdateHolderContactDTO, UpdateHolderDTO } from './manage-holders.dto';
|
||||
import * as oracledb from 'oracledb'
|
||||
import {
|
||||
CreateHoldersDTO,
|
||||
GetHolderContactActivateOrInactivateDTO,
|
||||
GetHolderOrContactDTO,
|
||||
p_contactstableDTO,
|
||||
UpdateHolderContactDTO,
|
||||
UpdateHolderDTO,
|
||||
} from './manage-holders.dto';
|
||||
import * as oracledb from 'oracledb';
|
||||
|
||||
@Injectable()
|
||||
export class ManageHoldersService {
|
||||
|
||||
constructor(private readonly oracleDBService: OracleDBService) { }
|
||||
constructor(private readonly oracleDBService: OracleDBService) {}
|
||||
|
||||
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 = {
|
||||
"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));
|
||||
const reqBody = JSON.parse(JSON.stringify(body));
|
||||
|
||||
function setEmptyStringsToNull(obj) {
|
||||
Object.keys(obj).forEach(key => {
|
||||
Object.keys(obj).forEach((key) => {
|
||||
if (typeof obj[key] === 'object' && obj[key] !== null) {
|
||||
setEmptyStringsToNull(obj[key]);
|
||||
} else if (obj[key] === "") {
|
||||
} else if (obj[key] === '') {
|
||||
obj[key] = null;
|
||||
}
|
||||
});
|
||||
@ -50,10 +55,9 @@ export class ManageHoldersService {
|
||||
let p_holdercursor_rows = [];
|
||||
let p_holdercontactcursor_rows = [];
|
||||
try {
|
||||
|
||||
connection = await this.oracleDBService.getConnection()
|
||||
connection = await this.oracleDBService.getConnection();
|
||||
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%'`);
|
||||
@ -61,14 +65,26 @@ export class ManageHoldersService {
|
||||
// return { res:res.rows };
|
||||
|
||||
// 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
|
||||
if (typeof CONTACTSTABLE !== 'function') {
|
||||
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(
|
||||
`SELECT CARNETSYS.CONTACTSARRAY(:FirstName, :LastName, :MiddleInitial, :Title, :EmailAddress, :PhoneNo, :MobileNo, :FaxNo) FROM dual`,
|
||||
{
|
||||
@ -79,15 +95,29 @@ export class ManageHoldersService {
|
||||
EmailAddress,
|
||||
PhoneNo,
|
||||
MobileNo,
|
||||
FaxNo
|
||||
}
|
||||
FaxNo,
|
||||
},
|
||||
);
|
||||
return result.rows[0][0];
|
||||
}
|
||||
|
||||
const CONTACTSARRAY = finalBody.p_contactstable ? 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);
|
||||
})) : [];
|
||||
const CONTACTSARRAY = finalBody.p_contactstable
|
||||
? 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
|
||||
const CONTACTSTABLE_INSTANCE = new CONTACTSTABLE(CONTACTSARRAY);
|
||||
@ -119,84 +149,89 @@ export class ManageHoldersService {
|
||||
{
|
||||
p_spid: {
|
||||
val: finalBody.p_spid ? finalBody.p_spid : null,
|
||||
type: oracledb.DB_TYPE_NUMBER
|
||||
type: oracledb.DB_TYPE_NUMBER,
|
||||
},
|
||||
p_clientlocationid: {
|
||||
val: finalBody.p_clientlocationid ? finalBody.p_clientlocationid : null,
|
||||
type: oracledb.DB_TYPE_NUMBER
|
||||
val: finalBody.p_clientlocationid
|
||||
? finalBody.p_clientlocationid
|
||||
: null,
|
||||
type: oracledb.DB_TYPE_NUMBER,
|
||||
},
|
||||
|
||||
p_holderno: {
|
||||
val: finalBody.p_holderno ? finalBody.p_holderno : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_holdertype: {
|
||||
val: finalBody.p_holdertype ? finalBody.p_holdertype : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_uscibmemberflag: {
|
||||
val: finalBody.p_uscibmemberflag ? finalBody.p_uscibmemberflag : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
val: finalBody.p_uscibmemberflag
|
||||
? finalBody.p_uscibmemberflag
|
||||
: null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_govagencyflag: {
|
||||
val: finalBody.p_govagencyflag ? finalBody.p_govagencyflag : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_holdername: {
|
||||
val: finalBody.p_holdername ? finalBody.p_holdername : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_namequalifier: {
|
||||
val: finalBody.p_namequalifier ? finalBody.p_namequalifier : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_addlname: {
|
||||
val: finalBody.p_addlname ? finalBody.p_addlname : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_address1: {
|
||||
val: finalBody.p_address1 ? finalBody.p_address1 : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_address2: {
|
||||
val: finalBody.p_address2 ? finalBody.p_address2 : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_city: {
|
||||
val: finalBody.p_city ? finalBody.p_city : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_state: {
|
||||
val: finalBody.p_state ? finalBody.p_state : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_zip: {
|
||||
val: finalBody.p_zip ? finalBody.p_zip : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_country: {
|
||||
val: finalBody.p_country ? finalBody.p_country : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_userid: {
|
||||
val: finalBody.p_userid ? finalBody.p_userid : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_contactstable: {
|
||||
val: CONTACTSTABLE_INSTANCE,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_holdercursor: {
|
||||
type: oracledb.CURSOR,
|
||||
dir: oracledb.BIND_OUT
|
||||
dir: oracledb.BIND_OUT,
|
||||
},
|
||||
p_holdercontactcursor: {
|
||||
type: oracledb.CURSOR,
|
||||
dir: oracledb.BIND_OUT
|
||||
}
|
||||
}, {
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
||||
}
|
||||
dir: oracledb.BIND_OUT,
|
||||
},
|
||||
},
|
||||
{
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||
},
|
||||
);
|
||||
|
||||
await connection.commit();
|
||||
@ -212,7 +247,6 @@ export class ManageHoldersService {
|
||||
p_holdercursor_rows = p_holdercursor_rows.concat(rowsBatch);
|
||||
} while (rowsBatch.length > 0);
|
||||
|
||||
|
||||
await cursor.close();
|
||||
} else {
|
||||
throw new Error('No cursor returned from the stored procedure');
|
||||
@ -224,53 +258,57 @@ export class ManageHoldersService {
|
||||
|
||||
do {
|
||||
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);
|
||||
|
||||
|
||||
await cursor.close();
|
||||
} else {
|
||||
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
|
||||
|
||||
} catch (err) {
|
||||
|
||||
return { error: err.message }
|
||||
} finally { }
|
||||
|
||||
if (err instanceof Error) {
|
||||
return { error: err.message };
|
||||
} else {
|
||||
return { error: 'An unknown error occurred' };
|
||||
}
|
||||
}
|
||||
};
|
||||
UpdateHolder = async (body: UpdateHolderDTO) => {
|
||||
let newBody = {
|
||||
"p_holderid": null,
|
||||
"p_spid": null,
|
||||
"p_locationid": 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
|
||||
}
|
||||
const newBody = {
|
||||
p_holderid: null,
|
||||
p_spid: null,
|
||||
p_locationid: 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,
|
||||
};
|
||||
|
||||
let reqBody = JSON.parse(JSON.stringify(body));
|
||||
const reqBody = JSON.parse(JSON.stringify(body));
|
||||
|
||||
function setEmptyStringsToNull(obj) {
|
||||
Object.keys(obj).forEach(key => {
|
||||
Object.keys(obj).forEach((key) => {
|
||||
if (typeof obj[key] === 'object' && obj[key] !== null) {
|
||||
setEmptyStringsToNull(obj[key]);
|
||||
} else if (obj[key] === "") {
|
||||
} else if (obj[key] === '') {
|
||||
obj[key] = null;
|
||||
}
|
||||
});
|
||||
@ -283,10 +321,9 @@ export class ManageHoldersService {
|
||||
let connection;
|
||||
let P_cursor_rows = [];
|
||||
try {
|
||||
|
||||
connection = await this.oracleDBService.getConnection()
|
||||
connection = await this.oracleDBService.getConnection();
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
throw new Error('No DB Connected');
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
@ -315,79 +352,82 @@ export class ManageHoldersService {
|
||||
{
|
||||
p_holderid: {
|
||||
val: finalBody.p_holderid ? finalBody.p_holderid : null,
|
||||
type: oracledb.DB_TYPE_NUMBER
|
||||
type: oracledb.DB_TYPE_NUMBER,
|
||||
},
|
||||
p_spid: {
|
||||
val: finalBody.p_spid ? finalBody.p_spid : null,
|
||||
type: oracledb.DB_TYPE_NUMBER
|
||||
type: oracledb.DB_TYPE_NUMBER,
|
||||
},
|
||||
p_locationid: {
|
||||
val: finalBody.p_locationid ? finalBody.p_locationid : null,
|
||||
type: oracledb.DB_TYPE_NUMBER
|
||||
type: oracledb.DB_TYPE_NUMBER,
|
||||
},
|
||||
p_holderno: {
|
||||
val: finalBody.p_holderno ? finalBody.p_holderno : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_holdertype: {
|
||||
val: finalBody.p_holdertype ? finalBody.p_holdertype : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_uscibmemberflag: {
|
||||
val: finalBody.p_uscibmemberflag ? finalBody.p_uscibmemberflag : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
val: finalBody.p_uscibmemberflag
|
||||
? finalBody.p_uscibmemberflag
|
||||
: null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_govagencyflag: {
|
||||
val: finalBody.p_govagencyflag ? finalBody.p_govagencyflag : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_holdername: {
|
||||
val: finalBody.p_holdername ? finalBody.p_holdername : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_namequalifier: {
|
||||
val: finalBody.p_namequalifier ? finalBody.p_namequalifier : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_addlname: {
|
||||
val: finalBody.p_addlname ? finalBody.p_addlname : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_address1: {
|
||||
val: finalBody.p_address1 ? finalBody.p_address1 : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_address2: {
|
||||
val: finalBody.p_address2 ? finalBody.p_address2 : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_city: {
|
||||
val: finalBody.p_city ? finalBody.p_city : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_state: {
|
||||
val: finalBody.p_state ? finalBody.p_state : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_zip: {
|
||||
val: finalBody.p_zip ? finalBody.p_zip : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_country: {
|
||||
val: finalBody.p_country ? finalBody.p_country : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_userid: {
|
||||
val: finalBody.p_userid ? finalBody.p_userid : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
P_cursor: {
|
||||
type: oracledb.CURSOR,
|
||||
dir: oracledb.BIND_OUT
|
||||
}
|
||||
}, {
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
||||
}
|
||||
dir: oracledb.BIND_OUT,
|
||||
},
|
||||
},
|
||||
{
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||
},
|
||||
);
|
||||
await connection.commit();
|
||||
|
||||
@ -402,7 +442,6 @@ export class ManageHoldersService {
|
||||
P_cursor_rows = P_cursor_rows.concat(rowsBatch);
|
||||
} while (rowsBatch.length > 0);
|
||||
|
||||
|
||||
await cursor.close();
|
||||
} else {
|
||||
throw new Error('No cursor returned from the stored procedure');
|
||||
@ -411,22 +450,22 @@ export class ManageHoldersService {
|
||||
return { P_cursor: P_cursor_rows };
|
||||
|
||||
// return fres
|
||||
|
||||
} catch (err) {
|
||||
|
||||
return { error: err.message }
|
||||
} finally { }
|
||||
|
||||
if (err instanceof Error) {
|
||||
return { error: err.message };
|
||||
} else {
|
||||
return { error: 'An unknown error occurred' };
|
||||
}
|
||||
}
|
||||
};
|
||||
GetHolderRecord = async (body: GetHolderOrContactDTO) => {
|
||||
|
||||
let connection;
|
||||
let p_cursor_rows = [];
|
||||
|
||||
try {
|
||||
connection = await this.oracleDBService.getConnection()
|
||||
connection = await this.oracleDBService.getConnection();
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
throw new Error('No DB Connected');
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
@ -448,12 +487,12 @@ export class ManageHoldersService {
|
||||
},
|
||||
p_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) {
|
||||
@ -465,40 +504,40 @@ export class ManageHoldersService {
|
||||
p_cursor_rows = p_cursor_rows.concat(rowsBatch);
|
||||
} while (rowsBatch.length > 0);
|
||||
|
||||
|
||||
await cursor.close();
|
||||
}
|
||||
|
||||
return { p_cursor: p_cursor_rows };
|
||||
|
||||
} catch (err) {
|
||||
|
||||
return { error: err.message }
|
||||
} finally { }
|
||||
if (err instanceof Error) {
|
||||
return { error: err.message };
|
||||
} else {
|
||||
return { error: 'An unknown error occurred' };
|
||||
}
|
||||
}
|
||||
};
|
||||
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 = {
|
||||
"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));
|
||||
const reqBody = JSON.parse(JSON.stringify(body));
|
||||
|
||||
function setEmptyStringsToNull(obj) {
|
||||
Object.keys(obj).forEach(key => {
|
||||
Object.keys(obj).forEach((key) => {
|
||||
if (typeof obj[key] === 'object' && obj[key] !== null) {
|
||||
setEmptyStringsToNull(obj[key]);
|
||||
} else if (obj[key] === "") {
|
||||
} else if (obj[key] === '') {
|
||||
obj[key] = null;
|
||||
}
|
||||
});
|
||||
@ -511,10 +550,9 @@ export class ManageHoldersService {
|
||||
let connection;
|
||||
let P_cursor_rows = [];
|
||||
try {
|
||||
|
||||
connection = await this.oracleDBService.getConnection()
|
||||
connection = await this.oracleDBService.getConnection();
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
throw new Error('No DB Connected');
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
@ -536,56 +574,59 @@ export class ManageHoldersService {
|
||||
END;`,
|
||||
{
|
||||
p_holdercontactid: {
|
||||
val: finalBody.p_holdercontactid ? finalBody.p_holdercontactid : null,
|
||||
type: oracledb.DB_TYPE_NUMBER
|
||||
val: finalBody.p_holdercontactid
|
||||
? finalBody.p_holdercontactid
|
||||
: null,
|
||||
type: oracledb.DB_TYPE_NUMBER,
|
||||
},
|
||||
p_spid: {
|
||||
val: finalBody.p_spid ? finalBody.p_spid : null,
|
||||
type: oracledb.DB_TYPE_NUMBER
|
||||
type: oracledb.DB_TYPE_NUMBER,
|
||||
},
|
||||
p_firstname: {
|
||||
val: finalBody.p_firstname ? finalBody.p_firstname : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_lastname: {
|
||||
val: finalBody.p_lastname ? finalBody.p_lastname : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_middleinitial: {
|
||||
val: finalBody.p_middleinitial ? finalBody.p_middleinitial : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_title: {
|
||||
val: finalBody.p_title ? finalBody.p_title : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_phone: {
|
||||
val: finalBody.p_phone ? finalBody.p_phone : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_mobile: {
|
||||
val: finalBody.p_mobile ? finalBody.p_mobile : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_fax: {
|
||||
val: finalBody.p_fax ? finalBody.p_fax : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_emailaddress: {
|
||||
val: finalBody.p_emailaddress ? finalBody.p_emailaddress : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_userid: {
|
||||
val: finalBody.p_userid ? finalBody.p_userid : null,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
P_cursor: {
|
||||
type: oracledb.CURSOR,
|
||||
dir: oracledb.BIND_OUT
|
||||
}
|
||||
}, {
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
||||
}
|
||||
dir: oracledb.BIND_OUT,
|
||||
},
|
||||
},
|
||||
{
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||
},
|
||||
);
|
||||
await connection.commit();
|
||||
|
||||
@ -600,7 +641,6 @@ export class ManageHoldersService {
|
||||
P_cursor_rows = P_cursor_rows.concat(rowsBatch);
|
||||
} while (rowsBatch.length > 0);
|
||||
|
||||
|
||||
await cursor.close();
|
||||
} else {
|
||||
throw new Error('No cursor returned from the stored procedure');
|
||||
@ -609,20 +649,22 @@ export class ManageHoldersService {
|
||||
return { P_cursor: P_cursor_rows };
|
||||
|
||||
// return fres
|
||||
|
||||
} catch (err) {
|
||||
|
||||
return { error: err.message }
|
||||
} finally { }
|
||||
if (err instanceof Error) {
|
||||
return { error: err.message };
|
||||
} else {
|
||||
return { error: 'An unknown error occurred' };
|
||||
}
|
||||
}
|
||||
};
|
||||
GetHolderContacts = async (body: GetHolderOrContactDTO) => {
|
||||
let connection;
|
||||
let p_cursor_rows = [];
|
||||
|
||||
try {
|
||||
connection = await this.oracleDBService.getConnection()
|
||||
connection = await this.oracleDBService.getConnection();
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
throw new Error('No DB Connected');
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
@ -644,12 +686,12 @@ export class ManageHoldersService {
|
||||
},
|
||||
p_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) {
|
||||
@ -661,25 +703,26 @@ export class ManageHoldersService {
|
||||
p_cursor_rows = p_cursor_rows.concat(rowsBatch);
|
||||
} while (rowsBatch.length > 0);
|
||||
|
||||
|
||||
await cursor.close();
|
||||
}
|
||||
|
||||
return { p_cursor: p_cursor_rows };
|
||||
|
||||
} catch (err) {
|
||||
|
||||
return { error: err.message }
|
||||
} finally { }
|
||||
if (err instanceof Error) {
|
||||
return { error: err.message };
|
||||
} else {
|
||||
return { error: 'An unknown error occurred' };
|
||||
}
|
||||
}
|
||||
};
|
||||
InactivateHolder = async (body: GetHolderOrContactDTO) => {
|
||||
let connection;
|
||||
let p_cursor_rows = [];
|
||||
|
||||
try {
|
||||
connection = await this.oracleDBService.getConnection()
|
||||
connection = await this.oracleDBService.getConnection();
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
throw new Error('No DB Connected');
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
@ -701,12 +744,12 @@ export class ManageHoldersService {
|
||||
},
|
||||
p_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) {
|
||||
@ -718,25 +761,26 @@ export class ManageHoldersService {
|
||||
p_cursor_rows = p_cursor_rows.concat(rowsBatch);
|
||||
} while (rowsBatch.length > 0);
|
||||
|
||||
|
||||
await cursor.close();
|
||||
}
|
||||
|
||||
return { p_cursor: p_cursor_rows };
|
||||
|
||||
} catch (err) {
|
||||
|
||||
return { error: err.message }
|
||||
} finally { }
|
||||
if (err instanceof Error) {
|
||||
return { error: err.message };
|
||||
} else {
|
||||
return { error: 'An unknown error occurred' };
|
||||
}
|
||||
}
|
||||
};
|
||||
ReactivateHolder = async (body: GetHolderOrContactDTO) => {
|
||||
let connection;
|
||||
let p_cursor_rows = [];
|
||||
|
||||
try {
|
||||
connection = await this.oracleDBService.getConnection()
|
||||
connection = await this.oracleDBService.getConnection();
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
throw new Error('No DB Connected');
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
@ -758,12 +802,12 @@ export class ManageHoldersService {
|
||||
},
|
||||
p_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) {
|
||||
@ -775,25 +819,28 @@ export class ManageHoldersService {
|
||||
p_cursor_rows = p_cursor_rows.concat(rowsBatch);
|
||||
} while (rowsBatch.length > 0);
|
||||
|
||||
|
||||
await cursor.close();
|
||||
}
|
||||
|
||||
return { p_cursor: p_cursor_rows };
|
||||
|
||||
} catch (err) {
|
||||
|
||||
return { error: err.message }
|
||||
} finally { }
|
||||
if (err instanceof Error) {
|
||||
return { error: err.message };
|
||||
} else {
|
||||
return { error: 'An unknown error occurred' };
|
||||
}
|
||||
InactivateHolderContact = async (body: GetHolderContactActivateOrInactivateDTO) => {
|
||||
}
|
||||
};
|
||||
InactivateHolderContact = async (
|
||||
body: GetHolderContactActivateOrInactivateDTO,
|
||||
) => {
|
||||
let connection;
|
||||
let p_cursor_rows = [];
|
||||
|
||||
try {
|
||||
connection = await this.oracleDBService.getConnection()
|
||||
connection = await this.oracleDBService.getConnection();
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
throw new Error('No DB Connected');
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
@ -815,12 +862,12 @@ export class ManageHoldersService {
|
||||
},
|
||||
p_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) {
|
||||
@ -832,25 +879,28 @@ export class ManageHoldersService {
|
||||
p_cursor_rows = p_cursor_rows.concat(rowsBatch);
|
||||
} while (rowsBatch.length > 0);
|
||||
|
||||
|
||||
await cursor.close();
|
||||
}
|
||||
|
||||
return { p_cursor: p_cursor_rows };
|
||||
|
||||
} catch (err) {
|
||||
|
||||
return { error: err.message }
|
||||
} finally { }
|
||||
if (err instanceof Error) {
|
||||
return { error: err.message };
|
||||
} else {
|
||||
return { error: 'An unknown error occurred' };
|
||||
}
|
||||
ReactivateHolderContact = async (body: GetHolderContactActivateOrInactivateDTO) => {
|
||||
}
|
||||
};
|
||||
ReactivateHolderContact = async (
|
||||
body: GetHolderContactActivateOrInactivateDTO,
|
||||
) => {
|
||||
let connection;
|
||||
let p_cursor_rows = [];
|
||||
|
||||
try {
|
||||
connection = await this.oracleDBService.getConnection()
|
||||
connection = await this.oracleDBService.getConnection();
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
throw new Error('No DB Connected');
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
@ -872,12 +922,12 @@ export class ManageHoldersService {
|
||||
},
|
||||
p_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) {
|
||||
@ -889,15 +939,16 @@ export class ManageHoldersService {
|
||||
p_cursor_rows = p_cursor_rows.concat(rowsBatch);
|
||||
} while (rowsBatch.length > 0);
|
||||
|
||||
|
||||
await cursor.close();
|
||||
}
|
||||
|
||||
return { p_cursor: p_cursor_rows };
|
||||
|
||||
} catch (err) {
|
||||
|
||||
return { error: err.message }
|
||||
} finally { }
|
||||
if (err instanceof Error) {
|
||||
return { error: err.message };
|
||||
} 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';
|
||||
|
||||
@Module({
|
||||
imports:[DbModule, HomePageModule, UscibManagedSpModule, ParamTableModule, ManageFeeModule, ManageHoldersModule, ManageClientsModule],
|
||||
imports: [
|
||||
DbModule,
|
||||
HomePageModule,
|
||||
UscibManagedSpModule,
|
||||
ParamTableModule,
|
||||
ManageFeeModule,
|
||||
ManageHoldersModule,
|
||||
ManageClientsModule,
|
||||
],
|
||||
providers: [],
|
||||
controllers: [],
|
||||
exports:[]
|
||||
exports: [],
|
||||
})
|
||||
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 { ParamTableService } from './param-table.service';
|
||||
import { ActivateOrInactivateParamRecordDTO, CreateParamRecordDTO, CreateTableRecordDTO, getParamValuesDTO, UpdateParamRecordDTO } from './param-table.dto';
|
||||
import {
|
||||
ActivateOrInactivateParamRecordDTO,
|
||||
CreateParamRecordDTO,
|
||||
CreateTableRecordDTO,
|
||||
getParamValuesDTO,
|
||||
UpdateParamRecordDTO,
|
||||
} from './param-table.dto';
|
||||
|
||||
@Controller('param-table')
|
||||
export class ParamTableController {
|
||||
|
||||
constructor(private readonly paramTableService: ParamTableService) { }
|
||||
constructor(private readonly paramTableService: ParamTableService) {}
|
||||
|
||||
@ApiTags('Param Table - Oracle')
|
||||
@Get('/GetParamValues')
|
||||
@ApiQuery({ name: 'P_SPID', required: false, type: Number, description: 'The ID of the parameter' })
|
||||
@ApiQuery({ name: 'P_PARAMTYPE', required: false, type: String, description: 'The type of the parameter' })
|
||||
@ApiQuery({
|
||||
name: 'P_SPID',
|
||||
required: false,
|
||||
type: Number,
|
||||
description: 'The ID of the parameter',
|
||||
})
|
||||
@ApiQuery({
|
||||
name: 'P_PARAMTYPE',
|
||||
required: false,
|
||||
type: String,
|
||||
description: 'The type of the parameter',
|
||||
})
|
||||
getParamValues(@Query() body: getParamValuesDTO) {
|
||||
return this.paramTableService.GETPARAMVALUES(body)
|
||||
return this.paramTableService.GETPARAMVALUES(body);
|
||||
}
|
||||
|
||||
@ApiTags('Param Table - Oracle')
|
||||
@Post('/CreateTableRecord')
|
||||
createTableRecord(@Body() body: CreateTableRecordDTO) {
|
||||
return this.paramTableService.CREATETABLERECORD(body)
|
||||
return this.paramTableService.CREATETABLERECORD(body);
|
||||
}
|
||||
|
||||
@ApiTags('Param Table - Oracle')
|
||||
@Post('/CreateParamRecord')
|
||||
createParamRecord(@Body() body: CreateParamRecordDTO) {
|
||||
return this.paramTableService.CREATEPARAMRECORD(body)
|
||||
return this.paramTableService.CREATEPARAMRECORD(body);
|
||||
}
|
||||
|
||||
@ApiTags('Param Table - Oracle')
|
||||
@Patch('/UpdateParamRecord')
|
||||
UpdateParamRecord(@Body() body: UpdateParamRecordDTO) {
|
||||
return this.paramTableService.UPDATEPARAMRECORD(body)
|
||||
return this.paramTableService.UPDATEPARAMRECORD(body);
|
||||
}
|
||||
|
||||
@ApiTags('Param Table - Oracle')
|
||||
@Put('/InActivateParamRecord')
|
||||
inActivateParamRecord(@Body() body: ActivateOrInactivateParamRecordDTO) {
|
||||
return this.paramTableService.INACTIVATEPARAMRECORD(body)
|
||||
return this.paramTableService.INACTIVATEPARAMRECORD(body);
|
||||
}
|
||||
|
||||
@ApiTags('Param Table - Oracle')
|
||||
@Put('/ReActivateParamRecord')
|
||||
reActivateParamRecord(@Body() body: ActivateOrInactivateParamRecordDTO) {
|
||||
return this.paramTableService.REACTIVATEPARAMRECORD(body)
|
||||
return this.paramTableService.REACTIVATEPARAMRECORD(body);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,16 +1,23 @@
|
||||
import { ApiProperty } from "@nestjs/swagger";
|
||||
import { Transform } from "class-transformer";
|
||||
import { IsDefined, IsInt, IsNumber, IsOptional, IsString, Min, ValidateIf } from "class-validator";
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { Transform } from 'class-transformer';
|
||||
import {
|
||||
IsDefined,
|
||||
IsInt,
|
||||
IsNumber,
|
||||
IsOptional,
|
||||
IsString,
|
||||
Min,
|
||||
} from 'class-validator';
|
||||
|
||||
export class CreateTableRecordDTO {
|
||||
@ApiProperty({ required: true })
|
||||
@IsString({ message: "Property P_USERID must be a string" })
|
||||
@IsDefined({ message: "Property P_USERID is required" })
|
||||
@IsString({ message: 'Property P_USERID must be a string' })
|
||||
@IsDefined({ message: 'Property P_USERID is required' })
|
||||
P_USERID: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString({ message: "Property P_TABLEFULLDESC must be a string" })
|
||||
@IsDefined({ message: "Property P_TABLEFULLDESC is required" })
|
||||
@IsString({ message: 'Property P_TABLEFULLDESC must be a string' })
|
||||
@IsDefined({ message: 'Property P_TABLEFULLDESC is required' })
|
||||
P_TABLEFULLDESC: string;
|
||||
}
|
||||
|
||||
@ -115,26 +122,26 @@ export class UpdateParamRecordDTO {
|
||||
}
|
||||
|
||||
export class getParamValuesDTO {
|
||||
@IsInt({ message: "Property P_SPID must be a whole number" })
|
||||
@IsNumber({}, { message: "Property P_SPID must be a number" })
|
||||
@Min(0, { message: "Property P_SPID must be at least 0" })
|
||||
@IsInt({ message: 'Property P_SPID must be a whole number' })
|
||||
@IsNumber({}, { message: 'Property P_SPID must be a number' })
|
||||
@Min(0, { message: 'Property P_SPID must be at least 0' })
|
||||
@Transform(({ value }) => Number(value))
|
||||
@IsOptional()
|
||||
P_SPID?: number;
|
||||
|
||||
@IsString({ message: "Property P_PARAMTYPE must be a string" })
|
||||
@IsString({ message: 'Property P_PARAMTYPE must be a string' })
|
||||
@IsOptional()
|
||||
P_PARAMTYPE?: string;
|
||||
}
|
||||
|
||||
export class ActivateOrInactivateParamRecordDTO {
|
||||
@ApiProperty({ required: true })
|
||||
@IsNumber({}, { message: "Property P_PARAMID must be a number" })
|
||||
@IsDefined({ message: "Property P_PARAMID is required" })
|
||||
@IsNumber({}, { message: 'Property P_PARAMID must be a number' })
|
||||
@IsDefined({ message: 'Property P_PARAMID is required' })
|
||||
P_PARAMID: number;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString({ message: "Property P_USERID must be a string" })
|
||||
@IsDefined({ message: "Property P_USERID is required" })
|
||||
@IsString({ message: 'Property P_USERID must be a string' })
|
||||
@IsDefined({ message: 'Property P_USERID is required' })
|
||||
P_USERID: string;
|
||||
}
|
||||
@ -4,6 +4,6 @@ import { ParamTableService } from './param-table.service';
|
||||
|
||||
@Module({
|
||||
controllers: [ParamTableController],
|
||||
providers: [ParamTableService]
|
||||
providers: [ParamTableService],
|
||||
})
|
||||
export class ParamTableModule {}
|
||||
|
||||
@ -1,25 +1,30 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { OracleDBService } from 'src/db/db.service';
|
||||
import * as oracledb from 'oracledb'
|
||||
import { ActivateOrInactivateParamRecordDTO, CreateParamRecordDTO, CreateTableRecordDTO, getParamValuesDTO, UpdateParamRecordDTO } from './param-table.dto';
|
||||
import * as oracledb from 'oracledb';
|
||||
import {
|
||||
ActivateOrInactivateParamRecordDTO,
|
||||
CreateParamRecordDTO,
|
||||
CreateTableRecordDTO,
|
||||
getParamValuesDTO,
|
||||
UpdateParamRecordDTO,
|
||||
} from './param-table.dto';
|
||||
|
||||
@Injectable()
|
||||
export class ParamTableService {
|
||||
constructor(private readonly oracleDBService: OracleDBService) { }
|
||||
constructor(private readonly oracleDBService: OracleDBService) {}
|
||||
|
||||
async GETPARAMVALUES(body:getParamValuesDTO) {
|
||||
|
||||
let finalBody = {
|
||||
async GETPARAMVALUES(body: getParamValuesDTO) {
|
||||
const finalBody = {
|
||||
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 rows = [];
|
||||
try {
|
||||
connection = await this.oracleDBService.getConnection()
|
||||
connection = await this.oracleDBService.getConnection();
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
throw new Error('No DB Connected');
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
@ -29,20 +34,20 @@ export class ParamTableService {
|
||||
{
|
||||
P_SPID: {
|
||||
val: finalBody.P_SPID,
|
||||
type: oracledb.DB_TYPE_NUMBER
|
||||
type: oracledb.DB_TYPE_NUMBER,
|
||||
},
|
||||
P_PARAMTYPE: {
|
||||
val: finalBody.P_PARAMTYPE,
|
||||
type: oracledb.DB_TYPE_NVARCHAR
|
||||
type: oracledb.DB_TYPE_NVARCHAR,
|
||||
},
|
||||
p_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) {
|
||||
@ -54,28 +59,27 @@ export class ParamTableService {
|
||||
rows = rows.concat(rowsBatch);
|
||||
} while (rowsBatch.length > 0);
|
||||
|
||||
|
||||
await cursor.close();
|
||||
} else {
|
||||
throw new Error('No cursor returned from the stored procedure');
|
||||
}
|
||||
|
||||
return rows;
|
||||
|
||||
} catch (err) {
|
||||
|
||||
return { error: err.message }
|
||||
} finally { }
|
||||
|
||||
if (err instanceof Error) {
|
||||
return { error: err.message };
|
||||
} else {
|
||||
return { error: 'An unknown error occurred' };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async CREATETABLERECORD(body: CreateTableRecordDTO) {
|
||||
let connection;
|
||||
try {
|
||||
|
||||
connection = await this.oracleDBService.getConnection()
|
||||
connection = await this.oracleDBService.getConnection();
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
throw new Error('No DB Connected');
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
@ -85,40 +89,42 @@ export class ParamTableService {
|
||||
{
|
||||
P_TABLEFULLDESC: {
|
||||
val: body.P_TABLEFULLDESC,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
P_USERID: {
|
||||
val: body.P_USERID,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
|
||||
p_cursor: {
|
||||
type: oracledb.CURSOR,
|
||||
dir: oracledb.BIND_OUT
|
||||
}
|
||||
}, {
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
||||
}
|
||||
dir: oracledb.BIND_OUT,
|
||||
},
|
||||
},
|
||||
{
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||
},
|
||||
);
|
||||
await connection.commit();
|
||||
|
||||
let fres = await result.outBinds.p_cursor.getRows();
|
||||
|
||||
return fres
|
||||
const fres = await result.outBinds.p_cursor.getRows();
|
||||
|
||||
return fres;
|
||||
} catch (err) {
|
||||
|
||||
return { error: err.message }
|
||||
} finally { }
|
||||
if (err instanceof Error) {
|
||||
return { error: err.message };
|
||||
} else {
|
||||
return { error: 'An unknown error occurred' };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async CREATEPARAMRECORD(body: CreateParamRecordDTO) {
|
||||
let connection;
|
||||
try {
|
||||
|
||||
connection = await this.oracleDBService.getConnection()
|
||||
connection = await this.oracleDBService.getConnection();
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
throw new Error('No DB Connected');
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
@ -140,77 +146,78 @@ export class ParamTableService {
|
||||
{
|
||||
P_SPID: {
|
||||
val: body.P_SPID,
|
||||
type: oracledb.DB_TYPE_NUMBER
|
||||
type: oracledb.DB_TYPE_NUMBER,
|
||||
},
|
||||
P_PARAMTYPE: {
|
||||
val: body.P_PARAMTYPE,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
P_PARAMDESC: {
|
||||
val: body.P_PARAMDESC,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
P_PARAMVALUE: {
|
||||
val: body.P_PARAMVALUE,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
P_ADDLPARAMVALUE1: {
|
||||
val: body.P_ADDLPARAMVALUE1,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
P_ADDLPARAMVALUE2: {
|
||||
val: body.P_ADDLPARAMVALUE2,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
P_ADDLPARAMVALUE3: {
|
||||
val: body.P_ADDLPARAMVALUE3,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
P_ADDLPARAMVALUE4: {
|
||||
val: body.P_ADDLPARAMVALUE4,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
P_ADDLPARAMVALUE5: {
|
||||
val: body.P_ADDLPARAMVALUE5,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
P_SORTSEQ: {
|
||||
val: body.P_SORTSEQ,
|
||||
type: oracledb.DB_TYPE_NUMBER
|
||||
type: oracledb.DB_TYPE_NUMBER,
|
||||
},
|
||||
P_USERID: {
|
||||
val: body.P_USERID,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
|
||||
p_cursor: {
|
||||
type: oracledb.CURSOR,
|
||||
dir: oracledb.BIND_OUT
|
||||
}
|
||||
}, {
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
||||
}
|
||||
dir: oracledb.BIND_OUT,
|
||||
},
|
||||
},
|
||||
{
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||
},
|
||||
);
|
||||
await connection.commit();
|
||||
|
||||
let fres = await result.outBinds.p_cursor.getRows();
|
||||
|
||||
return fres
|
||||
|
||||
const fres = await result.outBinds.p_cursor.getRows();
|
||||
|
||||
return fres;
|
||||
} catch (err) {
|
||||
|
||||
return { error: err.message }
|
||||
} finally { }
|
||||
if (err instanceof Error) {
|
||||
return { error: err.message };
|
||||
} else {
|
||||
return { error: 'An unknown error occurred' };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async UPDATEPARAMRECORD(body: UpdateParamRecordDTO) {
|
||||
let connection;
|
||||
try {
|
||||
|
||||
connection = await this.oracleDBService.getConnection()
|
||||
connection = await this.oracleDBService.getConnection();
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
throw new Error('No DB Connected');
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
@ -231,73 +238,74 @@ export class ParamTableService {
|
||||
{
|
||||
P_SPID: {
|
||||
val: body.P_SPID,
|
||||
type: oracledb.DB_TYPE_NUMBER
|
||||
type: oracledb.DB_TYPE_NUMBER,
|
||||
},
|
||||
P_PARAMID: {
|
||||
val: body.P_PARAMID,
|
||||
type: oracledb.DB_TYPE_NUMBER
|
||||
type: oracledb.DB_TYPE_NUMBER,
|
||||
},
|
||||
P_PARAMDESC: {
|
||||
val: body.P_PARAMDESC,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
P_ADDLPARAMVALUE1: {
|
||||
val: body.P_ADDLPARAMVALUE1,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
P_ADDLPARAMVALUE2: {
|
||||
val: body.P_ADDLPARAMVALUE2,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
P_ADDLPARAMVALUE3: {
|
||||
val: body.P_ADDLPARAMVALUE3,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
P_ADDLPARAMVALUE4: {
|
||||
val: body.P_ADDLPARAMVALUE4,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
P_ADDLPARAMVALUE5: {
|
||||
val: body.P_ADDLPARAMVALUE5,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
P_SORTSEQ: {
|
||||
val: body.P_SORTSEQ,
|
||||
type: oracledb.DB_TYPE_NUMBER
|
||||
type: oracledb.DB_TYPE_NUMBER,
|
||||
},
|
||||
P_USERID: {
|
||||
val: body.P_USERID,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
|
||||
p_cursor: {
|
||||
type: oracledb.CURSOR,
|
||||
dir: oracledb.BIND_OUT
|
||||
}
|
||||
}, {
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
||||
}
|
||||
dir: oracledb.BIND_OUT,
|
||||
},
|
||||
},
|
||||
{
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||
},
|
||||
);
|
||||
await connection.commit();
|
||||
|
||||
let fres = await result.outBinds.p_cursor.getRows();
|
||||
|
||||
return fres
|
||||
|
||||
const fres = await result.outBinds.p_cursor.getRows();
|
||||
|
||||
return fres;
|
||||
} catch (err) {
|
||||
|
||||
return { error: err.message }
|
||||
} finally { }
|
||||
if (err instanceof Error) {
|
||||
return { error: err.message };
|
||||
} else {
|
||||
return { error: 'An unknown error occurred' };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async INACTIVATEPARAMRECORD(body: ActivateOrInactivateParamRecordDTO) {
|
||||
let connection;
|
||||
try {
|
||||
|
||||
connection = await this.oracleDBService.getConnection()
|
||||
connection = await this.oracleDBService.getConnection();
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
throw new Error('No DB Connected');
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
@ -309,32 +317,32 @@ export class ParamTableService {
|
||||
{
|
||||
P_PARAMID: {
|
||||
val: body.P_PARAMID,
|
||||
type: oracledb.DB_TYPE_NUMBER
|
||||
type: oracledb.DB_TYPE_NUMBER,
|
||||
},
|
||||
P_USERID: {
|
||||
val: body.P_USERID,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
},
|
||||
}
|
||||
);
|
||||
await connection.commit();
|
||||
|
||||
return "SP Executed Successfully"
|
||||
|
||||
|
||||
return 'SP Executed Successfully';
|
||||
} catch (err) {
|
||||
|
||||
return { error: err.message }
|
||||
} finally { }
|
||||
if (err instanceof Error) {
|
||||
return { error: err.message };
|
||||
} else {
|
||||
return { error: 'An unknown error occurred' };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async REACTIVATEPARAMRECORD(body: ActivateOrInactivateParamRecordDTO) {
|
||||
let connection;
|
||||
try {
|
||||
|
||||
connection = await this.oracleDBService.getConnection()
|
||||
connection = await this.oracleDBService.getConnection();
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
throw new Error('No DB Connected');
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
@ -346,22 +354,23 @@ export class ParamTableService {
|
||||
{
|
||||
P_PARAMID: {
|
||||
val: body.P_PARAMID,
|
||||
type: oracledb.DB_TYPE_NUMBER
|
||||
type: oracledb.DB_TYPE_NUMBER,
|
||||
},
|
||||
P_USERID: {
|
||||
val: body.P_USERID,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
},
|
||||
);
|
||||
await connection.commit();
|
||||
|
||||
return "SP Executed Successfully"
|
||||
|
||||
|
||||
return 'SP Executed Successfully';
|
||||
} catch (err) {
|
||||
|
||||
return { error: err.message }
|
||||
} finally { }
|
||||
if (err instanceof Error) {
|
||||
return { error: err.message };
|
||||
} else {
|
||||
return { error: 'An unknown error occurred' };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,22 +1,24 @@
|
||||
import { Body, Controller, Get, Param, ParseIntPipe, Post, Query } from '@nestjs/common';
|
||||
import { CreateCarnetSequenceDTO, GetCarnetSequenceDTO } from './carnet-sequence.dto';
|
||||
import { Body, Controller, Get, Post, Query } from '@nestjs/common';
|
||||
import {
|
||||
CreateCarnetSequenceDTO,
|
||||
GetCarnetSequenceDTO,
|
||||
} from './carnet-sequence.dto';
|
||||
import { ApiTags } from '@nestjs/swagger';
|
||||
import { CarnetSequenceService } from './carnet-sequence.service';
|
||||
|
||||
@Controller('carnet-sequence')
|
||||
export class CarnetSequenceController {
|
||||
|
||||
constructor(private readonly carnetSequenceService:CarnetSequenceService){}
|
||||
constructor(private readonly carnetSequenceService: CarnetSequenceService) {}
|
||||
|
||||
@ApiTags('Carnet Sequence - Oracle')
|
||||
@Post('/CreateCarnetSequence/')
|
||||
createCarnetSequence(@Body() body: CreateCarnetSequenceDTO) {
|
||||
return this.carnetSequenceService.createCarnetSequence(body)
|
||||
return this.carnetSequenceService.createCarnetSequence(body);
|
||||
}
|
||||
|
||||
@ApiTags('Carnet Sequence - Oracle')
|
||||
@Get('/GetCarnetSequence')
|
||||
getCarnetSequence(@Query() body: GetCarnetSequenceDTO) {
|
||||
return this.carnetSequenceService.getCarnetSequence(body)
|
||||
return this.carnetSequenceService.getCarnetSequence(body);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,42 +1,42 @@
|
||||
import { ApiProperty } from "@nestjs/swagger";
|
||||
import { Transform } from "class-transformer";
|
||||
import { IsDefined, IsInt, IsNumber, IsString, Min } from "class-validator";
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { Transform } from 'class-transformer';
|
||||
import { IsDefined, IsInt, IsNumber, IsString, Min } from 'class-validator';
|
||||
|
||||
export class CreateCarnetSequenceDTO {
|
||||
@ApiProperty({ required: true })
|
||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
||||
@IsDefined({ message: "Property p_spid is required" })
|
||||
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||
@IsDefined({ message: 'Property p_spid is required' })
|
||||
p_spid: number;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsNumber({}, { message: "Property p_regionid must be a number" })
|
||||
@IsDefined({ message: "Property p_regionid is required" })
|
||||
@IsNumber({}, { message: 'Property p_regionid must be a number' })
|
||||
@IsDefined({ message: 'Property p_regionid is required' })
|
||||
p_regionid: number;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsNumber({}, { message: "Property p_startnumber must be a number" })
|
||||
@IsDefined({ message: "Property p_startnumber is required" })
|
||||
@Min(0, { message: "Property p_startnumber must be at least 0" })
|
||||
@IsNumber({}, { message: 'Property p_startnumber must be a number' })
|
||||
@IsDefined({ message: 'Property p_startnumber is required' })
|
||||
@Min(0, { message: 'Property p_startnumber must be at least 0' })
|
||||
p_startnumber: number;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsNumber({}, { message: "Property p_endnumber must be a number" })
|
||||
@IsDefined({ message: "Property p_endnumber is required" })
|
||||
@Min(0, { message: "Property p_endnumber must be at least 0" })
|
||||
@IsNumber({}, { message: 'Property p_endnumber must be a number' })
|
||||
@IsDefined({ message: 'Property p_endnumber is required' })
|
||||
@Min(0, { message: 'Property p_endnumber must be at least 0' })
|
||||
p_endnumber: number;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString({ message: "Property p_carnettype must be a string" })
|
||||
@IsDefined({ message: "Property p_carnettype is required" })
|
||||
@IsString({ message: 'Property p_carnettype must be a string' })
|
||||
@IsDefined({ message: 'Property p_carnettype is required' })
|
||||
p_carnettype: string;
|
||||
}
|
||||
|
||||
export class GetCarnetSequenceDTO{
|
||||
export class GetCarnetSequenceDTO {
|
||||
@ApiProperty({ required: true })
|
||||
@Min(0, { message: "Property p_spid must be at least 0" })
|
||||
@IsInt({ message: "Property p_SPid must be a whole number" })
|
||||
@Min(0, { message: 'Property p_spid must be at least 0' })
|
||||
@IsInt({ message: 'Property p_SPid must be a whole number' })
|
||||
@Transform(({ value }) => Number(value))
|
||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
||||
@IsDefined({ message: "Property p_spid is required" })
|
||||
p_spid:number;
|
||||
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||
@IsDefined({ message: 'Property p_spid is required' })
|
||||
p_spid: number;
|
||||
}
|
||||
@ -4,6 +4,6 @@ import { CarnetSequenceService } from './carnet-sequence.service';
|
||||
|
||||
@Module({
|
||||
controllers: [CarnetSequenceController],
|
||||
providers: [CarnetSequenceService]
|
||||
providers: [CarnetSequenceService],
|
||||
})
|
||||
export class CarnetSequenceModule {}
|
||||
|
||||
@ -1,19 +1,21 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import * as oracledb from 'oracledb';
|
||||
import { OracleDBService } from 'src/db/db.service';
|
||||
import { CreateCarnetSequenceDTO, GetCarnetSequenceDTO } from './carnet-sequence.dto';
|
||||
import {
|
||||
CreateCarnetSequenceDTO,
|
||||
GetCarnetSequenceDTO,
|
||||
} from './carnet-sequence.dto';
|
||||
|
||||
@Injectable()
|
||||
export class CarnetSequenceService {
|
||||
constructor(private readonly oracleDBService: OracleDBService) {}
|
||||
|
||||
constructor(private readonly oracleDBService:OracleDBService){}
|
||||
|
||||
async createCarnetSequence(body:CreateCarnetSequenceDTO) {
|
||||
async createCarnetSequence(body: CreateCarnetSequenceDTO) {
|
||||
let connection;
|
||||
try {
|
||||
connection = await this.oracleDBService.getConnection()
|
||||
connection = await this.oracleDBService.getConnection();
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
throw new Error('No DB Connected');
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
@ -25,48 +27,52 @@ export class CarnetSequenceService {
|
||||
:p_endnumber,
|
||||
:p_carnettype,
|
||||
:p_cursor);
|
||||
END;`, {
|
||||
END;`,
|
||||
{
|
||||
p_spid: {
|
||||
val: body.p_spid,
|
||||
type: oracledb.DB_TYPE_NUMBER
|
||||
type: oracledb.DB_TYPE_NUMBER,
|
||||
},
|
||||
p_regionid: {
|
||||
val: body.p_regionid,
|
||||
type: oracledb.DB_TYPE_NUMBER
|
||||
type: oracledb.DB_TYPE_NUMBER,
|
||||
},
|
||||
p_startnumber: {
|
||||
val: body.p_startnumber,
|
||||
type: oracledb.DB_TYPE_NUMBER
|
||||
type: oracledb.DB_TYPE_NUMBER,
|
||||
},
|
||||
p_endnumber: {
|
||||
val: body.p_endnumber,
|
||||
type: oracledb.DB_TYPE_NUMBER
|
||||
type: oracledb.DB_TYPE_NUMBER,
|
||||
},
|
||||
p_carnettype: {
|
||||
val: body.p_carnettype,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_cursor: {
|
||||
type: oracledb.CURSOR,
|
||||
dir: oracledb.BIND_OUT
|
||||
}
|
||||
}, {
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
||||
}
|
||||
dir: oracledb.BIND_OUT,
|
||||
},
|
||||
},
|
||||
{
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||
},
|
||||
);
|
||||
|
||||
await connection.commit();
|
||||
|
||||
let fres = await result.outBinds.p_cursor.getRows();
|
||||
const fres = await result.outBinds.p_cursor.getRows();
|
||||
|
||||
await result.outBinds.p_cursor.close()
|
||||
|
||||
return fres
|
||||
await result.outBinds.p_cursor.close();
|
||||
|
||||
return fres;
|
||||
} catch (err) {
|
||||
|
||||
return { error: err.message }
|
||||
} finally { }
|
||||
if (err instanceof Error) {
|
||||
return { error: err.message };
|
||||
} else {
|
||||
return { error: 'An unknown error occurred' };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async getCarnetSequence(body: GetCarnetSequenceDTO) {
|
||||
@ -74,9 +80,9 @@ export class CarnetSequenceService {
|
||||
let rows = [];
|
||||
try {
|
||||
// Connect to the Oracle database using oracledb
|
||||
connection = await this.oracleDBService.getConnection()
|
||||
connection = await this.oracleDBService.getConnection();
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
throw new Error('No DB Connected');
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
@ -90,12 +96,12 @@ export class CarnetSequenceService {
|
||||
},
|
||||
p_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) {
|
||||
@ -107,17 +113,18 @@ export class CarnetSequenceService {
|
||||
rows = rows.concat(rowsBatch);
|
||||
} while (rowsBatch.length > 0);
|
||||
|
||||
|
||||
await cursor.close();
|
||||
} else {
|
||||
throw new Error('No cursor returned from the stored procedure');
|
||||
}
|
||||
|
||||
return rows;
|
||||
|
||||
} catch (err) {
|
||||
|
||||
return { error: err.message }
|
||||
} finally { }
|
||||
if (err instanceof Error) {
|
||||
return { error: err.message };
|
||||
} else {
|
||||
return { error: 'An unknown error occurred' };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,22 +1,13 @@
|
||||
import { RegionService } from './region.service';
|
||||
|
||||
import {
|
||||
Get,
|
||||
Post,
|
||||
Body,
|
||||
Controller,
|
||||
Patch,
|
||||
} from '@nestjs/common';
|
||||
import { Get, Post, Body, Controller, Patch } from '@nestjs/common';
|
||||
|
||||
import { ApiTags } from '@nestjs/swagger';
|
||||
import { InsertRegionsDto, UpdateRegionDto } from './region.dto';
|
||||
|
||||
@Controller('oracle')
|
||||
export class RegionController {
|
||||
|
||||
constructor(
|
||||
private readonly regionService: RegionService
|
||||
) { }
|
||||
constructor(private readonly regionService: RegionService) {}
|
||||
|
||||
@ApiTags('Regions - Oracle')
|
||||
@Post('/InsertRegions')
|
||||
|
||||
@ -1,26 +1,26 @@
|
||||
import { IsDefined, IsNumber,IsString } from "class-validator";
|
||||
import { ApiProperty } from "@nestjs/swagger";
|
||||
import { IsDefined, IsNumber, IsString } from 'class-validator';
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
|
||||
export class InsertRegionsDto {
|
||||
@ApiProperty({ required: true })
|
||||
@IsString({ message: "Property p_region must be a string" })
|
||||
@IsDefined({ message: "Property p_region is required" })
|
||||
@IsString({ message: 'Property p_region must be a string' })
|
||||
@IsDefined({ message: 'Property p_region is required' })
|
||||
p_region: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString({ message: "Property p_name must be a string" })
|
||||
@IsDefined({ message: "Property p_name is required" })
|
||||
@IsString({ message: 'Property p_name must be a string' })
|
||||
@IsDefined({ message: 'Property p_name is required' })
|
||||
p_name: string;
|
||||
}
|
||||
|
||||
export class UpdateRegionDto {
|
||||
@ApiProperty({ required: true })
|
||||
@IsNumber({}, { message: "Property p_regionID must be a number" })
|
||||
@IsDefined({ message: "Property p_regionID is required" })
|
||||
@IsNumber({}, { message: 'Property p_regionID must be a number' })
|
||||
@IsDefined({ message: 'Property p_regionID is required' })
|
||||
p_regionID: number;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString({ message: "Property p_name must be a string" })
|
||||
@IsDefined({ message: "Property p_name is required" })
|
||||
@IsString({ message: 'Property p_name must be a string' })
|
||||
@IsDefined({ message: 'Property p_name is required' })
|
||||
p_name: string;
|
||||
}
|
||||
@ -4,6 +4,6 @@ import { RegionService } from './region.service';
|
||||
|
||||
@Module({
|
||||
controllers: [RegionController],
|
||||
providers: [RegionService]
|
||||
providers: [RegionService],
|
||||
})
|
||||
export class RegionModule {}
|
||||
|
||||
@ -1,95 +1,100 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { OracleDBService } from 'src/db/db.service';
|
||||
import * as oracledb from 'oracledb'
|
||||
import * as oracledb from 'oracledb';
|
||||
import { InsertRegionsDto, UpdateRegionDto } from './region.dto';
|
||||
|
||||
@Injectable()
|
||||
export class RegionService {
|
||||
|
||||
constructor(private readonly oracleDBService: OracleDBService) { }
|
||||
constructor(private readonly oracleDBService: OracleDBService) {}
|
||||
|
||||
async insertRegions(body: InsertRegionsDto) {
|
||||
let connection;
|
||||
try {
|
||||
|
||||
connection = await this.oracleDBService.getConnection()
|
||||
connection = await this.oracleDBService.getConnection();
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
throw new Error('No DB Connected');
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
`BEGIN
|
||||
USCIB_Managed_Pkg.InsertNewRegion(:p_region,:p_name,:p_cursor);
|
||||
END;`, {
|
||||
END;`,
|
||||
{
|
||||
p_region: {
|
||||
val: body.p_region,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_name: {
|
||||
val: body.p_name,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_cursor: {
|
||||
type: oracledb.CURSOR,
|
||||
dir: oracledb.BIND_OUT
|
||||
}
|
||||
}, {
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
||||
}
|
||||
dir: oracledb.BIND_OUT,
|
||||
},
|
||||
},
|
||||
{
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||
},
|
||||
);
|
||||
|
||||
await connection.commit();
|
||||
|
||||
let fres = await result.outBinds.p_cursor.getRows();
|
||||
|
||||
return fres
|
||||
const fres = await result.outBinds.p_cursor.getRows();
|
||||
|
||||
return fres;
|
||||
} catch (err) {
|
||||
|
||||
return { error: err.message }
|
||||
} finally { }
|
||||
if (err instanceof Error) {
|
||||
return { error: err.message };
|
||||
} else {
|
||||
return { error: 'An unknown error occurred' };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async updateRegions(body: UpdateRegionDto) {
|
||||
let connection;
|
||||
try {
|
||||
|
||||
connection = await this.oracleDBService.getConnection()
|
||||
connection = await this.oracleDBService.getConnection();
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
throw new Error('No DB Connected');
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
`BEGIN
|
||||
USCIB_Managed_Pkg.UpdateRegion(:p_regionID,:p_name,:p_cursor);
|
||||
END;`, {
|
||||
END;`,
|
||||
{
|
||||
p_regionID: {
|
||||
val: body.p_regionID,
|
||||
type: oracledb.DB_TYPE_NUMBER
|
||||
type: oracledb.DB_TYPE_NUMBER,
|
||||
},
|
||||
p_name: {
|
||||
val: body.p_name,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_cursor: {
|
||||
type: oracledb.CURSOR,
|
||||
dir: oracledb.BIND_OUT
|
||||
}
|
||||
}, {
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
||||
}
|
||||
dir: oracledb.BIND_OUT,
|
||||
},
|
||||
},
|
||||
{
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||
},
|
||||
);
|
||||
|
||||
await connection.commit();
|
||||
|
||||
let fres = await result.outBinds.p_cursor.getRows();
|
||||
|
||||
return fres
|
||||
const fres = await result.outBinds.p_cursor.getRows();
|
||||
|
||||
return fres;
|
||||
} catch (err) {
|
||||
|
||||
return { error: err.message }
|
||||
} finally { }
|
||||
if (err instanceof Error) {
|
||||
return { error: err.message };
|
||||
} else {
|
||||
return { error: 'An unknown error occurred' };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async getRegions() {
|
||||
@ -97,11 +102,10 @@ export class RegionService {
|
||||
let rows = [];
|
||||
try {
|
||||
try {
|
||||
connection = await this.oracleDBService.getConnection()
|
||||
}
|
||||
catch (err) {
|
||||
console.log("DB ERROR: ", err);
|
||||
return { error: "Error while connecting to DB" }
|
||||
connection = await this.oracleDBService.getConnection();
|
||||
} catch (err) {
|
||||
console.log('DB ERROR: ', err);
|
||||
return { error: 'Error while connecting to DB' };
|
||||
}
|
||||
const result = await connection.execute(
|
||||
`BEGIN
|
||||
@ -110,12 +114,12 @@ export class RegionService {
|
||||
{
|
||||
p_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) {
|
||||
@ -133,10 +137,12 @@ export class RegionService {
|
||||
}
|
||||
|
||||
return rows;
|
||||
|
||||
} catch (err) {
|
||||
|
||||
return { error: err.message }
|
||||
} finally { }
|
||||
if (err instanceof Error) {
|
||||
return { error: err.message };
|
||||
} else {
|
||||
return { error: 'An unknown error occurred' };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,43 +1,46 @@
|
||||
import { SpContactsService } from './sp-contacts.service';
|
||||
import { Body, Controller, Get, Param, ParseIntPipe, Post, Put, Query } from '@nestjs/common';
|
||||
import { getSPDefaultcontactDTO, inactivateSPContactDTO, InsertSPContactsDTO, setSPDefaultcontactDTO, UpdateSPContactsDTO } from './sp-contacts.dto';
|
||||
import { Body, Controller, Get, Post, Put, Query } from '@nestjs/common';
|
||||
import {
|
||||
getSPDefaultcontactDTO,
|
||||
inactivateSPContactDTO,
|
||||
InsertSPContactsDTO,
|
||||
setSPDefaultcontactDTO,
|
||||
UpdateSPContactsDTO,
|
||||
} from './sp-contacts.dto';
|
||||
import { ApiTags } from '@nestjs/swagger';
|
||||
|
||||
@Controller('oracle')
|
||||
export class SpContactsController {
|
||||
|
||||
constructor(
|
||||
private readonly spContactsService: SpContactsService,
|
||||
) { }
|
||||
constructor(private readonly spContactsService: SpContactsService) {}
|
||||
|
||||
@ApiTags('SPContacts - Oracle')
|
||||
@Post('/InsertSPContacts')
|
||||
insertSPContacts(@Body() body: InsertSPContactsDTO) {
|
||||
return this.spContactsService.insertSPContacts(body)
|
||||
return this.spContactsService.insertSPContacts(body);
|
||||
}
|
||||
|
||||
@ApiTags('SPContacts - Oracle')
|
||||
@Post('/SetSPDefaultcontact')
|
||||
setSPDefaultcontact(@Query() body:setSPDefaultcontactDTO) {
|
||||
return this.spContactsService.setSPDefaultcontact(body)
|
||||
setSPDefaultcontact(@Query() body: setSPDefaultcontactDTO) {
|
||||
return this.spContactsService.setSPDefaultcontact(body);
|
||||
}
|
||||
|
||||
@ApiTags('SPContacts - Oracle')
|
||||
@Put('/UpdateSPContacts')
|
||||
updateSPContacts(@Body() body: UpdateSPContactsDTO) {
|
||||
return this.spContactsService.updateSPContacts(body)
|
||||
return this.spContactsService.updateSPContacts(body);
|
||||
}
|
||||
|
||||
@ApiTags('SPContacts - Oracle')
|
||||
@Post('/InactivateSPContact')
|
||||
inactivateSPContact(@Query() body:inactivateSPContactDTO) {
|
||||
return this.spContactsService.inactivateSPContact(body)
|
||||
inactivateSPContact(@Query() body: inactivateSPContactDTO) {
|
||||
return this.spContactsService.inactivateSPContact(body);
|
||||
}
|
||||
|
||||
@ApiTags('SPContacts - Oracle')
|
||||
@Get('/GetSPDefaultcontact')
|
||||
getSPDefaultcontact(@Query() body:getSPDefaultcontactDTO) {
|
||||
return this.spContactsService.getSPDefaultcontacts(body)
|
||||
getSPDefaultcontact(@Query() body: getSPDefaultcontactDTO) {
|
||||
return this.spContactsService.getSPDefaultcontacts(body);
|
||||
}
|
||||
|
||||
// @Get('/GetAllSPcontacts')
|
||||
|
||||
@ -1,6 +1,13 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { Transform } from 'class-transformer';
|
||||
import { IsDefined, IsEmail, IsInt, IsNumber, IsString, Min } from 'class-validator';
|
||||
import {
|
||||
IsDefined,
|
||||
IsEmail,
|
||||
IsInt,
|
||||
IsNumber,
|
||||
IsString,
|
||||
Min,
|
||||
} from 'class-validator';
|
||||
|
||||
export class InsertSPContactsDTO {
|
||||
@ApiProperty({ required: true })
|
||||
@ -90,23 +97,23 @@ export class UpdateSPContactsDTO {
|
||||
p_user_id: string;
|
||||
}
|
||||
|
||||
export class setSPDefaultcontactDTO{
|
||||
export class setSPDefaultcontactDTO {
|
||||
@ApiProperty({ required: true })
|
||||
@Min(0, { message: "Property p_spcontactid must be at least 0" })
|
||||
@IsInt({ message: "Property p_SPid must be a whole number" })
|
||||
@Min(0, { message: 'Property p_spcontactid must be at least 0' })
|
||||
@IsInt({ message: 'Property p_SPid must be a whole number' })
|
||||
@Transform(({ value }) => Number(value))
|
||||
@IsNumber({}, { message: "Property p_spcontactid must be a number" })
|
||||
@IsDefined({ message: "Property p_spcontactid is required" })
|
||||
p_spcontactid:number;
|
||||
@IsNumber({}, { message: 'Property p_spcontactid must be a number' })
|
||||
@IsDefined({ message: 'Property p_spcontactid is required' })
|
||||
p_spcontactid: number;
|
||||
}
|
||||
export class inactivateSPContactDTO extends setSPDefaultcontactDTO{}
|
||||
export class inactivateSPContactDTO extends setSPDefaultcontactDTO {}
|
||||
|
||||
export class getSPDefaultcontactDTO {
|
||||
@ApiProperty({ required: true })
|
||||
@Min(0, { message: "Property p_SPid must be at least 0" })
|
||||
@IsInt({ message: "Property p_SPid must be a whole number" })
|
||||
@Min(0, { message: 'Property p_SPid must be at least 0' })
|
||||
@IsInt({ message: 'Property p_SPid must be a whole number' })
|
||||
@Transform(({ value }) => Number(value))
|
||||
@IsNumber({}, { message: "Property p_SPid must be a number" })
|
||||
@IsDefined({ message: "Property p_SPid is required" })
|
||||
p_SPid:number;
|
||||
@IsNumber({}, { message: 'Property p_SPid must be a number' })
|
||||
@IsDefined({ message: 'Property p_SPid is required' })
|
||||
p_SPid: number;
|
||||
}
|
||||
@ -4,8 +4,8 @@ import { SpContactsController } from './sp-contacts.controller';
|
||||
import { DbModule } from 'src/db/db.module';
|
||||
|
||||
@Module({
|
||||
imports:[DbModule],
|
||||
imports: [DbModule],
|
||||
providers: [SpContactsService],
|
||||
controllers: [SpContactsController]
|
||||
controllers: [SpContactsController],
|
||||
})
|
||||
export class SpContactsModule {}
|
||||
|
||||
@ -1,26 +1,24 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { OracleDBService } from 'src/db/db.service';
|
||||
import * as oracledb from 'oracledb'
|
||||
import * as oracledb from 'oracledb';
|
||||
import {
|
||||
getSPDefaultcontactDTO,
|
||||
inactivateSPContactDTO,
|
||||
InsertSPContactsDTO,
|
||||
setSPDefaultcontactDTO,
|
||||
UpdateSPContactsDTO
|
||||
UpdateSPContactsDTO,
|
||||
} from './sp-contacts.dto';
|
||||
|
||||
@Injectable()
|
||||
export class SpContactsService {
|
||||
|
||||
constructor(private readonly oracleDBService: OracleDBService) { }
|
||||
constructor(private readonly oracleDBService: OracleDBService) {}
|
||||
|
||||
async insertSPContacts(body: InsertSPContactsDTO) {
|
||||
let connection;
|
||||
try {
|
||||
|
||||
connection = await this.oracleDBService.getConnection()
|
||||
connection = await this.oracleDBService.getConnection();
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
throw new Error('No DB Connected');
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
@ -38,80 +36,82 @@ export class SpContactsService {
|
||||
:p_emailaddress,
|
||||
:p_user_id,
|
||||
:p_cursor);
|
||||
END;`, {
|
||||
END;`,
|
||||
{
|
||||
p_spid: {
|
||||
val: body.p_spid,
|
||||
type: oracledb.DB_TYPE_NUMBER
|
||||
type: oracledb.DB_TYPE_NUMBER,
|
||||
},
|
||||
p_defcontactflag: {
|
||||
val: body.p_defcontactflag,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_firstname: {
|
||||
val: body.p_firstname,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_lastname: {
|
||||
val: body.p_lastname,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
P_MIDDLEINITIAL: {
|
||||
val: body.P_MIDDLEINITIAL,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_title: {
|
||||
val: body.p_title,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_phoneno: {
|
||||
val: body.p_phoneno,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_mobileno: {
|
||||
val: body.p_mobileno,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_faxno: {
|
||||
val: body.p_faxno,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_emailaddress: {
|
||||
val: body.p_emailaddress,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_user_id: {
|
||||
val: body.p_user_id,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_cursor: {
|
||||
type: oracledb.CURSOR,
|
||||
dir: oracledb.BIND_OUT
|
||||
}
|
||||
}, {
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
||||
}
|
||||
dir: oracledb.BIND_OUT,
|
||||
},
|
||||
},
|
||||
{
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||
},
|
||||
);
|
||||
|
||||
await connection.commit();
|
||||
|
||||
let fres = await result.outBinds.p_cursor.getRows();
|
||||
|
||||
return fres
|
||||
const fres = await result.outBinds.p_cursor.getRows();
|
||||
|
||||
return fres;
|
||||
} catch (err) {
|
||||
|
||||
return { error: err.message }
|
||||
} finally { }
|
||||
if (err instanceof Error) {
|
||||
return { error: err.message };
|
||||
} else {
|
||||
return { error: 'An unknown error occurred' };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async setSPDefaultcontact(body: setSPDefaultcontactDTO) {
|
||||
|
||||
let connection;
|
||||
try {
|
||||
|
||||
connection = await this.oracleDBService.getConnection()
|
||||
connection = await this.oracleDBService.getConnection();
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
throw new Error('No DB Connected');
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
@ -121,29 +121,29 @@ export class SpContactsService {
|
||||
{
|
||||
p_spcontactid: {
|
||||
val: body.p_spcontactid,
|
||||
type: oracledb.DB_TYPE_NUMBER
|
||||
type: oracledb.DB_TYPE_NUMBER,
|
||||
},
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
await connection.commit();
|
||||
|
||||
return "SP executed successfully"
|
||||
|
||||
return 'SP executed successfully';
|
||||
} catch (err) {
|
||||
|
||||
return { error: err.message }
|
||||
} finally { }
|
||||
|
||||
if (err instanceof Error) {
|
||||
return { error: err.message };
|
||||
} else {
|
||||
return { error: 'An unknown error occurred' };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async updateSPContacts(body: UpdateSPContactsDTO) {
|
||||
let connection;
|
||||
try {
|
||||
|
||||
connection = await this.oracleDBService.getConnection()
|
||||
connection = await this.oracleDBService.getConnection();
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
throw new Error('No DB Connected');
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
@ -160,109 +160,111 @@ export class SpContactsService {
|
||||
:p_emailaddress,
|
||||
:p_user_id,
|
||||
:p_cursor);
|
||||
END;`, {
|
||||
END;`,
|
||||
{
|
||||
p_spcontactid: {
|
||||
val: body.p_spcontactid,
|
||||
type: oracledb.DB_TYPE_NUMBER
|
||||
type: oracledb.DB_TYPE_NUMBER,
|
||||
},
|
||||
p_firstname: {
|
||||
val: body.p_firstname,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_lastname: {
|
||||
val: body.p_lastname,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
P_MIDDLEINITIAL: {
|
||||
val: body.P_MIDDLEINITIAL,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_title: {
|
||||
val: body.p_title,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_phoneno: {
|
||||
val: body.p_phoneno,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_mobileno: {
|
||||
val: body.p_mobileno,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_faxno: {
|
||||
val: body.p_faxno,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_emailaddress: {
|
||||
val: body.p_emailaddress,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_user_id: {
|
||||
val: body.p_user_id,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_cursor: {
|
||||
type: oracledb.CURSOR,
|
||||
dir: oracledb.BIND_OUT
|
||||
}
|
||||
}, {
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
||||
}
|
||||
dir: oracledb.BIND_OUT,
|
||||
},
|
||||
},
|
||||
{
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||
},
|
||||
);
|
||||
|
||||
await connection.commit();
|
||||
|
||||
let fres = await result.outBinds.p_cursor.getRows();
|
||||
|
||||
return fres
|
||||
const fres = await result.outBinds.p_cursor.getRows();
|
||||
|
||||
return fres;
|
||||
} catch (err) {
|
||||
|
||||
return { error: err.message }
|
||||
} finally { }
|
||||
if (err instanceof Error) {
|
||||
return { error: err.message };
|
||||
} else {
|
||||
return { error: 'An unknown error occurred' };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async inactivateSPContact(body: inactivateSPContactDTO) {
|
||||
|
||||
let connection;
|
||||
try {
|
||||
|
||||
connection = await this.oracleDBService.getConnection()
|
||||
connection = await this.oracleDBService.getConnection();
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
throw new Error('No DB Connected');
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
`BEGIN
|
||||
USCIB_Managed_Pkg.InActivateSPContacts(:p_spcontactid);
|
||||
END;`, {
|
||||
END;`,
|
||||
{
|
||||
p_spcontactid: {
|
||||
val: body.p_spcontactid,
|
||||
type: oracledb.DB_TYPE_NUMBER
|
||||
}
|
||||
}
|
||||
type: oracledb.DB_TYPE_NUMBER,
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
await connection.commit();
|
||||
|
||||
return "SP executed successfully"
|
||||
|
||||
return 'SP executed successfully';
|
||||
} catch (err) {
|
||||
|
||||
return { error: err.message }
|
||||
} finally { }
|
||||
|
||||
if (err instanceof Error) {
|
||||
return { error: err.message };
|
||||
} else {
|
||||
return { error: 'An unknown error occurred' };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async getSPDefaultcontacts(body: getSPDefaultcontactDTO) {
|
||||
|
||||
let connection;
|
||||
let rows = [];
|
||||
try {
|
||||
|
||||
connection = await this.oracleDBService.getConnection()
|
||||
connection = await this.oracleDBService.getConnection();
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
throw new Error('No DB Connected');
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
@ -276,12 +278,12 @@ export class SpContactsService {
|
||||
},
|
||||
p_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) {
|
||||
@ -293,29 +295,28 @@ export class SpContactsService {
|
||||
rows = rows.concat(rowsBatch);
|
||||
} while (rowsBatch.length > 0);
|
||||
|
||||
|
||||
await cursor.close();
|
||||
} else {
|
||||
throw new Error('No cursor returned from the stored procedure');
|
||||
}
|
||||
|
||||
return rows;
|
||||
|
||||
} catch (err) {
|
||||
|
||||
return { error: err.message }
|
||||
} finally { }
|
||||
|
||||
if (err instanceof Error) {
|
||||
return { error: err.message };
|
||||
} else {
|
||||
return { error: 'An unknown error occurred' };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async getSPcontacts() {
|
||||
let connection;
|
||||
let rows = [];
|
||||
try {
|
||||
|
||||
connection = await this.oracleDBService.getConnection()
|
||||
connection = await this.oracleDBService.getConnection();
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
throw new Error('No DB Connected');
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
@ -325,12 +326,12 @@ export class SpContactsService {
|
||||
{
|
||||
p_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) {
|
||||
@ -342,19 +343,18 @@ export class SpContactsService {
|
||||
rows = rows.concat(rowsBatch);
|
||||
} while (rowsBatch.length > 0);
|
||||
|
||||
|
||||
|
||||
|
||||
await cursor.close();
|
||||
} else {
|
||||
throw new Error('No cursor returned from the stored procedure');
|
||||
}
|
||||
|
||||
return rows;
|
||||
|
||||
} catch (err) {
|
||||
|
||||
return { error: err.message }
|
||||
} finally { }
|
||||
if (err instanceof Error) {
|
||||
return { error: err.message };
|
||||
} 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 { ApiTags } from '@nestjs/swagger';
|
||||
import { getSelectedServiceproviderDTO, InsertNewServiceProviderDTO, UpdateServiceProviderDTO } from './sp.dto';
|
||||
import {
|
||||
getSelectedServiceproviderDTO,
|
||||
InsertNewServiceProviderDTO,
|
||||
UpdateServiceProviderDTO,
|
||||
} from './sp.dto';
|
||||
|
||||
@Controller('oracle')
|
||||
export class SpController {
|
||||
|
||||
constructor(
|
||||
private readonly spService: SpService
|
||||
) { }
|
||||
constructor(private readonly spService: SpService) {}
|
||||
|
||||
@ApiTags('SP - Oracle')
|
||||
@Post('/InsertNewServiceProvider')
|
||||
insertNewServiceProvider(@Body() body: InsertNewServiceProviderDTO) {
|
||||
return this.spService.insertNewServiceProvider(body)
|
||||
return this.spService.insertNewServiceProvider(body);
|
||||
}
|
||||
|
||||
@ApiTags('SP - Oracle')
|
||||
@Put('/UpdateServiceProvider')
|
||||
updateServiceProider(@Body() body: UpdateServiceProviderDTO) {
|
||||
return this.spService.updateServiceProvider(body)
|
||||
return this.spService.updateServiceProvider(body);
|
||||
}
|
||||
|
||||
@ApiTags('SP - Oracle')
|
||||
@ -30,7 +31,7 @@ export class SpController {
|
||||
|
||||
@ApiTags('SP - Oracle')
|
||||
@Get('/GetSelectedServiceprovider')
|
||||
getSelectedServiceprovider(@Query() body:getSelectedServiceproviderDTO) {
|
||||
getSelectedServiceprovider(@Query() body: getSelectedServiceproviderDTO) {
|
||||
return this.spService.getServiceproviderByID(body);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,183 +1,189 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { Transform } from 'class-transformer';
|
||||
import { IsDefined, IsInt, IsNumber, IsOptional, IsString, Min } from 'class-validator';
|
||||
import {
|
||||
IsDefined,
|
||||
IsInt,
|
||||
IsNumber,
|
||||
IsOptional,
|
||||
IsString,
|
||||
Min,
|
||||
} from 'class-validator';
|
||||
|
||||
export class InsertNewServiceProviderDTO {
|
||||
@ApiProperty({ required: true })
|
||||
@IsString({ message: "Property p_name must be a string" })
|
||||
@IsDefined({ message: "Property p_name is required" })
|
||||
@IsString({ message: 'Property p_name must be a string' })
|
||||
@IsDefined({ message: 'Property p_name is required' })
|
||||
p_name: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString({ message: "Property p_lookupcode must be a string" })
|
||||
@IsDefined({ message: "Property p_lookupcode is required" })
|
||||
@IsString({ message: 'Property p_lookupcode must be a string' })
|
||||
@IsDefined({ message: 'Property p_lookupcode is required' })
|
||||
p_lookupcode: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString({ message: "Property p_address1 must be a string" })
|
||||
@IsDefined({ message: "Property p_address1 is required" })
|
||||
@IsString({ message: 'Property p_address1 must be a string' })
|
||||
@IsDefined({ message: 'Property p_address1 is required' })
|
||||
p_address1: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@IsString({ message: "Property p_address2 must be a string" })
|
||||
@IsString({ message: 'Property p_address2 must be a string' })
|
||||
@IsOptional()
|
||||
p_address2?: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString({ message: "Property p_city must be a string" })
|
||||
@IsDefined({ message: "Property p_city is required" })
|
||||
@IsString({ message: 'Property p_city must be a string' })
|
||||
@IsDefined({ message: 'Property p_city is required' })
|
||||
p_city: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString({ message: "Property p_state must be a string" })
|
||||
@IsDefined({ message: "Property p_state is required" })
|
||||
@IsString({ message: 'Property p_state must be a string' })
|
||||
@IsDefined({ message: 'Property p_state is required' })
|
||||
p_state: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString({ message: "Property p_zip must be a string" })
|
||||
@IsDefined({ message: "Property p_zip is required" })
|
||||
@IsString({ message: 'Property p_zip must be a string' })
|
||||
@IsDefined({ message: 'Property p_zip is required' })
|
||||
p_zip: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString({ message: "Property p_country must be a string" })
|
||||
@IsDefined({ message: "Property p_country is required" })
|
||||
@IsString({ message: 'Property p_country must be a string' })
|
||||
@IsDefined({ message: 'Property p_country is required' })
|
||||
p_country: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString({ message: "Property p_issuingregion must be a string" })
|
||||
@IsDefined({ message: "Property p_issuingregion is required" })
|
||||
@IsString({ message: 'Property p_issuingregion must be a string' })
|
||||
@IsDefined({ message: 'Property p_issuingregion is required' })
|
||||
p_issuingregion: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString({ message: "Property p_replacementregion must be a string" })
|
||||
@IsDefined({ message: "Property p_replacementregion is required" })
|
||||
@IsString({ message: 'Property p_replacementregion must be a string' })
|
||||
@IsDefined({ message: 'Property p_replacementregion is required' })
|
||||
p_replacementregion: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString({ message: "Property p_bondsurety must be a string" })
|
||||
@IsDefined({ message: "Property p_bondsurety is required" })
|
||||
@IsString({ message: 'Property p_bondsurety must be a string' })
|
||||
@IsDefined({ message: 'Property p_bondsurety is required' })
|
||||
p_bondsurety: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString({ message: "Property p_cargopolicyno must be a string" })
|
||||
@IsDefined({ message: "Property p_cargopolicyno is required" })
|
||||
@IsString({ message: 'Property p_cargopolicyno must be a string' })
|
||||
@IsDefined({ message: 'Property p_cargopolicyno is required' })
|
||||
p_cargopolicyno: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString({ message: "Property p_cargosurety must be a string" })
|
||||
@IsDefined({ message: "Property p_cargosurety is required" })
|
||||
@IsString({ message: 'Property p_cargosurety must be a string' })
|
||||
@IsDefined({ message: 'Property p_cargosurety is required' })
|
||||
p_cargosurety: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString({ message: "Property p_user_id must be a string" })
|
||||
@IsDefined({ message: "Property p_user_id is required" })
|
||||
@IsString({ message: 'Property p_user_id must be a string' })
|
||||
@IsDefined({ message: 'Property p_user_id is required' })
|
||||
p_user_id: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@IsString({ message: "Property P_NOTES must be a string" })
|
||||
@IsString({ message: 'Property P_NOTES must be a string' })
|
||||
@IsOptional()
|
||||
P_NOTES?: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@IsString({ message: "Property P_FILEIDS must be a string" })
|
||||
@IsString({ message: 'Property P_FILEIDS must be a string' })
|
||||
@IsOptional()
|
||||
P_FILEIDS?: string;
|
||||
}
|
||||
|
||||
export class UpdateServiceProviderDTO {
|
||||
@ApiProperty({ required: true })
|
||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
||||
@IsDefined({ message: "Property p_spid is required" })
|
||||
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||
@IsDefined({ message: 'Property p_spid is required' })
|
||||
p_spid: number;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString({ message: "Property p_name must be a string" })
|
||||
@IsDefined({ message: "Property p_name is required" })
|
||||
@IsString({ message: 'Property p_name must be a string' })
|
||||
@IsDefined({ message: 'Property p_name is required' })
|
||||
p_name: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString({ message: "Property p_lookupcode must be a string" })
|
||||
@IsDefined({ message: "Property p_lookupcode is required" })
|
||||
@IsString({ message: 'Property p_lookupcode must be a string' })
|
||||
@IsDefined({ message: 'Property p_lookupcode is required' })
|
||||
p_lookupcode: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString({ message: "Property p_address1 must be a string" })
|
||||
@IsDefined({ message: "Property p_address1 is required" })
|
||||
@IsString({ message: 'Property p_address1 must be a string' })
|
||||
@IsDefined({ message: 'Property p_address1 is required' })
|
||||
p_address1: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@IsString({ message: "Property p_address2 must be a string" })
|
||||
@IsString({ message: 'Property p_address2 must be a string' })
|
||||
@IsOptional()
|
||||
p_address2?: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString({ message: "Property p_city must be a string" })
|
||||
@IsDefined({ message: "Property p_city is required" })
|
||||
@IsString({ message: 'Property p_city must be a string' })
|
||||
@IsDefined({ message: 'Property p_city is required' })
|
||||
p_city: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString({ message: "Property p_state must be a string" })
|
||||
@IsDefined({ message: "Property p_state is required" })
|
||||
@IsString({ message: 'Property p_state must be a string' })
|
||||
@IsDefined({ message: 'Property p_state is required' })
|
||||
p_state: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString({ message: "Property p_zip must be a string" })
|
||||
@IsDefined({ message: "Property p_zip is required" })
|
||||
@IsString({ message: 'Property p_zip must be a string' })
|
||||
@IsDefined({ message: 'Property p_zip is required' })
|
||||
p_zip: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString({ message: "Property p_country must be a string" })
|
||||
@IsDefined({ message: "Property p_country is required" })
|
||||
@IsString({ message: 'Property p_country must be a string' })
|
||||
@IsDefined({ message: 'Property p_country is required' })
|
||||
p_country: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString({ message: "Property p_issuingregion must be a string" })
|
||||
@IsDefined({ message: "Property p_issuingregion is required" })
|
||||
@IsString({ message: 'Property p_issuingregion must be a string' })
|
||||
@IsDefined({ message: 'Property p_issuingregion is required' })
|
||||
p_issuingregion: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString({ message: "Property p_replacementregion must be a string" })
|
||||
@IsDefined({ message: "Property p_replacementregion is required" })
|
||||
@IsString({ message: 'Property p_replacementregion must be a string' })
|
||||
@IsDefined({ message: 'Property p_replacementregion is required' })
|
||||
p_replacementregion: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString({ message: "Property p_bondsurety must be a string" })
|
||||
@IsDefined({ message: "Property p_bondsurety is required" })
|
||||
@IsString({ message: 'Property p_bondsurety must be a string' })
|
||||
@IsDefined({ message: 'Property p_bondsurety is required' })
|
||||
p_bondsurety: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString({ message: "Property p_cargopolicyno must be a string" })
|
||||
@IsDefined({ message: "Property p_cargopolicyno is required" })
|
||||
@IsString({ message: 'Property p_cargopolicyno must be a string' })
|
||||
@IsDefined({ message: 'Property p_cargopolicyno is required' })
|
||||
p_cargopolicyno: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString({ message: "Property p_cargosurety must be a string" })
|
||||
@IsDefined({ message: "Property p_cargosurety is required" })
|
||||
@IsString({ message: 'Property p_cargosurety must be a string' })
|
||||
@IsDefined({ message: 'Property p_cargosurety is required' })
|
||||
p_cargosurety: string;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString({ message: "Property p_user_id must be a string" })
|
||||
@IsDefined({ message: "Property p_user_id is required" })
|
||||
@IsString({ message: 'Property p_user_id must be a string' })
|
||||
@IsDefined({ message: 'Property p_user_id is required' })
|
||||
p_user_id: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@IsString({ message: "Property P_NOTES must be a string" })
|
||||
@IsString({ message: 'Property P_NOTES must be a string' })
|
||||
@IsOptional()
|
||||
P_NOTES?: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@IsString({ message: "Property P_FILEIDS must be a string" })
|
||||
@IsString({ message: 'Property P_FILEIDS must be a string' })
|
||||
@IsOptional()
|
||||
P_FILEIDS?: string;
|
||||
}
|
||||
|
||||
export class getSelectedServiceproviderDTO{
|
||||
export class getSelectedServiceproviderDTO {
|
||||
@ApiProperty({ required: true })
|
||||
@Min(0, { message: "Property p_spid must be at least 0" })
|
||||
@IsInt({ message: "Property p_SPid must be a whole number" })
|
||||
@Min(0, { message: 'Property p_spid must be at least 0' })
|
||||
@IsInt({ message: 'Property p_SPid must be a whole number' })
|
||||
@Transform(({ value }) => Number(value))
|
||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
||||
@IsDefined({ message: "Property p_spid is required" })
|
||||
p_spid:number;
|
||||
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||
@IsDefined({ message: 'Property p_spid is required' })
|
||||
p_spid: number;
|
||||
}
|
||||
|
||||
|
||||
@ -4,6 +4,6 @@ import { SpService } from './sp.service';
|
||||
|
||||
@Module({
|
||||
controllers: [SpController],
|
||||
providers: [SpService]
|
||||
providers: [SpService],
|
||||
})
|
||||
export class SpModule {}
|
||||
|
||||
@ -1,21 +1,22 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { OracleDBService } from 'src/db/db.service';
|
||||
import * as oracledb from 'oracledb'
|
||||
import { getSelectedServiceproviderDTO, InsertNewServiceProviderDTO, UpdateServiceProviderDTO } from './sp.dto';
|
||||
import * as oracledb from 'oracledb';
|
||||
import {
|
||||
getSelectedServiceproviderDTO,
|
||||
InsertNewServiceProviderDTO,
|
||||
UpdateServiceProviderDTO,
|
||||
} from './sp.dto';
|
||||
|
||||
@Injectable()
|
||||
export class SpService {
|
||||
|
||||
constructor(private readonly oracleDBService: OracleDBService) { }
|
||||
constructor(private readonly oracleDBService: OracleDBService) {}
|
||||
|
||||
async insertNewServiceProvider(body: InsertNewServiceProviderDTO) {
|
||||
|
||||
let connection;
|
||||
try {
|
||||
|
||||
connection = await this.oracleDBService.getConnection()
|
||||
connection = await this.oracleDBService.getConnection();
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
throw new Error('No DB Connected');
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
@ -38,101 +39,102 @@ export class SpService {
|
||||
:P_NOTES,
|
||||
:P_FILEIDS,
|
||||
:p_cursor);
|
||||
END;`, {
|
||||
END;`,
|
||||
{
|
||||
p_name: {
|
||||
val: body.p_name,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_lookupcode: {
|
||||
val: body.p_lookupcode,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_address1: {
|
||||
val: body.p_address1,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_address2: {
|
||||
val: body.p_address2,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_city: {
|
||||
val: body.p_city,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_state: {
|
||||
val: body.p_state,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_zip: {
|
||||
val: body.p_zip,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_country: {
|
||||
val: body.p_country,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_issuingregion: {
|
||||
val: body.p_issuingregion,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_replacementregion: {
|
||||
val: body.p_replacementregion,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_bondsurety: {
|
||||
val: body.p_bondsurety,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_cargopolicyno: {
|
||||
val: body.p_cargopolicyno,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_cargosurety: {
|
||||
val: body.p_cargosurety,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_user_id: {
|
||||
val: body.p_user_id,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
P_NOTES: {
|
||||
val: body.P_NOTES,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
P_FILEIDS: {
|
||||
val: body.P_FILEIDS,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
|
||||
p_cursor: {
|
||||
type: oracledb.CURSOR,
|
||||
dir: oracledb.BIND_OUT
|
||||
}
|
||||
}, {
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
||||
}
|
||||
dir: oracledb.BIND_OUT,
|
||||
},
|
||||
},
|
||||
{
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||
},
|
||||
);
|
||||
await connection.commit();
|
||||
|
||||
let fres = await result.outBinds.p_cursor.getRows();
|
||||
|
||||
return fres
|
||||
const fres = await result.outBinds.p_cursor.getRows();
|
||||
|
||||
return fres;
|
||||
} catch (err) {
|
||||
|
||||
return { error: err.message }
|
||||
} finally { }
|
||||
|
||||
if (err instanceof Error) {
|
||||
return { error: err.message };
|
||||
} else {
|
||||
return { error: 'An unknown error occurred' };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async updateServiceProvider(body: UpdateServiceProviderDTO) {
|
||||
|
||||
let connection;
|
||||
try {
|
||||
|
||||
connection = await this.oracleDBService.getConnection()
|
||||
connection = await this.oracleDBService.getConnection();
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
throw new Error('No DB Connected');
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
@ -156,106 +158,107 @@ export class SpService {
|
||||
:P_NOTES,
|
||||
:P_FILEIDS,
|
||||
:p_cursor);
|
||||
END;`, {
|
||||
END;`,
|
||||
{
|
||||
p_spid: {
|
||||
val: body.p_spid,
|
||||
type: oracledb.DB_TYPE_NUMBER
|
||||
type: oracledb.DB_TYPE_NUMBER,
|
||||
},
|
||||
p_name: {
|
||||
val: body.p_name,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_lookupcode: {
|
||||
val: body.p_lookupcode,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_address1: {
|
||||
val: body.p_address1,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_address2: {
|
||||
val: body.p_address2,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_city: {
|
||||
val: body.p_city,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_state: {
|
||||
val: body.p_state,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_zip: {
|
||||
val: body.p_zip,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_country: {
|
||||
val: body.p_country,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_issuingregion: {
|
||||
val: body.p_issuingregion,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_replacementregion: {
|
||||
val: body.p_replacementregion,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_bondsurety: {
|
||||
val: body.p_bondsurety,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_cargopolicyno: {
|
||||
val: body.p_cargopolicyno,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_cargosurety: {
|
||||
val: body.p_cargosurety,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_user_id: {
|
||||
val: body.p_user_id,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
P_NOTES: {
|
||||
val: body.P_NOTES,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
P_FILEIDS: {
|
||||
val: body.P_FILEIDS,
|
||||
type: oracledb.DB_TYPE_VARCHAR
|
||||
type: oracledb.DB_TYPE_VARCHAR,
|
||||
},
|
||||
p_cursor: {
|
||||
type: oracledb.CURSOR,
|
||||
dir: oracledb.BIND_OUT
|
||||
}
|
||||
}, {
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
||||
}
|
||||
dir: oracledb.BIND_OUT,
|
||||
},
|
||||
},
|
||||
{
|
||||
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||
},
|
||||
);
|
||||
|
||||
await connection.commit();
|
||||
|
||||
let fres = await result.outBinds.p_cursor.getRows();
|
||||
|
||||
return fres
|
||||
const fres = await result.outBinds.p_cursor.getRows();
|
||||
|
||||
return fres;
|
||||
} catch (err) {
|
||||
|
||||
return { error: err.message }
|
||||
} finally { }
|
||||
|
||||
if (err instanceof Error) {
|
||||
return { error: err.message };
|
||||
} else {
|
||||
return { error: 'An unknown error occurred' };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async getAllServiceproviders() {
|
||||
|
||||
let connection;
|
||||
let rows = [];
|
||||
try {
|
||||
|
||||
connection = await this.oracleDBService.getConnection()
|
||||
connection = await this.oracleDBService.getConnection();
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
throw new Error('No DB Connected');
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
@ -265,12 +268,12 @@ export class SpService {
|
||||
{
|
||||
p_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) {
|
||||
@ -282,30 +285,28 @@ export class SpService {
|
||||
rows = rows.concat(rowsBatch);
|
||||
} while (rowsBatch.length > 0);
|
||||
|
||||
|
||||
await cursor.close();
|
||||
|
||||
return rows;
|
||||
} else {
|
||||
throw new Error('No cursor returned from the stored procedure');
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
|
||||
return { error: err.message }
|
||||
} finally { }
|
||||
|
||||
if (err instanceof Error) {
|
||||
return { error: err.message };
|
||||
} else {
|
||||
return { error: 'An unknown error occurred' };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async getServiceproviderByID(body:getSelectedServiceproviderDTO) {
|
||||
|
||||
async getServiceproviderByID(body: getSelectedServiceproviderDTO) {
|
||||
let connection;
|
||||
let rows = [];
|
||||
try {
|
||||
|
||||
connection = await this.oracleDBService.getConnection()
|
||||
connection = await this.oracleDBService.getConnection();
|
||||
if (!connection) {
|
||||
throw new Error('No DB Connected')
|
||||
throw new Error('No DB Connected');
|
||||
}
|
||||
|
||||
const result = await connection.execute(
|
||||
@ -319,12 +320,12 @@ export class SpService {
|
||||
},
|
||||
p_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) {
|
||||
@ -342,11 +343,12 @@ export class SpService {
|
||||
}
|
||||
|
||||
return rows;
|
||||
|
||||
} catch (err) {
|
||||
|
||||
return { error: err.message }
|
||||
} finally { }
|
||||
|
||||
if (err instanceof Error) {
|
||||
return { error: err.message };
|
||||
} else {
|
||||
return { error: 'An unknown error occurred' };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,6 +7,6 @@ import { CarnetSequenceModule } from './carnet-sequence/carnet-sequence.module';
|
||||
@Module({
|
||||
controllers: [],
|
||||
providers: [],
|
||||
imports: [RegionModule, SpModule, SpContactsModule, CarnetSequenceModule]
|
||||
imports: [RegionModule, SpModule, SpContactsModule, CarnetSequenceModule],
|
||||
})
|
||||
export class UscibManagedSpModule {}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user