removed unused code
This commit is contained in:
parent
2f1fca47c8
commit
cfa37000e9
@ -4,7 +4,7 @@ import { OracleModule } from './oracle/oracle.module';
|
|||||||
import { AuthModule } from './auth/auth.module';
|
import { AuthModule } from './auth/auth.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [ AuthModule, DbModule, OracleModule],
|
imports: [AuthModule, DbModule, OracleModule],
|
||||||
controllers: [],
|
controllers: [],
|
||||||
providers: [],
|
providers: [],
|
||||||
})
|
})
|
||||||
|
|||||||
@ -5,12 +5,11 @@ import { AuthLoginDTO } from './auth.dto';
|
|||||||
|
|
||||||
@Controller()
|
@Controller()
|
||||||
export class AuthController {
|
export class AuthController {
|
||||||
|
constructor(private readonly authService: AuthService) {}
|
||||||
|
|
||||||
constructor(private readonly authService:AuthService){}
|
@ApiTags('Auth')
|
||||||
|
@Post('/login')
|
||||||
@ApiTags('Auth')
|
login(@Body() body: AuthLoginDTO) {
|
||||||
@Post('/login')
|
return this.authService.login(body);
|
||||||
login(@Body() body:AuthLoginDTO){
|
}
|
||||||
return this.authService.login(body);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,13 +1,12 @@
|
|||||||
import { ApiProperty } from "@nestjs/swagger";
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
import { IsString } from "class-validator";
|
import { IsString } from 'class-validator';
|
||||||
|
|
||||||
export class AuthLoginDTO{
|
export class AuthLoginDTO {
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsString()
|
||||||
|
p_emailaddr: string;
|
||||||
|
|
||||||
@ApiProperty({required:true})
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
p_emailaddr:string;
|
p_password: string;
|
||||||
|
|
||||||
@ApiProperty({required:true})
|
|
||||||
@IsString()
|
|
||||||
p_password:string;
|
|
||||||
}
|
}
|
||||||
@ -1,12 +1,11 @@
|
|||||||
import { Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { AuthService } from './auth.service';
|
import { AuthService } from './auth.service';
|
||||||
import { AuthController } from './auth.controller';
|
import { AuthController } from './auth.controller';
|
||||||
import { OracleDBService } from 'src/db/db.service';
|
|
||||||
import { DbModule } from 'src/db/db.module';
|
import { DbModule } from 'src/db/db.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports:[DbModule],
|
imports: [DbModule],
|
||||||
providers: [AuthService],
|
providers: [AuthService],
|
||||||
controllers: [AuthController]
|
controllers: [AuthController],
|
||||||
})
|
})
|
||||||
export class AuthModule {}
|
export class AuthModule {}
|
||||||
|
|||||||
@ -1,70 +1,67 @@
|
|||||||
import { BadRequestException, Injectable } from '@nestjs/common';
|
import { BadRequestException, Injectable } from '@nestjs/common';
|
||||||
import { OracleDBService } from 'src/db/db.service';
|
import { OracleDBService } from 'src/db/db.service';
|
||||||
import { AuthLoginDTO } from './auth.dto';
|
import { AuthLoginDTO } from './auth.dto';
|
||||||
import * as oracledb from 'oracledb'
|
import * as oracledb from 'oracledb';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AuthService {
|
export class AuthService {
|
||||||
|
constructor(private readonly oracleDBService: OracleDBService) {}
|
||||||
|
|
||||||
constructor(private readonly oracleDBService: OracleDBService) { }
|
async login(body: AuthLoginDTO) {
|
||||||
|
let connection;
|
||||||
|
let rows = [];
|
||||||
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
|
if (!connection) {
|
||||||
|
throw new Error('No DB Connected');
|
||||||
|
}
|
||||||
|
|
||||||
async login(body:AuthLoginDTO) {
|
const result = await connection.execute(
|
||||||
let connection;
|
`BEGIN
|
||||||
let rows = [];
|
|
||||||
let crows:any = [];
|
|
||||||
try {
|
|
||||||
connection = await this.oracleDBService.getConnection()
|
|
||||||
if (!connection) {
|
|
||||||
throw new Error('No DB Connected')
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = await connection.execute(
|
|
||||||
`BEGIN
|
|
||||||
USERLOGIN_PKG.ValidateUser(:p_emailaddr,:p_password,:p_login_cursor);
|
USERLOGIN_PKG.ValidateUser(:p_emailaddr,:p_password,:p_login_cursor);
|
||||||
END;`,
|
END;`,
|
||||||
{
|
{
|
||||||
p_emailaddr: {
|
p_emailaddr: {
|
||||||
val: body.p_emailaddr,
|
val: body.p_emailaddr,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_password: {
|
p_password: {
|
||||||
val: body.p_password,
|
val: body.p_password,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_login_cursor: {
|
p_login_cursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result.outBinds && result.outBinds.p_login_cursor) {
|
if (result.outBinds && result.outBinds.p_login_cursor) {
|
||||||
const cursor = result.outBinds.p_login_cursor;
|
const cursor = result.outBinds.p_login_cursor;
|
||||||
let rowsBatch;
|
let rowsBatch;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
rowsBatch = await cursor.getRows(100);
|
rowsBatch = await cursor.getRows(100);
|
||||||
rows = rows.concat(rowsBatch);
|
rows = rows.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
await cursor.close();
|
|
||||||
} else {
|
|
||||||
return new BadRequestException({Error:"Error executing request try after some time!"});
|
|
||||||
}
|
|
||||||
|
|
||||||
if(rows[0]["ERRORMESG"]){
|
|
||||||
return {error:"Invalid username or password!"}
|
|
||||||
}
|
|
||||||
return {msg:"Logged in successfully"}
|
|
||||||
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Error fetching users: ', err.message);
|
|
||||||
return {error:"Invalid username or password"}
|
|
||||||
} finally { }
|
|
||||||
|
|
||||||
|
await cursor.close();
|
||||||
|
} else {
|
||||||
|
return new BadRequestException({
|
||||||
|
Error: 'Error executing request try after some time!',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rows[0]['ERRORMESG']) {
|
||||||
|
return { error: 'Invalid username or password!' };
|
||||||
|
}
|
||||||
|
return { msg: 'Logged in successfully' };
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error fetching users: ', err.message);
|
||||||
|
return { error: 'Invalid username or password' };
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import { MssqlDBService, OracleDBService } from './db.service';
|
|||||||
|
|
||||||
@Global()
|
@Global()
|
||||||
@Module({
|
@Module({
|
||||||
providers: [OracleDBService,MssqlDBService],
|
providers: [OracleDBService, MssqlDBService],
|
||||||
exports:[OracleDBService,MssqlDBService]
|
exports: [OracleDBService, MssqlDBService],
|
||||||
})
|
})
|
||||||
export class DbModule {}
|
export class DbModule {}
|
||||||
|
|||||||
@ -1,62 +1,62 @@
|
|||||||
import { MssqlConfig , OracleConfig} from 'ormconfig';
|
import { MssqlConfig, OracleConfig } from 'ormconfig';
|
||||||
import { createPool, Pool, Connection as cob, } from 'oracledb';
|
import { createPool, Pool, Connection as cob } from 'oracledb';
|
||||||
import { Connection, ConnectionPool } from 'mssql';
|
import { Connection, ConnectionPool } from 'mssql';
|
||||||
import { Global, Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class OracleDBService {
|
export class OracleDBService {
|
||||||
private pool: Pool;
|
private pool: Pool;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.initializePool();
|
this.initializePool();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async initializePool() {
|
private async initializePool() {
|
||||||
this.pool = await createPool({
|
this.pool = await createPool({
|
||||||
...OracleConfig,
|
...OracleConfig,
|
||||||
poolMin: 1,
|
poolMin: 1,
|
||||||
poolMax: 10,
|
poolMax: 10,
|
||||||
poolIncrement: 1,
|
poolIncrement: 1,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async getConnection(): Promise<cob> {
|
async getConnection(): Promise<cob> {
|
||||||
const connection = await this.pool.getConnection();
|
const connection = await this.pool.getConnection();
|
||||||
console.log('Database connection initialized successfully for oracle.');
|
console.log('Database connection initialized successfully for oracle.');
|
||||||
return connection;
|
return connection;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class MssqlDBService {
|
export class MssqlDBService {
|
||||||
private pool: ConnectionPool;
|
private pool: ConnectionPool;
|
||||||
private readonly config = {
|
private readonly config = {
|
||||||
...MssqlConfig,
|
...MssqlConfig,
|
||||||
server: "localhost",
|
server: 'localhost',
|
||||||
pool: {
|
pool: {
|
||||||
max: 10,
|
max: 10,
|
||||||
min: 0,
|
min: 0,
|
||||||
idleTimeoutMillis: 30000,
|
idleTimeoutMillis: 30000,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.initializePool();
|
this.initializePool();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async initializePool() {
|
private initializePool() {
|
||||||
this.pool = new ConnectionPool(this.config);
|
this.pool = new ConnectionPool(this.config);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getConnection(): Promise<Connection> {
|
async getConnection(): Promise<Connection> {
|
||||||
try {
|
try {
|
||||||
const connection = await this.pool.connect();
|
const connection = await this.pool.connect();
|
||||||
console.log('Database connection initialized successfully for Mssql.');
|
console.log('Database connection initialized successfully for Mssql.');
|
||||||
// console.log(`Connection established to server: ${this.config.server}`); // Log server info
|
// console.log(`Connection established to server: ${this.config.server}`); // Log server info
|
||||||
return connection;
|
return connection;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error getting connection from pool', error.stack);
|
console.error('Error getting connection from pool', error.stack);
|
||||||
throw error; // Rethrow the error after logging
|
throw error; // Rethrow the error after logging
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
60
src/main.ts
60
src/main.ts
@ -1,17 +1,21 @@
|
|||||||
import { NestFactory } from '@nestjs/core';
|
import { NestFactory } from '@nestjs/core';
|
||||||
import { AppModule } from './app.module';
|
import { AppModule } from './app.module';
|
||||||
import { BadRequestException, ValidationError, ValidationPipe } from '@nestjs/common';
|
import {
|
||||||
|
BadRequestException,
|
||||||
|
ValidationError,
|
||||||
|
ValidationPipe,
|
||||||
|
} from '@nestjs/common';
|
||||||
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
|
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
|
||||||
import { SwaggerDocumentOptions } from '@nestjs/swagger';
|
import { SwaggerDocumentOptions } from '@nestjs/swagger';
|
||||||
|
|
||||||
async function bootstrap() {
|
async function bootstrap() {
|
||||||
const app = await NestFactory.create(AppModule, {
|
const app = await NestFactory.create(AppModule, {
|
||||||
cors: {
|
cors: {
|
||||||
"origin": "*",
|
origin: '*',
|
||||||
"methods": "GET,HEAD,PUT,PATCH,POST,DELETE",
|
methods: 'GET,HEAD,PUT,PATCH,POST,DELETE',
|
||||||
"preflightContinue": false,
|
preflightContinue: false,
|
||||||
"optionsSuccessStatus": 204
|
optionsSuccessStatus: 204,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
function extractConstraints(validationErrors: ValidationError[]) {
|
function extractConstraints(validationErrors: ValidationError[]) {
|
||||||
@ -41,39 +45,49 @@ async function bootstrap() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const customExceptionFactory = (validationErrors: ValidationError[]) => {
|
const customExceptionFactory = (validationErrors: ValidationError[]) => {
|
||||||
|
const res = extractConstraints(validationErrors);
|
||||||
|
|
||||||
let res = extractConstraints(validationErrors);
|
const newResult = res
|
||||||
|
.map((x) => {
|
||||||
|
const errorMessage = x[Object.keys(x)[0]];
|
||||||
|
|
||||||
let newResult = res.map(x => {
|
return { message: errorMessage };
|
||||||
const errorMessage = x[Object.keys(x)[0]];
|
})
|
||||||
|
.filter(Boolean);
|
||||||
|
|
||||||
return { message: errorMessage };
|
return new BadRequestException({
|
||||||
}).filter(Boolean);
|
message: 'Validation failed',
|
||||||
|
errors: newResult,
|
||||||
return new BadRequestException({ message: 'Validation failed', errors: newResult });
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
app.useGlobalPipes(new ValidationPipe({
|
app.useGlobalPipes(
|
||||||
transform: true,
|
new ValidationPipe({
|
||||||
exceptionFactory: customExceptionFactory,
|
transform: true,
|
||||||
whitelist: true,
|
exceptionFactory: customExceptionFactory,
|
||||||
stopAtFirstError: true,
|
whitelist: true,
|
||||||
forbidNonWhitelisted: true,
|
stopAtFirstError: true,
|
||||||
}));
|
forbidNonWhitelisted: true,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
// app.useGlobalPipes(new ValidationPipe({ exceptionFactory:customExceptionFactory, whitelist: true, forbidNonWhitelisted: true, transform: true }));
|
// app.useGlobalPipes(new ValidationPipe({ exceptionFactory:customExceptionFactory, whitelist: true, forbidNonWhitelisted: true, transform: true }));
|
||||||
const config = new DocumentBuilder()
|
const config = new DocumentBuilder()
|
||||||
.setTitle('API')
|
.setTitle('API')
|
||||||
.setDescription('API description')
|
.setDescription('API description')
|
||||||
.setVersion('1.0')
|
.setVersion('1.0')
|
||||||
.addServer("http://localhost:3000", "Development Server 1")
|
.addServer('http://localhost:3000', 'Development Server 1')
|
||||||
.addServer("https://dev.alphaomegainfosys.com/test-api", "Development Server 2")
|
.addServer(
|
||||||
|
'https://dev.alphaomegainfosys.com/test-api',
|
||||||
|
'Development Server 2',
|
||||||
|
)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
const options: SwaggerDocumentOptions = {
|
const options: SwaggerDocumentOptions = {
|
||||||
autoTagControllers: false,
|
autoTagControllers: false,
|
||||||
};
|
};
|
||||||
const documentFactory = () => SwaggerModule.createDocument(app, config, options);
|
const documentFactory = () =>
|
||||||
|
SwaggerModule.createDocument(app, config, options);
|
||||||
SwaggerModule.setup('api', app, documentFactory);
|
SwaggerModule.setup('api', app, documentFactory);
|
||||||
|
|
||||||
await app.listen(process.env.PORT ?? 3000);
|
await app.listen(process.env.PORT ?? 3000);
|
||||||
|
|||||||
@ -1,78 +1,81 @@
|
|||||||
import {
|
import {
|
||||||
Get,
|
Get,
|
||||||
Post,
|
Post,
|
||||||
Body,
|
Body,
|
||||||
Param,
|
Param,
|
||||||
Controller,
|
Controller,
|
||||||
ParseIntPipe,
|
ParseIntPipe,
|
||||||
BadRequestException
|
BadRequestException,
|
||||||
} from '@nestjs/common';
|
} from '@nestjs/common';
|
||||||
|
|
||||||
import { HomePageService } from './home-page.service';
|
import { HomePageService } from './home-page.service';
|
||||||
import { ApiTags } from '@nestjs/swagger';
|
import { ApiTags } from '@nestjs/swagger';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
SaveCarnetApplicationDTO,
|
SaveCarnetApplicationDTO,
|
||||||
TransmitApplicationtoProcessDTO,
|
TransmitApplicationtoProcessDTO,
|
||||||
GetCarnetDetailsbyCarnetStatusDTO
|
GetCarnetDetailsbyCarnetStatusDTO,
|
||||||
} from './home-page.dto';
|
} from './home-page.dto';
|
||||||
|
|
||||||
@Controller()
|
@Controller()
|
||||||
export class HomePageController {
|
export class HomePageController {
|
||||||
constructor(
|
constructor(private readonly homePageService: HomePageService) {}
|
||||||
private readonly homePageService: HomePageService
|
|
||||||
) { }
|
|
||||||
|
|
||||||
@ApiTags('HomePage - Oracle')
|
@ApiTags('HomePage - Oracle')
|
||||||
@Get('/oracle/GetHomePageData/:id')
|
@Get('/oracle/GetHomePageData/:id')
|
||||||
GetHomePageData(@Param('id', ParseIntPipe) id: number) {
|
GetHomePageData(@Param('id', ParseIntPipe) id: number) {
|
||||||
return this.homePageService.GetHomePageData(id);
|
return this.homePageService.GetHomePageData(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiTags('HomePage - Oracle')
|
||||||
|
@Get('/oracle/GetCarnetSummaryData/:userid')
|
||||||
|
GetCarnetSummaryData(@Param('userid') id: string) {
|
||||||
|
return this.homePageService.GetCarnetSummaryData(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiTags('HomePage - Oracle')
|
||||||
|
@Get(
|
||||||
|
'/oracle/GetCarnetDetailsbyCarnetStatus/:p_spid/:p_userid/:p_CarnetStatus',
|
||||||
|
)
|
||||||
|
GetCarnetDetailsbyCarnetStatus(
|
||||||
|
@Param('p_spid', ParseIntPipe) p_spid: number,
|
||||||
|
@Param('p_userid') p_userid: string,
|
||||||
|
@Param('p_CarnetStatus') p_CarnetStatus: string,
|
||||||
|
) {
|
||||||
|
if (!p_spid || !p_userid || !p_CarnetStatus) {
|
||||||
|
throw new BadRequestException(
|
||||||
|
'spid, userid and Carnet Status are required',
|
||||||
|
);
|
||||||
|
} else if (Number(p_userid) || Number(p_CarnetStatus)) {
|
||||||
|
throw new BadRequestException(
|
||||||
|
'Param p_userid and p_CarnetStatus should be string',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
const body: GetCarnetDetailsbyCarnetStatusDTO = {
|
||||||
|
p_spid: p_spid,
|
||||||
|
p_userid: p_userid,
|
||||||
|
p_CarnetStatus: p_CarnetStatus,
|
||||||
|
};
|
||||||
|
|
||||||
@ApiTags('HomePage - Oracle')
|
return this.homePageService.GetCarnetDetailsbyCarnetStatus(body);
|
||||||
@Get('/oracle/GetCarnetSummaryData/:userid')
|
} catch (err) {
|
||||||
GetCarnetSummaryData(@Param('userid') id: string) {
|
return new BadRequestException({
|
||||||
return this.homePageService.GetCarnetSummaryData(id);
|
message: 'Validation faileda',
|
||||||
}
|
error: err.message,
|
||||||
|
});
|
||||||
@ApiTags('HomePage - Oracle')
|
|
||||||
@Get('/oracle/GetCarnetDetailsbyCarnetStatus/:p_spid/:p_userid/:p_CarnetStatus')
|
|
||||||
GetCarnetDetailsbyCarnetStatus(
|
|
||||||
@Param('p_spid', ParseIntPipe) p_spid: number,
|
|
||||||
@Param('p_userid') p_userid: string,
|
|
||||||
@Param('p_CarnetStatus') p_CarnetStatus: string
|
|
||||||
) {
|
|
||||||
if (!p_spid || !p_userid || !p_CarnetStatus) {
|
|
||||||
throw new BadRequestException('spid, userid and Carnet Status are required');
|
|
||||||
}
|
|
||||||
else if (Number(p_userid) || Number(p_CarnetStatus)) {
|
|
||||||
throw new BadRequestException('Param p_userid and p_CarnetStatus should be string');
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
const body: GetCarnetDetailsbyCarnetStatusDTO = {
|
|
||||||
p_spid: p_spid,
|
|
||||||
p_userid: p_userid,
|
|
||||||
p_CarnetStatus: p_CarnetStatus
|
|
||||||
};
|
|
||||||
|
|
||||||
return this.homePageService.GetCarnetDetailsbyCarnetStatus(body);
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
return new BadRequestException({ message: 'Validation faileda', error: err.message })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiTags('HomePage - Oracle')
|
|
||||||
@Post('/oracle/SaveCarnetApplication')
|
|
||||||
SaveCarnetApplication(@Body() body: SaveCarnetApplicationDTO) {
|
|
||||||
return this.homePageService.SaveCarnetApplication(body);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiTags('HomePage - Oracle')
|
|
||||||
@Post('/oracle/TransmitApplicationtoProcess')
|
|
||||||
TransmitApplicationtoProcess(@Body() body: TransmitApplicationtoProcessDTO) {
|
|
||||||
return this.homePageService.TransmitApplicationtoProcess(body);
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiTags('HomePage - Oracle')
|
||||||
|
@Post('/oracle/SaveCarnetApplication')
|
||||||
|
SaveCarnetApplication(@Body() body: SaveCarnetApplicationDTO) {
|
||||||
|
return this.homePageService.SaveCarnetApplication(body);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiTags('HomePage - Oracle')
|
||||||
|
@Post('/oracle/TransmitApplicationtoProcess')
|
||||||
|
TransmitApplicationtoProcess(@Body() body: TransmitApplicationtoProcessDTO) {
|
||||||
|
return this.homePageService.TransmitApplicationtoProcess(body);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,293 +1,363 @@
|
|||||||
import { ApiProperty } from "@nestjs/swagger";
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
import { Type } from "class-transformer";
|
import { Type } from 'class-transformer';
|
||||||
import { IsArray, IsDefined, IsInt, IsNumber, IsOptional, IsString, Length, Max, Min, ValidateNested } from "class-validator";
|
import {
|
||||||
|
IsArray,
|
||||||
|
IsDefined,
|
||||||
|
IsInt,
|
||||||
|
IsNumber,
|
||||||
|
IsOptional,
|
||||||
|
IsString,
|
||||||
|
Length,
|
||||||
|
Max,
|
||||||
|
Min,
|
||||||
|
ValidateNested,
|
||||||
|
} from 'class-validator';
|
||||||
|
|
||||||
export class p_gltableDTO {
|
export class p_gltableDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property ItemNo must not exceed 999999999" })
|
@Max(999999999, { message: 'Property ItemNo must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property ItemNo must be at least 0 or more" })
|
@Min(0, { message: 'Property ItemNo must be at least 0 or more' })
|
||||||
@IsInt()
|
@IsInt()
|
||||||
@IsNumber({}, { message: "Property ItemNo must be a number" })
|
@IsNumber({}, { message: 'Property ItemNo must be a number' })
|
||||||
@IsDefined({ message: "Property ItemNo is required" })
|
@IsDefined({ message: 'Property ItemNo is required' })
|
||||||
ItemNo: number;
|
ItemNo: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 1000, { message: "Property ItemDescription must be between 1 and 1000 characters" })
|
@Length(0, 1000, {
|
||||||
@IsString({ message: "Property ItemDescription should be string" })
|
message: 'Property ItemDescription must be between 1 and 1000 characters',
|
||||||
@IsDefined({ message: "Property ItemDescription is required" })
|
})
|
||||||
ItemDescription: string;
|
@IsString({ message: 'Property ItemDescription should be string' })
|
||||||
|
@IsDefined({ message: 'Property ItemDescription is required' })
|
||||||
|
ItemDescription: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber({},{ message: "Property ItemValue should be number" })
|
@IsNumber({}, { message: 'Property ItemValue should be number' })
|
||||||
@IsDefined({ message: "Property ItemValue is required" })
|
@IsDefined({ message: 'Property ItemValue is required' })
|
||||||
ItemValue: number;
|
ItemValue: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(99999999999, { message: "Property Noofpieces must not exceed 99999999999" })
|
@Max(99999999999, {
|
||||||
@Min(0, { message: "Property Noofpieces must be at least 0 or more" })
|
message: 'Property Noofpieces must not exceed 99999999999',
|
||||||
@IsInt()
|
})
|
||||||
@IsNumber({}, { message: "Property Noofpieces must be a number" })
|
@Min(0, { message: 'Property Noofpieces must be at least 0 or more' })
|
||||||
@IsDefined({ message: "Property Noofpieces is required" })
|
@IsInt()
|
||||||
Noofpieces: number;
|
@IsNumber({}, { message: 'Property Noofpieces must be a number' })
|
||||||
|
@IsDefined({ message: 'Property Noofpieces is required' })
|
||||||
|
Noofpieces: number;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
ItemWeight?: number;
|
ItemWeight?: number;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 10, { message: "Property ItemWeightUOM must be between 0 and 10 characters" })
|
@Length(0, 10, {
|
||||||
@IsString()
|
message: 'Property ItemWeightUOM must be between 0 and 10 characters',
|
||||||
@IsOptional()
|
})
|
||||||
ItemWeightUOM?: string;
|
@IsString()
|
||||||
|
@IsOptional()
|
||||||
|
ItemWeightUOM?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 2, { message: "Property GoodsOriginCountry must be between 0 and 2 characters" })
|
@Length(0, 2, {
|
||||||
@IsString({ message: "Property GoodsOriginCountry should be string" })
|
message: 'Property GoodsOriginCountry must be between 0 and 2 characters',
|
||||||
@IsDefined({ message: "Property name is required" })
|
})
|
||||||
GoodsOriginCountry: string;
|
@IsString({ message: 'Property GoodsOriginCountry should be string' })
|
||||||
|
@IsDefined({ message: 'Property name is required' })
|
||||||
|
GoodsOriginCountry: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class p_countrytableDTO {
|
export class p_countrytableDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 1, { message: "Property VisitTransitInd must be 0 to 1 characters" })
|
@Length(0, 1, {
|
||||||
@IsString()
|
message: 'Property VisitTransitInd must be 0 to 1 characters',
|
||||||
@IsDefined({ message: "Property VisitTransitInd is required" })
|
})
|
||||||
VisitTransitInd: string;
|
@IsString()
|
||||||
|
@IsDefined({ message: 'Property VisitTransitInd is required' })
|
||||||
|
VisitTransitInd: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 2, { message: "Property CountryCode must be between 0 to 2 characters" })
|
@Length(0, 2, {
|
||||||
@IsString()
|
message: 'Property CountryCode must be between 0 to 2 characters',
|
||||||
@IsDefined({ message: "Property CountryCode is required" })
|
})
|
||||||
CountryCode: string;
|
@IsString()
|
||||||
|
@IsDefined({ message: 'Property CountryCode is required' })
|
||||||
|
CountryCode: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999, { message: "Property NoOfTimesEntLeave must not exceed 999" })
|
@Max(999, { message: 'Property NoOfTimesEntLeave must not exceed 999' })
|
||||||
@Min(0, { message: "Property NoOfTimesEntLeave must be at least 0 or more" })
|
@Min(0, { message: 'Property NoOfTimesEntLeave must be at least 0 or more' })
|
||||||
@IsInt()
|
@IsInt()
|
||||||
@IsNumber({}, { message: "Property NoOfTimesEntLeave must be a number" })
|
@IsNumber({}, { message: 'Property NoOfTimesEntLeave must be a number' })
|
||||||
@IsDefined({ message: "Property NoOfTimesEntLeave is required" })
|
@IsDefined({ message: 'Property NoOfTimesEntLeave is required' })
|
||||||
NoOfTimesEntLeave: number;
|
NoOfTimesEntLeave: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SaveCarnetApplicationDTO {
|
export class SaveCarnetApplicationDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||||
@IsInt()
|
@IsInt()
|
||||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||||
p_spid: number;
|
p_spid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_clientid must not exceed 999999999" })
|
@Max(999999999, { message: 'Property p_clientid must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property p_clientid must be at least 0 or more" })
|
@Min(0, { message: 'Property p_clientid must be at least 0 or more' })
|
||||||
@IsInt()
|
@IsInt()
|
||||||
@IsNumber({}, { message: "Property p_clientid must be a number" })
|
@IsNumber({}, { message: 'Property p_clientid must be a number' })
|
||||||
p_clientid: number;
|
p_clientid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_locationid must not exceed 999999999" })
|
@Max(999999999, {
|
||||||
@Min(0, { message: "Property p_locationid must be at least 0 or more" })
|
message: 'Property p_locationid must not exceed 999999999',
|
||||||
@IsInt()
|
})
|
||||||
@IsNumber({}, { message: "Property p_locationid must be a number" })
|
@Min(0, { message: 'Property p_locationid must be at least 0 or more' })
|
||||||
p_locationid: number;
|
@IsInt()
|
||||||
|
@IsNumber({}, { message: 'Property p_locationid must be a number' })
|
||||||
|
p_locationid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 50, { message: "Property p_userid must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString()
|
message: 'Property p_userid must be between 0 to 50 characters',
|
||||||
p_userid: string;
|
})
|
||||||
|
@IsString()
|
||||||
|
p_userid: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Max(999999999, { message: "Property p_headerid must not exceed 999999999" })
|
@Max(999999999, { message: 'Property p_headerid must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property p_headerid must be at least 0 or more" })
|
@Min(0, { message: 'Property p_headerid must be at least 0 or more' })
|
||||||
@IsInt()
|
@IsInt()
|
||||||
@IsNumber({}, { message: "Property p_headerid must be a number" })
|
@IsNumber({}, { message: 'Property p_headerid must be a number' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_headerid?: number;
|
p_headerid?: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 50, { message: "Property p_applicationname must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString()
|
message: 'Property p_applicationname must be between 0 to 50 characters',
|
||||||
p_applicationname: string;
|
})
|
||||||
|
@IsString()
|
||||||
|
p_applicationname: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Max(999999999, { message: "Property p_holderid must not exceed 999999999" })
|
@Max(999999999, { message: 'Property p_holderid must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property p_holderid must be at least 0 or more" })
|
@Min(0, { message: 'Property p_holderid must be at least 0 or more' })
|
||||||
@IsInt()
|
@IsInt()
|
||||||
@IsNumber({}, { message: "Property p_holderid must be a number" })
|
@IsNumber({}, { message: 'Property p_holderid must be a number' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_holderid?: number;
|
p_holderid?: number;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 1, { message: "Property p_commercialsampleflag must be between 0 to 1 characters" })
|
@Length(0, 1, {
|
||||||
@IsString()
|
message:
|
||||||
@IsOptional()
|
'Property p_commercialsampleflag must be between 0 to 1 characters',
|
||||||
p_commercialsampleflag?: string;
|
})
|
||||||
|
@IsString()
|
||||||
|
@IsOptional()
|
||||||
|
p_commercialsampleflag?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 1, { message: "Property p_profequipmentflag must be between 0 to 1 characters" })
|
@Length(0, 1, {
|
||||||
@IsString()
|
message: 'Property p_profequipmentflag must be between 0 to 1 characters',
|
||||||
@IsOptional()
|
})
|
||||||
p_profequipmentflag?: string;
|
@IsString()
|
||||||
|
@IsOptional()
|
||||||
|
p_profequipmentflag?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 1, { message: "Property p_exhibitionsfairflag must be between 0 to 1 characters" })
|
@Length(0, 1, {
|
||||||
@IsString()
|
message: 'Property p_exhibitionsfairflag must be between 0 to 1 characters',
|
||||||
@IsOptional()
|
})
|
||||||
p_exhibitionsfairflag?: string;
|
@IsString()
|
||||||
|
@IsOptional()
|
||||||
|
p_exhibitionsfairflag?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 1, { message: "Property p_autoflag must be between 0 to 1 characters" })
|
@Length(0, 1, {
|
||||||
@IsString()
|
message: 'Property p_autoflag must be between 0 to 1 characters',
|
||||||
@IsOptional()
|
})
|
||||||
p_autoflag?: string;
|
@IsString()
|
||||||
|
@IsOptional()
|
||||||
|
p_autoflag?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 1, { message: "Property p_horseflag must be between 0 to 1 characters" })
|
@Length(0, 1, {
|
||||||
@IsString()
|
message: 'Property p_horseflag must be between 0 to 1 characters',
|
||||||
@IsOptional()
|
})
|
||||||
p_horseflag?: string;
|
@IsString()
|
||||||
|
@IsOptional()
|
||||||
|
p_horseflag?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 200, { message: "Property p_authrep must be between 0 to 200 characters" })
|
@Length(0, 200, {
|
||||||
@IsString()
|
message: 'Property p_authrep must be between 0 to 200 characters',
|
||||||
@IsOptional()
|
})
|
||||||
p_authrep?: string;
|
@IsString()
|
||||||
|
@IsOptional()
|
||||||
|
p_authrep?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false, type: () => [p_gltableDTO] })
|
@ApiProperty({ required: false, type: () => [p_gltableDTO] })
|
||||||
@Type(() => p_gltableDTO)
|
@Type(() => p_gltableDTO)
|
||||||
@ValidateNested({ each: true })
|
@ValidateNested({ each: true })
|
||||||
@IsArray()
|
@IsArray()
|
||||||
// @ArrayNotEmpty({message:"Property gltable should not be empty"})
|
// @ArrayNotEmpty({message:"Property gltable should not be empty"})
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_gltable?: p_gltableDTO[];
|
p_gltable?: p_gltableDTO[];
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Max(99999, { message: "Property p_ussets must not exceed 99999" })
|
@Max(99999, { message: 'Property p_ussets must not exceed 99999' })
|
||||||
@Min(0, { message: "Property p_ussets must be at least 0 or more" })
|
@Min(0, { message: 'Property p_ussets must be at least 0 or more' })
|
||||||
@IsInt()
|
@IsInt()
|
||||||
@IsNumber({}, { message: "Property p_ussets must be a number" })
|
@IsNumber({}, { message: 'Property p_ussets must be a number' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_ussets?: number;
|
p_ussets?: number;
|
||||||
|
|
||||||
@ApiProperty({ required: false, type: () => [p_countrytableDTO] })
|
@ApiProperty({ required: false, type: () => [p_countrytableDTO] })
|
||||||
@ValidateNested({ each: true })
|
@ValidateNested({ each: true })
|
||||||
@IsArray()
|
@IsArray()
|
||||||
@Type(() => p_countrytableDTO)
|
@Type(() => p_countrytableDTO)
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_countrytable?: p_countrytableDTO[];
|
p_countrytable?: p_countrytableDTO[];
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 10, { message: "Property p_shiptotype must be between 0 to 10 characters" })
|
@Length(0, 10, {
|
||||||
@IsString()
|
message: 'Property p_shiptotype must be between 0 to 10 characters',
|
||||||
@IsOptional()
|
})
|
||||||
p_shiptotype?: string;
|
@IsString()
|
||||||
|
@IsOptional()
|
||||||
|
p_shiptotype?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Max(999999999, { message: "Property p_shipaddrid must not exceed 999999999" })
|
@Max(999999999, {
|
||||||
@Min(0, { message: "Property p_shipaddrid must be at least 0 or more" })
|
message: 'Property p_shipaddrid must not exceed 999999999',
|
||||||
@IsInt()
|
})
|
||||||
@IsNumber({}, { message: "Property p_shipaddrid must be a number" })
|
@Min(0, { message: 'Property p_shipaddrid must be at least 0 or more' })
|
||||||
@IsOptional()
|
@IsInt()
|
||||||
p_shipaddrid?: number;
|
@IsNumber({}, { message: 'Property p_shipaddrid must be a number' })
|
||||||
|
@IsOptional()
|
||||||
|
p_shipaddrid?: number;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 1, { message: "Property p_formofsecurity must be between 0 to 1 characters" })
|
@Length(0, 1, {
|
||||||
@IsString()
|
message: 'Property p_formofsecurity must be between 0 to 1 characters',
|
||||||
@IsOptional()
|
})
|
||||||
p_formofsecurity?: string;
|
@IsString()
|
||||||
|
@IsOptional()
|
||||||
|
p_formofsecurity?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 10, { message: "Property p_insprotection must be between 0 to 10 characters" })
|
@Length(0, 10, {
|
||||||
@IsString()
|
message: 'Property p_insprotection must be between 0 to 10 characters',
|
||||||
@IsOptional()
|
})
|
||||||
p_insprotection?: string;
|
@IsString()
|
||||||
|
@IsOptional()
|
||||||
|
p_insprotection?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 10, { message: "Property p_ldiprotection must be between 0 to 10 characters" })
|
@Length(0, 10, {
|
||||||
@IsString()
|
message: 'Property p_ldiprotection must be between 0 to 10 characters',
|
||||||
@IsOptional()
|
})
|
||||||
p_ldiprotection?: string;
|
@IsString()
|
||||||
|
@IsOptional()
|
||||||
|
p_ldiprotection?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 10, { message: "Property p_deliverytype must be between 0 to 10 characters" })
|
@Length(0, 10, {
|
||||||
@IsString()
|
message: 'Property p_deliverytype must be between 0 to 10 characters',
|
||||||
@IsOptional()
|
})
|
||||||
p_deliverytype?: string;
|
@IsString()
|
||||||
|
@IsOptional()
|
||||||
|
p_deliverytype?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 10, { message: "Property p_deliverymethod must be between 0 to 10 characters" })
|
@Length(0, 10, {
|
||||||
@IsString()
|
message: 'Property p_deliverymethod must be between 0 to 10 characters',
|
||||||
@IsOptional()
|
})
|
||||||
p_deliverymethod?: string;
|
@IsString()
|
||||||
|
@IsOptional()
|
||||||
|
p_deliverymethod?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 10, { message: "Property p_paymentmethod must be between 0 to 10 characters" })
|
@Length(0, 10, {
|
||||||
@IsString()
|
message: 'Property p_paymentmethod must be between 0 to 10 characters',
|
||||||
@IsOptional()
|
})
|
||||||
p_paymentmethod?: string;
|
@IsString()
|
||||||
|
@IsOptional()
|
||||||
|
p_paymentmethod?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 20, { message: "Property p_custcourierno must be between 0 to 20 characters" })
|
@Length(0, 20, {
|
||||||
@IsString()
|
message: 'Property p_custcourierno must be between 0 to 20 characters',
|
||||||
@IsOptional()
|
})
|
||||||
p_custcourierno?: string;
|
@IsString()
|
||||||
|
@IsOptional()
|
||||||
|
p_custcourierno?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 20, { message: "Property p_refno must be between 0 to 20 characters" })
|
@Length(0, 20, {
|
||||||
@IsString()
|
message: 'Property p_refno must be between 0 to 20 characters',
|
||||||
@IsOptional()
|
})
|
||||||
p_refno?: string;
|
@IsString()
|
||||||
|
@IsOptional()
|
||||||
|
p_refno?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 2000, { message: "Property p_notes must be between 0 to 2000 characters" })
|
@Length(0, 2000, {
|
||||||
@IsString()
|
message: 'Property p_notes must be between 0 to 2000 characters',
|
||||||
@IsOptional()
|
})
|
||||||
p_notes?: string;
|
@IsString()
|
||||||
|
@IsOptional()
|
||||||
|
p_notes?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class TransmitApplicationtoProcessDTO {
|
export class TransmitApplicationtoProcessDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||||
@IsInt()
|
@IsInt()
|
||||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||||
@IsDefined({message:"Property p_spid is required"})
|
@IsDefined({ message: 'Property p_spid is required' })
|
||||||
p_spid: number;
|
p_spid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 50, { message: "Property p_userid must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString()
|
message: 'Property p_userid must be between 0 to 50 characters',
|
||||||
@IsDefined({message:"Property p_userid is required"})
|
})
|
||||||
p_userid: string;
|
@IsString()
|
||||||
|
@IsDefined({ message: 'Property p_userid is required' })
|
||||||
|
p_userid: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||||
@IsInt()
|
@IsInt()
|
||||||
@IsNumber({}, { message: "Property p_headerid must be a number" })
|
@IsNumber({}, { message: 'Property p_headerid must be a number' })
|
||||||
@IsDefined({message:"Property p_headerid is required"})
|
@IsDefined({ message: 'Property p_headerid is required' })
|
||||||
p_headerid: number;
|
p_headerid: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetCarnetDetailsbyCarnetStatusDTO {
|
export class GetCarnetDetailsbyCarnetStatusDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||||
@IsInt()
|
@IsInt()
|
||||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||||
@IsDefined({message:"Property p_spid is required"})
|
@IsDefined({ message: 'Property p_spid is required' })
|
||||||
p_spid: number;
|
p_spid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 50, { message: "Property p_userid must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property p_userid must be string" })
|
message: 'Property p_userid must be between 0 to 50 characters',
|
||||||
@IsDefined({message:"Property p_userid is required"})
|
})
|
||||||
p_userid: string;
|
@IsString({ message: 'Property p_userid must be string' })
|
||||||
|
@IsDefined({ message: 'Property p_userid is required' })
|
||||||
|
p_userid: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 20, { message: "Property p_CarnetStatus must be between 0 to 20 characters" })
|
@Length(0, 20, {
|
||||||
@IsString()
|
message: 'Property p_CarnetStatus must be between 0 to 20 characters',
|
||||||
@IsDefined({message:"Property p_CarnetStatus is required"})
|
})
|
||||||
p_CarnetStatus: string;
|
@IsString()
|
||||||
|
@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';
|
import { DbModule } from 'src/db/db.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports:[DbModule],
|
imports: [DbModule],
|
||||||
providers: [ HomePageService],
|
providers: [HomePageService],
|
||||||
controllers: [HomePageController]
|
controllers: [HomePageController],
|
||||||
})
|
})
|
||||||
export class HomePageModule {}
|
export class HomePageModule {}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -1,70 +1,84 @@
|
|||||||
import { Body, Controller, Get, Post, Put, Query } from '@nestjs/common';
|
import { Body, Controller, Get, Post, Put, Query } from '@nestjs/common';
|
||||||
import { ManageClientsService } from './manage-clients.service';
|
import { ManageClientsService } from './manage-clients.service';
|
||||||
import { CreateAdditionalClientContactsDTO, CreateAdditionalClientLocationsDTO, CreateClientDataDTO, GetPreparerByClientidContactsByClientidLocByClientidDTO, GetPreparersDTO, UpdateClientContactsDTO, UpdateClientDTO, UpdateClientLocationsDTO } from './manage-clients.dto';
|
import {
|
||||||
|
CreateAdditionalClientContactsDTO,
|
||||||
|
CreateAdditionalClientLocationsDTO,
|
||||||
|
CreateClientDataDTO,
|
||||||
|
GetPreparerByClientidContactsByClientidLocByClientidDTO,
|
||||||
|
GetPreparersDTO,
|
||||||
|
UpdateClientContactsDTO,
|
||||||
|
UpdateClientDTO,
|
||||||
|
UpdateClientLocationsDTO,
|
||||||
|
} from './manage-clients.dto';
|
||||||
import { ApiTags } from '@nestjs/swagger';
|
import { ApiTags } from '@nestjs/swagger';
|
||||||
|
|
||||||
@Controller('oracle')
|
@Controller('oracle')
|
||||||
export class ManageClientsController {
|
export class ManageClientsController {
|
||||||
|
constructor(private readonly manageClientsService: ManageClientsService) {}
|
||||||
|
|
||||||
constructor(private readonly manageClientsService:ManageClientsService){}
|
@ApiTags('Manage Clients - Oracle')
|
||||||
|
@Post('CreateNewClients')
|
||||||
|
async CreateClientData(@Body() body: CreateClientDataDTO) {
|
||||||
|
return this.manageClientsService.CreateClientData(body);
|
||||||
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Clients - Oracle')
|
@ApiTags('Manage Clients - Oracle')
|
||||||
@Post('CreateNewClients')
|
@Put('UpdateClient')
|
||||||
async CreateClientData(@Body() body:CreateClientDataDTO){
|
async UpdateClient(@Body() body: UpdateClientDTO) {
|
||||||
return this.manageClientsService.CreateClientData(body);
|
return this.manageClientsService.UpdateClient(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Clients - Oracle')
|
@ApiTags('Manage Clients - Oracle')
|
||||||
@Put('UpdateClient')
|
@Put('UpdateClientContacts')
|
||||||
async UpdateClient(@Body() body:UpdateClientDTO){
|
UpdateClientContacts(@Body() body: UpdateClientContactsDTO) {
|
||||||
return this.manageClientsService.UpdateClient(body);
|
return this.manageClientsService.UpdateClientContacts(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Clients - Oracle')
|
@ApiTags('Manage Clients - Oracle')
|
||||||
@Put('UpdateClientContacts')
|
@Put('UpdateClientLocations')
|
||||||
UpdateClientContacts(@Body() body:UpdateClientContactsDTO){
|
UpdateClientLocations(@Body() body: UpdateClientLocationsDTO) {
|
||||||
return this.manageClientsService.UpdateClientContacts(body);
|
return this.manageClientsService.UpdateClientLocations(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Clients - Oracle')
|
@ApiTags('Manage Clients - Oracle')
|
||||||
@Put('UpdateClientLocations')
|
@Post('CreateAdditionalClientContacts')
|
||||||
UpdateClientLocations(@Body() body:UpdateClientLocationsDTO){
|
CreateClientContact(@Body() body: CreateAdditionalClientContactsDTO) {
|
||||||
return this.manageClientsService.UpdateClientLocations(body);
|
return this.manageClientsService.CreateClientContact(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Clients - Oracle')
|
@ApiTags('Manage Clients - Oracle')
|
||||||
@Post('CreateAdditionalClientContacts')
|
@Post('CreateAdditionalClientLocations')
|
||||||
CreateClientContact(@Body() body:CreateAdditionalClientContactsDTO){
|
CreateClientLocation(@Body() body: CreateAdditionalClientLocationsDTO) {
|
||||||
return this.manageClientsService.CreateClientContact(body);
|
return this.manageClientsService.CreateClientLocation(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Clients - Oracle')
|
@ApiTags('Manage Clients - Oracle')
|
||||||
@Post('CreateAdditionalClientLocations')
|
@Get('GetPreparers')
|
||||||
CreateClientLocation(@Body() body:CreateAdditionalClientLocationsDTO){
|
async GetPreparers(@Query() query: GetPreparersDTO) {
|
||||||
return this.manageClientsService.CreateClientLocation(body);
|
return await this.manageClientsService.GetPreparers(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Clients - Oracle')
|
@ApiTags('Manage Clients - Oracle')
|
||||||
@Get('GetPreparers')
|
@Get('GetPreparerByClientid')
|
||||||
async GetPreparers(@Query() query:GetPreparersDTO) {
|
GetPreparerByClientid(
|
||||||
return await this.manageClientsService.GetPreparers(query)
|
@Query() body: GetPreparerByClientidContactsByClientidLocByClientidDTO,
|
||||||
}
|
) {
|
||||||
|
return this.manageClientsService.GetPreparerByClientid(body);
|
||||||
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Clients - Oracle')
|
@ApiTags('Manage Clients - Oracle')
|
||||||
@Get('GetPreparerByClientid')
|
@Get('GetPreparerContactsByClientid')
|
||||||
GetPreparerByClientid(@Query() body:GetPreparerByClientidContactsByClientidLocByClientidDTO){
|
GetPreparerContactsByClientid(
|
||||||
return this.manageClientsService.GetPreparerByClientid(body);
|
@Query() body: GetPreparerByClientidContactsByClientidLocByClientidDTO,
|
||||||
}
|
) {
|
||||||
|
return body;
|
||||||
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Clients - Oracle')
|
@ApiTags('Manage Clients - Oracle')
|
||||||
@Get('GetPreparerContactsByClientid')
|
@Get('GetPreparerLocByClientid')
|
||||||
GetPreparerContactsByClientid(@Query() body:GetPreparerByClientidContactsByClientidLocByClientidDTO){
|
GetPreparerLocByClientid(
|
||||||
return body;
|
@Query() body: GetPreparerByClientidContactsByClientidLocByClientidDTO,
|
||||||
}
|
) {
|
||||||
|
return body;
|
||||||
@ApiTags('Manage Clients - Oracle')
|
}
|
||||||
@Get('GetPreparerLocByClientid')
|
|
||||||
GetPreparerLocByClientid(@Query() body:GetPreparerByClientidContactsByClientidLocByClientidDTO){
|
|
||||||
return body;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -4,6 +4,6 @@ import { ManageClientsService } from './manage-clients.service';
|
|||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
controllers: [ManageClientsController],
|
controllers: [ManageClientsController],
|
||||||
providers: [ManageClientsService]
|
providers: [ManageClientsService],
|
||||||
})
|
})
|
||||||
export class ManageClientsModule {}
|
export class ManageClientsModule {}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -1,152 +1,151 @@
|
|||||||
import { Body, Controller, Get, Param, ParseIntPipe, Patch, Post, Query } from '@nestjs/common';
|
import { Body, Controller, Get, Patch, Post, Query } from '@nestjs/common';
|
||||||
import { ManageFeeService } from './manage-fee.service';
|
import { ManageFeeService } from './manage-fee.service';
|
||||||
import { ApiTags } from '@nestjs/swagger';
|
import { ApiTags } from '@nestjs/swagger';
|
||||||
import {
|
import {
|
||||||
CreateBasicFeeDTO,
|
CreateBasicFeeDTO,
|
||||||
CreateBondRateDTO,
|
CreateBondRateDTO,
|
||||||
CreateCargoRateDTO,
|
CreateCargoRateDTO,
|
||||||
CreateCfFeeDTO,
|
CreateCfFeeDTO,
|
||||||
CreateCsFeeDTO,
|
CreateCsFeeDTO,
|
||||||
CreateEfFeeDTO,
|
CreateEfFeeDTO,
|
||||||
CreateFeeCommDTO,
|
CreateFeeCommDTO,
|
||||||
GetFeeGeneralDTO,
|
GetFeeGeneralDTO,
|
||||||
UpdateBasicFeeDTO,
|
UpdateBasicFeeDTO,
|
||||||
UpdateBondRateDTO,
|
UpdateBondRateDTO,
|
||||||
UpdateCargoRateDTO,
|
UpdateCargoRateDTO,
|
||||||
UpdateCfFeeDTO,
|
UpdateCfFeeDTO,
|
||||||
UpdateCsFeeDTO,
|
UpdateCsFeeDTO,
|
||||||
UpdateEfFeeDTO,
|
UpdateEfFeeDTO,
|
||||||
UpdateFeeCommBodyDTO
|
UpdateFeeCommBodyDTO,
|
||||||
} from './manage-fee.dto';
|
} from './manage-fee.dto';
|
||||||
|
|
||||||
@Controller('manage-fee')
|
@Controller('manage-fee')
|
||||||
export class ManageFeeController {
|
export class ManageFeeController {
|
||||||
constructor(private readonly manageFeeService: ManageFeeService) { }
|
constructor(private readonly manageFeeService: ManageFeeService) {}
|
||||||
|
|
||||||
|
@ApiTags('Manage Fee - Oracle')
|
||||||
|
@Get('/GetBasicFeeRates')
|
||||||
|
GetBasicFeeRates(@Query() body: GetFeeGeneralDTO) {
|
||||||
|
return this.manageFeeService.GETBASICFEERATES(body);
|
||||||
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
@ApiTags('Manage Fee - Oracle')
|
||||||
@Get('/GetBasicFeeRates')
|
@Get('/GetBondRates')
|
||||||
GetBasicFeeRates(@Query() body: GetFeeGeneralDTO) {
|
GetBondRates(@Query() body: GetFeeGeneralDTO) {
|
||||||
return this.manageFeeService.GETBASICFEERATES(body)
|
return this.manageFeeService.GETBONDRATES(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
@ApiTags('Manage Fee - Oracle')
|
||||||
@Get('/GetBondRates')
|
@Get('/GetCargoRates')
|
||||||
GetBondRates(@Query() body: GetFeeGeneralDTO) {
|
GetCargoRates(@Query() body: GetFeeGeneralDTO) {
|
||||||
return this.manageFeeService.GETBONDRATES(body)
|
return this.manageFeeService.GETCARGORATES(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
@ApiTags('Manage Fee - Oracle')
|
||||||
@Get('/GetCargoRates')
|
@Get('/GetCfFeeRates')
|
||||||
GetCargoRates(@Query() body: GetFeeGeneralDTO) {
|
GetCfFeeRates(@Query() body: GetFeeGeneralDTO) {
|
||||||
return this.manageFeeService.GETCARGORATES(body)
|
return this.manageFeeService.GETCFFEERATES(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
@ApiTags('Manage Fee - Oracle')
|
||||||
@Get('/GetCfFeeRates')
|
@Get('/GetCsFeeRates')
|
||||||
GetCfFeeRates(@Query() body: GetFeeGeneralDTO) {
|
GetCsFeeRates(@Query() body: GetFeeGeneralDTO) {
|
||||||
return this.manageFeeService.GETCFFEERATES(body)
|
return this.manageFeeService.GETCSFEERATES(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
@ApiTags('Manage Fee - Oracle')
|
||||||
@Get('/GetCsFeeRates')
|
@Get('/GetEfFeeRates')
|
||||||
GetCsFeeRates(@Query() body: GetFeeGeneralDTO) {
|
GetEfFeeRates(@Query() body: GetFeeGeneralDTO) {
|
||||||
return this.manageFeeService.GETCSFEERATES(body)
|
return this.manageFeeService.GETEFFEERATES(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
@ApiTags('Manage Fee - Oracle')
|
||||||
@Get('/GetEfFeeRates')
|
@Get('/GetFeeComm')
|
||||||
GetEfFeeRates(@Query() body: GetFeeGeneralDTO) {
|
GetFeeComm(@Query() body: GetFeeGeneralDTO) {
|
||||||
return this.manageFeeService.GETEFFEERATES(body)
|
return this.manageFeeService.GETFEECOMM(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
@ApiTags('Manage Fee - Oracle')
|
||||||
@Get('/GetFeeComm')
|
@Post('/CreateBasicFee')
|
||||||
GetFeeComm(@Query() body: GetFeeGeneralDTO) {
|
CreateBasicFee(@Body() body: CreateBasicFeeDTO) {
|
||||||
return this.manageFeeService.GETFEECOMM(body)
|
return this.manageFeeService.CREATEBASICFEE(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
@ApiTags('Manage Fee - Oracle')
|
||||||
@Post('/CreateBasicFee')
|
@Post('/CreateBondRate')
|
||||||
CreateBasicFee(@Body() body: CreateBasicFeeDTO) {
|
CreateBondRate(@Body() body: CreateBondRateDTO) {
|
||||||
return this.manageFeeService.CREATEBASICFEE(body)
|
return this.manageFeeService.CREATEBONDRATE(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
@ApiTags('Manage Fee - Oracle')
|
||||||
@Post('/CreateBondRate')
|
@Post('/CreateCargoRate')
|
||||||
CreateBondRate(@Body() body: CreateBondRateDTO) {
|
CreateCargoRate(@Body() body: CreateCargoRateDTO) {
|
||||||
return this.manageFeeService.CREATEBONDRATE(body)
|
return this.manageFeeService.CREATECARGORATE(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
@ApiTags('Manage Fee - Oracle')
|
||||||
@Post('/CreateCargoRate')
|
@Post('/CreateCfFee')
|
||||||
CreateCargoRate(@Body() body: CreateCargoRateDTO) {
|
CreateCfFee(@Body() body: CreateCfFeeDTO) {
|
||||||
return this.manageFeeService.CREATECARGORATE(body)
|
return this.manageFeeService.CREATECFFEE(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
@ApiTags('Manage Fee - Oracle')
|
||||||
@Post('/CreateCfFee')
|
@Post('/CreateCsFee')
|
||||||
CreateCfFee(@Body() body: CreateCfFeeDTO) {
|
CreateCsFee(@Body() body: CreateCsFeeDTO) {
|
||||||
return this.manageFeeService.CREATECFFEE(body)
|
return this.manageFeeService.CREATECSFEE(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
@ApiTags('Manage Fee - Oracle')
|
||||||
@Post('/CreateCsFee')
|
@Post('/CreateEfFee')
|
||||||
CreateCsFee(@Body() body: CreateCsFeeDTO) {
|
CreateEeFee(@Body() body: CreateEfFeeDTO) {
|
||||||
return this.manageFeeService.CREATECSFEE(body)
|
return this.manageFeeService.CREATEEFFEE(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
@ApiTags('Manage Fee - Oracle')
|
||||||
@Post('/CreateEfFee')
|
@Post('/CreateFeeComm')
|
||||||
CreateEeFee(@Body() body: CreateEfFeeDTO) {
|
CreateFeeComm(@Body() body: CreateFeeCommDTO) {
|
||||||
return this.manageFeeService.CREATEEFFEE(body)
|
return this.manageFeeService.CREATEFEECOMM(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
@ApiTags('Manage Fee - Oracle')
|
||||||
@Post('/CreateFeeComm')
|
@Patch('/UpdateBasicFee')
|
||||||
CreateFeeComm(@Body() body: CreateFeeCommDTO) {
|
UpdateBasicFee(@Body() body: UpdateBasicFeeDTO) {
|
||||||
return this.manageFeeService.CREATEFEECOMM(body)
|
return this.manageFeeService.UPDATEBASICFEE(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
@ApiTags('Manage Fee - Oracle')
|
||||||
@Patch('/UpdateBasicFee')
|
@Patch('/UpdateBondRate')
|
||||||
UpdateBasicFee(@Body() body: UpdateBasicFeeDTO) {
|
UpdateBondRate(@Body() body: UpdateBondRateDTO) {
|
||||||
return this.manageFeeService.UPDATEBASICFEE(body)
|
return this.manageFeeService.UPDATEBONDRATE(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
@ApiTags('Manage Fee - Oracle')
|
||||||
@Patch('/UpdateBondRate')
|
@Patch('/UpdateCargoRate')
|
||||||
UpdateBondRate(@Body() body: UpdateBondRateDTO) {
|
UpdateCargoRate(@Body() body: UpdateCargoRateDTO) {
|
||||||
return this.manageFeeService.UPDATEBONDRATE(body)
|
return this.manageFeeService.UPDATECARGORATE(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
@ApiTags('Manage Fee - Oracle')
|
||||||
@Patch('/UpdateCargoRate')
|
@Patch('/UpdateCfFee')
|
||||||
UpdateCargoRate(@Body() body: UpdateCargoRateDTO) {
|
UpdateCfFee(@Body() body: UpdateCfFeeDTO) {
|
||||||
return this.manageFeeService.UPDATECARGORATE(body)
|
return this.manageFeeService.UPDATECFFEE(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
@ApiTags('Manage Fee - Oracle')
|
||||||
@Patch('/UpdateCfFee')
|
@Patch('/UpdateCsFee')
|
||||||
UpdateCfFee(@Body() body: UpdateCfFeeDTO) {
|
UpdateCsFee(@Body() body: UpdateCsFeeDTO) {
|
||||||
return this.manageFeeService.UPDATECFFEE(body)
|
return this.manageFeeService.UPDATECSFEE(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
@ApiTags('Manage Fee - Oracle')
|
||||||
@Patch('/UpdateCsFee')
|
@Patch('/UpdateEfFee')
|
||||||
UpdateCsFee(@Body() body: UpdateCsFeeDTO) {
|
UpdateEfFee(@Body() body: UpdateEfFeeDTO) {
|
||||||
return this.manageFeeService.UPDATECSFEE(body)
|
return this.manageFeeService.UPDATEEFFEE(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
@ApiTags('Manage Fee - Oracle')
|
||||||
@Patch('/UpdateEfFee')
|
@Patch('/UpdateFeeComm')
|
||||||
UpdateEfFee(@Body() body: UpdateEfFeeDTO) {
|
UpdateFeeComm(@Body() body: UpdateFeeCommBodyDTO) {
|
||||||
return this.manageFeeService.UPDATEEFFEE(body)
|
return this.manageFeeService.UPDATEFEECOMM(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
|
||||||
@Patch('/UpdateFeeComm')
|
|
||||||
UpdateFeeComm(@Body() body: UpdateFeeCommBodyDTO) {
|
|
||||||
return this.manageFeeService.UPDATEFEECOMM(body)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,360 +1,359 @@
|
|||||||
import { ApiProperty } from "@nestjs/swagger";
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
import { Transform } from "class-transformer";
|
import { Transform } from 'class-transformer';
|
||||||
import { IsDefined, IsInt, IsNumber, IsString, Min } from "class-validator";
|
import { IsDefined, IsInt, IsNumber, IsString, Min } from 'class-validator';
|
||||||
|
|
||||||
export class GetFeeGeneralDTO {
|
export class GetFeeGeneralDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Transform(({ value }) => Number(value))
|
@Transform(({ value }) => Number(value))
|
||||||
@Min(0, { message: "Property P_SPID must be at least 0" })
|
@Min(0, { message: 'Property P_SPID must be at least 0' })
|
||||||
@IsInt({ message: "Property P_SPID must be a whole number" })
|
@IsInt({ message: 'Property P_SPID must be a whole number' })
|
||||||
@IsNumber({}, { message: "Property P_SPID must be a number" })
|
@IsNumber({}, { message: 'Property P_SPID must be a number' })
|
||||||
@IsDefined({ message: "Property P_SPID is required" })
|
@IsDefined({ message: 'Property P_SPID is required' })
|
||||||
P_SPID: number;
|
P_SPID: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property P_ACTIVE_INACTIVE must be a string" })
|
@IsString({ message: 'Property P_ACTIVE_INACTIVE must be a string' })
|
||||||
@IsDefined({ message: "Property P_ACTIVE_INACTIVE is required" })
|
@IsDefined({ message: 'Property P_ACTIVE_INACTIVE is required' })
|
||||||
P_ACTIVE_INACTIVE: string;
|
P_ACTIVE_INACTIVE: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CreateBasicFeeDTO {
|
export class CreateBasicFeeDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_SPID: number;
|
P_SPID: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_STARTCARNETVALUE: number;
|
P_STARTCARNETVALUE: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_ENDCARNETVALUE: number;
|
P_ENDCARNETVALUE: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_EFFDATE: string;
|
P_EFFDATE: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_FEES: number;
|
P_FEES: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_USERID: string;
|
P_USERID: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CreateBondRateDTO {
|
export class CreateBondRateDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_SPID: number;
|
P_SPID: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_HOLDERTYPE: string;
|
P_HOLDERTYPE: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_USCIBMEMBERFLAG: string;
|
P_USCIBMEMBERFLAG: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_SPCLCOMMODITY: string;
|
P_SPCLCOMMODITY: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_SPCLCOUNTRY: string;
|
P_SPCLCOUNTRY: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_EFFDATE: string;
|
P_EFFDATE: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_RATE: number;
|
P_RATE: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_USERID: string;
|
P_USERID: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CreateCargoRateDTO {
|
export class CreateCargoRateDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_SPID: number;
|
P_SPID: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_CARNETTYPE: string;
|
P_CARNETTYPE: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_STARTSETS: number;
|
P_STARTSETS: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_ENDSETS: number;
|
P_ENDSETS: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_EFFDATE: string;
|
P_EFFDATE: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_RATE: number;
|
P_RATE: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_USERID: string;
|
P_USERID: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CreateCfFeeDTO {
|
export class CreateCfFeeDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_SPID: number;
|
P_SPID: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_STARTSETS: number;
|
P_STARTSETS: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_ENDSETS: number;
|
P_ENDSETS: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_EFFDATE: string;
|
P_EFFDATE: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_CUSTOMERTYPE: string;
|
P_CUSTOMERTYPE: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_CARNETTYPE: string;
|
P_CARNETTYPE: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_RATE: number;
|
P_RATE: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_USERID: string;
|
P_USERID: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CreateCsFeeDTO {
|
export class CreateCsFeeDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_SPID: number;
|
P_SPID: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_CUSTOMERTYPE: string;
|
P_CUSTOMERTYPE: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_CARNETTYPE: string;
|
P_CARNETTYPE: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_EFFDATE: string;
|
P_EFFDATE: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_RATE: number;
|
P_RATE: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_USERID: string;
|
P_USERID: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CreateEfFeeDTO {
|
export class CreateEfFeeDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_SPID: number;
|
P_SPID: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_CUSTOMERTYPE: string;
|
P_CUSTOMERTYPE: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_DELIVERYTYPE: string;
|
P_DELIVERYTYPE: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_STARTTIME: number;
|
P_STARTTIME: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_ENDTIME: number;
|
P_ENDTIME: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_TIMEZONE: string;
|
P_TIMEZONE: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_EFFDATE: string;
|
P_EFFDATE: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_FEES: number;
|
P_FEES: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_USERID: string;
|
P_USERID: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CreateFeeCommDTO {
|
export class CreateFeeCommDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_SPID: number;
|
P_SPID: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_PARAMID: number;
|
P_PARAMID: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_COMMRATE: number;
|
P_COMMRATE: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_EFFDATE: string;
|
P_EFFDATE: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_USERID: string;
|
P_USERID: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class UpdateBasicFeeDTO {
|
export class UpdateBasicFeeDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_BASICFEESETUPID: number;
|
P_BASICFEESETUPID: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_FEES: number;
|
P_FEES: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_EFFDATE: string;
|
P_EFFDATE: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_USERID: string;
|
P_USERID: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class UpdateBondRateDTO {
|
export class UpdateBondRateDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_BONDRATESETUPID: number;
|
P_BONDRATESETUPID: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_RATE: number;
|
P_RATE: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_EFFDATE: string;
|
P_EFFDATE: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_USERID: string;
|
P_USERID: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class UpdateCargoRateDTO {
|
export class UpdateCargoRateDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_CARGORATESETUPID: number;
|
P_CARGORATESETUPID: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_RATE: number;
|
P_RATE: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_EFFDATE: string;
|
P_EFFDATE: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_USERID: string;
|
P_USERID: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class UpdateCfFeeDTO {
|
export class UpdateCfFeeDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_CFFEESETUPID: number;
|
P_CFFEESETUPID: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_RATE: number;
|
P_RATE: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_EFFDATE: string;
|
P_EFFDATE: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_USERID: string;
|
P_USERID: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class UpdateCsFeeDTO {
|
export class UpdateCsFeeDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_CSFEESETUPID: number;
|
P_CSFEESETUPID: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_RATE: number;
|
P_RATE: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_EFFDATE: string;
|
P_EFFDATE: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_USERID: string;
|
P_USERID: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class UpdateEfFeeDTO {
|
export class UpdateEfFeeDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_EFFEESETUPID: number;
|
P_EFFEESETUPID: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_FEES: number;
|
P_FEES: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_EFFDATE: string;
|
P_EFFDATE: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_USERID: string;
|
P_USERID: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class UpdateFeeCommDTO {
|
export class UpdateFeeCommDTO {
|
||||||
|
@ApiProperty({ required: true })
|
||||||
|
@IsNumber()
|
||||||
|
P_FEECOMMID: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_FEECOMMID: number;
|
P_RATE: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsString()
|
||||||
P_RATE: number;
|
P_EFFDATE: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_EFFDATE: string;
|
P_USERID: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsString()
|
|
||||||
P_USERID: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class UpdateFeeCommBodyDTO {
|
export class UpdateFeeCommBodyDTO {
|
||||||
@ApiProperty({ type: UpdateFeeCommDTO, required: true }) // Correctly reference UpdateFeeCommDTO
|
@ApiProperty({ type: UpdateFeeCommDTO, required: true }) // Correctly reference UpdateFeeCommDTO
|
||||||
p_fees_comm: UpdateFeeCommDTO; // No need for @IsObject()
|
p_fees_comm: UpdateFeeCommDTO; // No need for @IsObject()
|
||||||
}
|
}
|
||||||
@ -4,6 +4,6 @@ import { ManageFeeService } from './manage-fee.service';
|
|||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
controllers: [ManageFeeController],
|
controllers: [ManageFeeController],
|
||||||
providers: [ManageFeeService]
|
providers: [ManageFeeService],
|
||||||
})
|
})
|
||||||
export class ManageFeeModule {}
|
export class ManageFeeModule {}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -1,95 +1,115 @@
|
|||||||
import { Body, Controller, Get, Param, ParseIntPipe, Patch, Post, Put, UsePipes, ValidationPipe } from '@nestjs/common';
|
import {
|
||||||
|
Body,
|
||||||
|
Controller,
|
||||||
|
Get,
|
||||||
|
Param,
|
||||||
|
ParseIntPipe,
|
||||||
|
Patch,
|
||||||
|
Post,
|
||||||
|
Put,
|
||||||
|
} from '@nestjs/common';
|
||||||
import { ApiTags } from '@nestjs/swagger';
|
import { ApiTags } from '@nestjs/swagger';
|
||||||
import { CreateHoldersDTO, GetHolderContactActivateOrInactivateDTO, GetHolderOrContactDTO, UpdateHolderContactDTO, UpdateHolderDTO } from './manage-holders.dto';
|
import {
|
||||||
|
CreateHoldersDTO,
|
||||||
|
GetHolderContactActivateOrInactivateDTO,
|
||||||
|
GetHolderOrContactDTO,
|
||||||
|
UpdateHolderContactDTO,
|
||||||
|
UpdateHolderDTO,
|
||||||
|
} from './manage-holders.dto';
|
||||||
import { ManageHoldersService } from './manage-holders.service';
|
import { ManageHoldersService } from './manage-holders.service';
|
||||||
|
|
||||||
@Controller('oracle')
|
@Controller('oracle')
|
||||||
export class ManageHoldersController {
|
export class ManageHoldersController {
|
||||||
|
constructor(private readonly manageHoldersService: ManageHoldersService) {}
|
||||||
|
|
||||||
constructor(private readonly manageHoldersService: ManageHoldersService) { }
|
@ApiTags('Manage Holders - Oracle')
|
||||||
|
@Post('/CreateHolderData')
|
||||||
|
CreateHolders(@Body() body: CreateHoldersDTO) {
|
||||||
|
return this.manageHoldersService.CreateHolders(body);
|
||||||
|
// return {message:"Request received.."}
|
||||||
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Holders - Oracle')
|
@ApiTags('Manage Holders - Oracle')
|
||||||
@Post('/CreateHolderData')
|
@Put('/UpdateHolder')
|
||||||
CreateHolders(@Body() body: CreateHoldersDTO) {
|
UpdateHolder(@Body() body: UpdateHolderDTO) {
|
||||||
return this.manageHoldersService.CreateHolders(body);
|
return this.manageHoldersService.UpdateHolder(body);
|
||||||
// return {message:"Request received.."}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@ApiTags('Manage Holders - Oracle')
|
@ApiTags('Manage Holders - Oracle')
|
||||||
@Put('/UpdateHolder')
|
@Put('/UpdateHolderContact')
|
||||||
UpdateHolder(@Body() body: UpdateHolderDTO) {
|
UpdateHolderContact(@Body() body: UpdateHolderContactDTO) {
|
||||||
return this.manageHoldersService.UpdateHolder(body);
|
return this.manageHoldersService.UpdateHolderContact(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Manage Holders - Oracle')
|
@ApiTags('Manage Holders - Oracle')
|
||||||
@Put('/UpdateHolderContact')
|
@Get('/GetHolderRecord/:p_spid/:p_holderid')
|
||||||
UpdateHolderContact(@Body() body: UpdateHolderContactDTO) {
|
GetHolderMaster(
|
||||||
return this.manageHoldersService.UpdateHolderContact(body);
|
@Param('p_spid', ParseIntPipe) p_spid: number,
|
||||||
}
|
@Param('p_holderid', ParseIntPipe) p_holderid: number,
|
||||||
|
) {
|
||||||
|
const reqParams: GetHolderOrContactDTO = { p_spid, p_holderid };
|
||||||
|
|
||||||
@ApiTags('Manage Holders - Oracle')
|
return this.manageHoldersService.GetHolderRecord(reqParams);
|
||||||
@Get('/GetHolderRecord/:p_spid/:p_holderid')
|
}
|
||||||
GetHolderMaster(
|
|
||||||
@Param('p_spid', ParseIntPipe) p_spid: number,
|
|
||||||
@Param('p_holderid', ParseIntPipe) p_holderid: number,
|
|
||||||
){
|
|
||||||
const reqParams:GetHolderOrContactDTO = {p_spid,p_holderid}
|
|
||||||
|
|
||||||
return this.manageHoldersService.GetHolderRecord(reqParams);
|
@ApiTags('Manage Holders - Oracle')
|
||||||
}
|
@Get('/GetHolderContacts/:p_spid/:p_holderid')
|
||||||
|
GetHolderContacts(
|
||||||
|
@Param('p_spid', ParseIntPipe) p_spid: number,
|
||||||
|
@Param('p_holderid', ParseIntPipe) p_holderid: number,
|
||||||
|
) {
|
||||||
|
const reqParams: GetHolderOrContactDTO = { p_spid, p_holderid };
|
||||||
|
|
||||||
@ApiTags('Manage Holders - Oracle')
|
return this.manageHoldersService.GetHolderContacts(reqParams);
|
||||||
@Get('/GetHolderContacts/:p_spid/:p_holderid')
|
}
|
||||||
GetHolderContacts(
|
|
||||||
@Param('p_spid', ParseIntPipe) p_spid: number,
|
|
||||||
@Param('p_holderid', ParseIntPipe) p_holderid: number,
|
|
||||||
){
|
|
||||||
const reqParams:GetHolderOrContactDTO = {p_spid,p_holderid}
|
|
||||||
|
|
||||||
return this.manageHoldersService.GetHolderContacts(reqParams);
|
@ApiTags('Manage Holders - Oracle')
|
||||||
}
|
@Patch('/InactivateHolder/:p_spid/:p_holderid')
|
||||||
|
InactivateHolder(
|
||||||
|
@Param('p_spid', ParseIntPipe) p_spid: number,
|
||||||
|
@Param('p_holderid', ParseIntPipe) p_holderid: number,
|
||||||
|
) {
|
||||||
|
const reqParams: GetHolderOrContactDTO = { p_spid, p_holderid };
|
||||||
|
|
||||||
@ApiTags('Manage Holders - Oracle')
|
return this.manageHoldersService.InactivateHolder(reqParams);
|
||||||
@Patch('/InactivateHolder/:p_spid/:p_holderid')
|
}
|
||||||
InactivateHolder(
|
|
||||||
@Param('p_spid', ParseIntPipe) p_spid: number,
|
|
||||||
@Param('p_holderid', ParseIntPipe) p_holderid: number,
|
|
||||||
){
|
|
||||||
const reqParams:GetHolderOrContactDTO = {p_spid,p_holderid}
|
|
||||||
|
|
||||||
return this.manageHoldersService.InactivateHolder(reqParams);
|
@ApiTags('Manage Holders - Oracle')
|
||||||
}
|
@Patch('/ReactivateHolder/:p_spid/:p_holderid')
|
||||||
|
ReactivateHolder(
|
||||||
|
@Param('p_spid', ParseIntPipe) p_spid: number,
|
||||||
|
@Param('p_holderid', ParseIntPipe) p_holderid: number,
|
||||||
|
) {
|
||||||
|
const reqParams: GetHolderOrContactDTO = { p_spid, p_holderid };
|
||||||
|
|
||||||
@ApiTags('Manage Holders - Oracle')
|
return this.manageHoldersService.ReactivateHolder(reqParams);
|
||||||
@Patch('/ReactivateHolder/:p_spid/:p_holderid')
|
}
|
||||||
ReactivateHolder(
|
|
||||||
@Param('p_spid', ParseIntPipe) p_spid: number,
|
|
||||||
@Param('p_holderid', ParseIntPipe) p_holderid: number,
|
|
||||||
){
|
|
||||||
const reqParams:GetHolderOrContactDTO = {p_spid,p_holderid}
|
|
||||||
|
|
||||||
return this.manageHoldersService.ReactivateHolder(reqParams);
|
@ApiTags('Manage Holders - Oracle')
|
||||||
}
|
@Patch('/InactivateHolderContact/:p_spid/:p_holderContactid')
|
||||||
|
InactivateHolderContact(
|
||||||
|
@Param('p_spid', ParseIntPipe) p_spid: number,
|
||||||
|
@Param('p_holderContactid', ParseIntPipe) p_holderContactid: number,
|
||||||
|
) {
|
||||||
|
const reqParams: GetHolderContactActivateOrInactivateDTO = {
|
||||||
|
p_spid,
|
||||||
|
p_holderContactid,
|
||||||
|
};
|
||||||
|
|
||||||
@ApiTags('Manage Holders - Oracle')
|
return this.manageHoldersService.InactivateHolderContact(reqParams);
|
||||||
@Patch('/InactivateHolderContact/:p_spid/:p_holderContactid')
|
}
|
||||||
InactivateHolderContact(
|
|
||||||
@Param('p_spid', ParseIntPipe) p_spid: number,
|
|
||||||
@Param('p_holderContactid', ParseIntPipe) p_holderContactid: number,
|
|
||||||
){
|
|
||||||
const reqParams:GetHolderContactActivateOrInactivateDTO = {p_spid,p_holderContactid}
|
|
||||||
|
|
||||||
return this.manageHoldersService.InactivateHolderContact(reqParams);
|
@ApiTags('Manage Holders - Oracle')
|
||||||
}
|
@Patch('/ReactivateHolderContact/:p_spid/:p_holderContactid')
|
||||||
|
ReactivateHolderContact(
|
||||||
|
@Param('p_spid', ParseIntPipe) p_spid: number,
|
||||||
|
@Param('p_holderid', ParseIntPipe) p_holderContactid: number,
|
||||||
|
) {
|
||||||
|
const reqParams: GetHolderContactActivateOrInactivateDTO = {
|
||||||
|
p_spid,
|
||||||
|
p_holderContactid,
|
||||||
|
};
|
||||||
|
|
||||||
@ApiTags('Manage Holders - Oracle')
|
return this.manageHoldersService.ReactivateHolderContact(reqParams);
|
||||||
@Patch('/ReactivateHolderContact/:p_spid/:p_holderContactid')
|
}
|
||||||
ReactivateHolderContact(
|
|
||||||
@Param('p_spid', ParseIntPipe) p_spid: number,
|
|
||||||
@Param('p_holderid', ParseIntPipe) p_holderContactid: number,
|
|
||||||
){
|
|
||||||
const reqParams:GetHolderContactActivateOrInactivateDTO = {p_spid,p_holderContactid}
|
|
||||||
|
|
||||||
return this.manageHoldersService.ReactivateHolderContact(reqParams);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,381 +1,487 @@
|
|||||||
import { ApiProperty } from '@nestjs/swagger';
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
import { Type } from 'class-transformer';
|
import { Type } from 'class-transformer';
|
||||||
import { IsString, IsNumber, IsOptional, ValidateNested, IsArray, IsDefined, Length, Max, Min, IsInt } from 'class-validator';
|
import {
|
||||||
|
IsString,
|
||||||
|
IsNumber,
|
||||||
|
IsOptional,
|
||||||
|
ValidateNested,
|
||||||
|
IsArray,
|
||||||
|
IsDefined,
|
||||||
|
Length,
|
||||||
|
Max,
|
||||||
|
Min,
|
||||||
|
IsInt,
|
||||||
|
} from 'class-validator';
|
||||||
|
|
||||||
export class p_contactstableDTO {
|
export class p_contactstableDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 50, { message: "Property FirstName must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property FirstName must be a string" })
|
message: 'Property FirstName must be between 0 to 50 characters',
|
||||||
@IsDefined({ message: "Property FirstName is required" })
|
})
|
||||||
FirstName: string;
|
@IsString({ message: 'Property FirstName must be a string' })
|
||||||
|
@IsDefined({ message: 'Property FirstName is required' })
|
||||||
|
FirstName: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 50, { message: "Property LastName must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property LastName must be a string" })
|
message: 'Property LastName must be between 0 to 50 characters',
|
||||||
@IsDefined({ message: "Property LastName is required" })
|
})
|
||||||
LastName: string;
|
@IsString({ message: 'Property LastName must be a string' })
|
||||||
|
@IsDefined({ message: 'Property LastName is required' })
|
||||||
|
LastName: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 3, { message: "Property MiddleInitial must be between 0 to 3 characters" })
|
@Length(0, 3, {
|
||||||
@IsString({ message: "Property MiddleInitial must be a string" })
|
message: 'Property MiddleInitial must be between 0 to 3 characters',
|
||||||
@IsOptional()
|
})
|
||||||
MiddleInitial?: string;
|
@IsString({ message: 'Property MiddleInitial must be a string' })
|
||||||
|
@IsOptional()
|
||||||
|
MiddleInitial?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 50, { message: "Property Title must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property Title must be a string" })
|
message: 'Property Title must be between 0 to 50 characters',
|
||||||
@IsOptional()
|
})
|
||||||
Title?: string;
|
@IsString({ message: 'Property Title must be a string' })
|
||||||
|
@IsOptional()
|
||||||
|
Title?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 100, { message: "Property EmailAddress must be between 0 to 100 characters" })
|
@Length(0, 100, {
|
||||||
@IsString({ message: "Property EmailAddress must be a string" })
|
message: 'Property EmailAddress must be between 0 to 100 characters',
|
||||||
@IsDefined({ message: "Property EmailAddress is required" })
|
})
|
||||||
EmailAddress: string;
|
@IsString({ message: 'Property EmailAddress must be a string' })
|
||||||
|
@IsDefined({ message: 'Property EmailAddress is required' })
|
||||||
|
EmailAddress: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 20, { message: "Property PhoneNo must be between 0 to 20 characters" })
|
@Length(0, 20, {
|
||||||
@IsString({ message: "Property PhoneNo must be a string" })
|
message: 'Property PhoneNo must be between 0 to 20 characters',
|
||||||
@IsDefined({ message: "Property PhoneNo is required" })
|
})
|
||||||
PhoneNo: string;
|
@IsString({ message: 'Property PhoneNo must be a string' })
|
||||||
|
@IsDefined({ message: 'Property PhoneNo is required' })
|
||||||
|
PhoneNo: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 20, { message: "Property MobileNo must be between 0 to 20 characters" })
|
@Length(0, 20, {
|
||||||
@IsString({ message: "Property MobileNo must be a string" })
|
message: 'Property MobileNo must be between 0 to 20 characters',
|
||||||
@IsDefined({ message: "Property MobileNo is required" })
|
})
|
||||||
MobileNo: string;
|
@IsString({ message: 'Property MobileNo must be a string' })
|
||||||
|
@IsDefined({ message: 'Property MobileNo is required' })
|
||||||
|
MobileNo: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 20, { message: "Property FaxNo must be between 0 to 20 characters" })
|
@Length(0, 20, {
|
||||||
@IsString({ message: "Property FaxNo must be a string" })
|
message: 'Property FaxNo must be between 0 to 20 characters',
|
||||||
@IsOptional()
|
})
|
||||||
FaxNo?: string;
|
@IsString({ message: 'Property FaxNo must be a string' })
|
||||||
|
@IsOptional()
|
||||||
|
FaxNo?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CreateHoldersDTO {
|
export class CreateHoldersDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||||
@IsInt({ message: "Property p_spid allows only whole numbers" })
|
@IsInt({ message: 'Property p_spid allows only whole numbers' })
|
||||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||||
@IsDefined({ message: "Property p_spid is required" })
|
@IsDefined({ message: 'Property p_spid is required' })
|
||||||
p_spid: number;
|
p_spid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_clientlocationid must not exceed 999999999" })
|
@Max(999999999, {
|
||||||
@Min(0, { message: "Property p_clientlocationid must be at least 0 or more" })
|
message: 'Property p_clientlocationid must not exceed 999999999',
|
||||||
@IsInt({ message: "Property p_clientlocationid allows only whole numbers" })
|
})
|
||||||
@IsNumber({}, { message: "Property p_clientlocationid must be a number" })
|
@Min(0, { message: 'Property p_clientlocationid must be at least 0 or more' })
|
||||||
@IsDefined({ message: "Property p_clientlocationid is required" })
|
@IsInt({ message: 'Property p_clientlocationid allows only whole numbers' })
|
||||||
p_clientlocationid: number;
|
@IsNumber({}, { message: 'Property p_clientlocationid must be a number' })
|
||||||
|
@IsDefined({ message: 'Property p_clientlocationid is required' })
|
||||||
|
p_clientlocationid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 15, { message: "Property p_holderno must be between 0 to 15 characters" })
|
@Length(0, 15, {
|
||||||
@IsString({ message: "Property p_holderno must be a string" })
|
message: 'Property p_holderno must be between 0 to 15 characters',
|
||||||
@IsDefined({ message: "Property p_holderno is required" })
|
})
|
||||||
p_holderno: string;
|
@IsString({ message: 'Property p_holderno must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_holderno is required' })
|
||||||
|
p_holderno: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 3, { message: "Property p_holdertype must be between 0 to 3 characters" })
|
@Length(0, 3, {
|
||||||
@IsString({ message: "Property p_holdertype must be a string" })
|
message: 'Property p_holdertype must be between 0 to 3 characters',
|
||||||
@IsDefined({ message: "Property p_holdertype is required" })
|
})
|
||||||
p_holdertype: string;
|
@IsString({ message: 'Property p_holdertype must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_holdertype is required' })
|
||||||
|
p_holdertype: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 1, { message: "Property p_uscibmemberflag must be between 0 to 1 character" })
|
@Length(0, 1, {
|
||||||
@IsString({ message: "Property p_uscibmemberflag must be a string" })
|
message: 'Property p_uscibmemberflag must be between 0 to 1 character',
|
||||||
@IsDefined({ message: "Property p_uscibmemberflag is required" })
|
})
|
||||||
p_uscibmemberflag: string;
|
@IsString({ message: 'Property p_uscibmemberflag must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_uscibmemberflag is required' })
|
||||||
|
p_uscibmemberflag: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 1, { message: "Property p_govagencyflag must be between 0 to 1 character" })
|
@Length(0, 1, {
|
||||||
@IsString({ message: "Property p_govagencyflag must be a string" })
|
message: 'Property p_govagencyflag must be between 0 to 1 character',
|
||||||
@IsDefined({ message: "Property p_govagencyflag is required" })
|
})
|
||||||
p_govagencyflag: string;
|
@IsString({ message: 'Property p_govagencyflag must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_govagencyflag is required' })
|
||||||
|
p_govagencyflag: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 50, { message: "Property p_holdername must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property p_holdername must be a string" })
|
message: 'Property p_holdername must be between 0 to 50 characters',
|
||||||
@IsDefined({ message: "Property p_holdername is required" })
|
})
|
||||||
p_holdername: string;
|
@IsString({ message: 'Property p_holdername must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_holdername is required' })
|
||||||
|
p_holdername: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 10, { message: "Property p_namequalifier must be between 0 to 10 characters" })
|
@Length(0, 10, {
|
||||||
@IsString({ message: "Property p_namequalifier must be a string" })
|
message: 'Property p_namequalifier must be between 0 to 10 characters',
|
||||||
@IsOptional()
|
})
|
||||||
p_namequalifier?: string;
|
@IsString({ message: 'Property p_namequalifier must be a string' })
|
||||||
|
@IsOptional()
|
||||||
|
p_namequalifier?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 50, { message: "Property p_addlname must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property p_addlname must be a string" })
|
message: 'Property p_addlname must be between 0 to 50 characters',
|
||||||
@IsOptional()
|
})
|
||||||
p_addlname?: string;
|
@IsString({ message: 'Property p_addlname must be a string' })
|
||||||
|
@IsOptional()
|
||||||
|
p_addlname?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 50, { message: "Property p_address1 must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property p_address1 must be a string" })
|
message: 'Property p_address1 must be between 0 to 50 characters',
|
||||||
@IsDefined({ message: "Property p_address1 is required" })
|
})
|
||||||
p_address1: string;
|
@IsString({ message: 'Property p_address1 must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_address1 is required' })
|
||||||
|
p_address1: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 50, { message: "Property p_address2 must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property p_address2 must be a string" })
|
message: 'Property p_address2 must be between 0 to 50 characters',
|
||||||
@IsOptional()
|
})
|
||||||
p_address2?: string;
|
@IsString({ message: 'Property p_address2 must be a string' })
|
||||||
|
@IsOptional()
|
||||||
|
p_address2?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 30, { message: "Property p_city must be between 0 to 30 characters" })
|
@Length(0, 30, {
|
||||||
@IsString({ message: "Property p_city must be a string" })
|
message: 'Property p_city must be between 0 to 30 characters',
|
||||||
@IsDefined({ message: "Property p_city is required" })
|
})
|
||||||
p_city: string;
|
@IsString({ message: 'Property p_city must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_city is required' })
|
||||||
|
p_city: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 2, { message: "Property p_state must be between 0 to 2 characters" })
|
@Length(0, 2, {
|
||||||
@IsString({ message: "Property p_state must be a string" })
|
message: 'Property p_state must be between 0 to 2 characters',
|
||||||
@IsDefined({ message: "Property p_state is required" })
|
})
|
||||||
p_state: string;
|
@IsString({ message: 'Property p_state must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_state is required' })
|
||||||
|
p_state: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 10, { message: "Property p_zip must be between 0 to 10 characters" })
|
@Length(0, 10, {
|
||||||
@IsString({ message: "Property p_zip must be a string" })
|
message: 'Property p_zip must be between 0 to 10 characters',
|
||||||
@IsDefined({ message: "Property p_zip is required" })
|
})
|
||||||
p_zip: string;
|
@IsString({ message: 'Property p_zip must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_zip is required' })
|
||||||
|
p_zip: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 50, { message: "Property p_country must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property p_country must be a string" })
|
message: 'Property p_country must be between 0 to 50 characters',
|
||||||
@IsDefined({ message: "Property p_country is required" })
|
})
|
||||||
p_country: string;
|
@IsString({ message: 'Property p_country must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_country is required' })
|
||||||
|
p_country: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 50, { message: "Property p_userid must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property p_userid must be a string" })
|
message: 'Property p_userid must be between 0 to 50 characters',
|
||||||
@IsDefined({ message: "Property p_userid is required" })
|
})
|
||||||
p_userid: string;
|
@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] })
|
@ApiProperty({ required: false, type: () => [p_contactstableDTO] })
|
||||||
@Type(() => p_contactstableDTO)
|
@Type(() => p_contactstableDTO)
|
||||||
@ValidateNested({ each: true })
|
@ValidateNested({ each: true })
|
||||||
@IsArray({ message: "Property p_contactstable allows only array type" })
|
@IsArray({ message: 'Property p_contactstable allows only array type' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_contactstable?: p_contactstableDTO[];
|
p_contactstable?: p_contactstableDTO[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export class UpdateHolderDTO {
|
export class UpdateHolderDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_holderid must not exceed 999999999" })
|
@Max(999999999, { message: 'Property p_holderid must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property p_holderid must be at least 0 or more" })
|
@Min(0, { message: 'Property p_holderid must be at least 0 or more' })
|
||||||
@IsInt({ message: "Property p_holderid allows only whole numbers" })
|
@IsInt({ message: 'Property p_holderid allows only whole numbers' })
|
||||||
@IsNumber({}, { message: "Property p_holderid must be a number" })
|
@IsNumber({}, { message: 'Property p_holderid must be a number' })
|
||||||
@IsDefined({ message: "Property p_holderid is required" })
|
@IsDefined({ message: 'Property p_holderid is required' })
|
||||||
p_holderid: number;
|
p_holderid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||||
@IsInt({ message: "Property p_spid allows only whole numbers" })
|
@IsInt({ message: 'Property p_spid allows only whole numbers' })
|
||||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||||
@IsDefined({ message: "Property p_spid is required" })
|
@IsDefined({ message: 'Property p_spid is required' })
|
||||||
p_spid: number;
|
p_spid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_locationid must not exceed 999999999" })
|
@Max(999999999, {
|
||||||
@Min(0, { message: "Property p_locationid must be at least 0 or more" })
|
message: 'Property p_locationid must not exceed 999999999',
|
||||||
@IsInt({ message: "Property p_locationid allows only whole numbers" })
|
})
|
||||||
@IsNumber({}, { message: "Property p_locationid must be a number" })
|
@Min(0, { message: 'Property p_locationid must be at least 0 or more' })
|
||||||
@IsDefined({ message: "Property p_locationid is required" })
|
@IsInt({ message: 'Property p_locationid allows only whole numbers' })
|
||||||
p_locationid: number;
|
@IsNumber({}, { message: 'Property p_locationid must be a number' })
|
||||||
|
@IsDefined({ message: 'Property p_locationid is required' })
|
||||||
|
p_locationid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 15, { message: "Property p_holderno must be between 0 to 15 characters" })
|
@Length(0, 15, {
|
||||||
@IsString({ message: "Property p_holderno must be a string" })
|
message: 'Property p_holderno must be between 0 to 15 characters',
|
||||||
@IsDefined({ message: "Property p_holderno is required" })
|
})
|
||||||
p_holderno: string;
|
@IsString({ message: 'Property p_holderno must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_holderno is required' })
|
||||||
|
p_holderno: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 3, { message: "Property p_holdertype must be between 0 to 3 characters" })
|
@Length(0, 3, {
|
||||||
@IsString({ message: "Property p_holdertype must be a string" })
|
message: 'Property p_holdertype must be between 0 to 3 characters',
|
||||||
@IsDefined({ message: "Property p_holdertype is required" })
|
})
|
||||||
p_holdertype: string;
|
@IsString({ message: 'Property p_holdertype must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_holdertype is required' })
|
||||||
|
p_holdertype: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 1, { message: "Property p_uscibmemberflag must be between 0 to 1 character" })
|
@Length(0, 1, {
|
||||||
@IsString({ message: "Property p_uscibmemberflag must be a string" })
|
message: 'Property p_uscibmemberflag must be between 0 to 1 character',
|
||||||
@IsDefined({ message: "Property p_uscibmemberflag is required" })
|
})
|
||||||
p_uscibmemberflag: string;
|
@IsString({ message: 'Property p_uscibmemberflag must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_uscibmemberflag is required' })
|
||||||
|
p_uscibmemberflag: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 1, { message: "Property p_govagencyflag must be between 0 to 1 character" })
|
@Length(0, 1, {
|
||||||
@IsString({ message: "Property p_govagencyflag must be a string" })
|
message: 'Property p_govagencyflag must be between 0 to 1 character',
|
||||||
@IsDefined({ message: "Property p_govagencyflag is required" })
|
})
|
||||||
p_govagencyflag: string;
|
@IsString({ message: 'Property p_govagencyflag must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_govagencyflag is required' })
|
||||||
|
p_govagencyflag: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 50, { message: "Property p_holdername must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property p_holdername must be a string" })
|
message: 'Property p_holdername must be between 0 to 50 characters',
|
||||||
@IsDefined({ message: "Property p_holdername is required" })
|
})
|
||||||
p_holdername: string;
|
@IsString({ message: 'Property p_holdername must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_holdername is required' })
|
||||||
|
p_holdername: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 10, { message: "Property p_namequalifier must be between 0 to 10 characters" })
|
@Length(0, 10, {
|
||||||
@IsString({ message: "Property p_namequalifier must be a string" })
|
message: 'Property p_namequalifier must be between 0 to 10 characters',
|
||||||
@IsOptional()
|
})
|
||||||
p_namequalifier?: string;
|
@IsString({ message: 'Property p_namequalifier must be a string' })
|
||||||
|
@IsOptional()
|
||||||
|
p_namequalifier?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 50, { message: "Property p_addlname must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property p_addlname must be a string" })
|
message: 'Property p_addlname must be between 0 to 50 characters',
|
||||||
@IsOptional()
|
})
|
||||||
p_addlname?: string;
|
@IsString({ message: 'Property p_addlname must be a string' })
|
||||||
|
@IsOptional()
|
||||||
|
p_addlname?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 50, { message: "Property p_address1 must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property p_address1 must be a string" })
|
message: 'Property p_address1 must be between 0 to 50 characters',
|
||||||
@IsDefined({ message: "Property p_address1 is required" })
|
})
|
||||||
p_address1: string;
|
@IsString({ message: 'Property p_address1 must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_address1 is required' })
|
||||||
|
p_address1: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 50, { message: "Property p_address2 must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property p_address2 must be a string" })
|
message: 'Property p_address2 must be between 0 to 50 characters',
|
||||||
@IsOptional()
|
})
|
||||||
p_address2?: string;
|
@IsString({ message: 'Property p_address2 must be a string' })
|
||||||
|
@IsOptional()
|
||||||
|
p_address2?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 30, { message: "Property p_city must be between 0 to 30 characters" })
|
@Length(0, 30, {
|
||||||
@IsString({ message: "Property p_city must be a string" })
|
message: 'Property p_city must be between 0 to 30 characters',
|
||||||
@IsDefined({ message: "Property p_city is required" })
|
})
|
||||||
p_city: string;
|
@IsString({ message: 'Property p_city must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_city is required' })
|
||||||
|
p_city: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 2, { message: "Property p_state must be between 0 to 2 characters" })
|
@Length(0, 2, {
|
||||||
@IsString({ message: "Property p_state must be a string" })
|
message: 'Property p_state must be between 0 to 2 characters',
|
||||||
@IsDefined({ message: "Property p_state is required" })
|
})
|
||||||
p_state: string;
|
@IsString({ message: 'Property p_state must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_state is required' })
|
||||||
|
p_state: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 10, { message: "Property p_zip must be between 0 to 10 characters" })
|
@Length(0, 10, {
|
||||||
@IsString({ message: "Property p_zip must be a string" })
|
message: 'Property p_zip must be between 0 to 10 characters',
|
||||||
@IsDefined({ message: "Property p_zip is required" })
|
})
|
||||||
p_zip: string;
|
@IsString({ message: 'Property p_zip must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_zip is required' })
|
||||||
|
p_zip: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 2, { message: "Property p_country must be between 0 to 2 characters" })
|
@Length(0, 2, {
|
||||||
@IsString({ message: "Property p_country must be a string" })
|
message: 'Property p_country must be between 0 to 2 characters',
|
||||||
@IsDefined({ message: "Property p_country is required" })
|
})
|
||||||
p_country: string;
|
@IsString({ message: 'Property p_country must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_country is required' })
|
||||||
|
p_country: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 100, { message: "Property p_userid must be between 0 to 100 characters" })
|
@Length(0, 100, {
|
||||||
@IsString({ message: "Property p_userid must be a string" })
|
message: 'Property p_userid must be between 0 to 100 characters',
|
||||||
@IsDefined({ message: "Property p_userid is required" })
|
})
|
||||||
p_userid: string;
|
@IsString({ message: 'Property p_userid must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_userid is required' })
|
||||||
|
p_userid: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class UpdateHolderContactDTO {
|
export class UpdateHolderContactDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_holdercontactid must not exceed 999999999" })
|
@Max(999999999, {
|
||||||
@Min(0, { message: "Property p_holdercontactid must be at least 0 or more" })
|
message: 'Property p_holdercontactid must not exceed 999999999',
|
||||||
@IsInt({ message: "Property p_holdercontactid allows only whole numbers" })
|
})
|
||||||
@IsNumber({}, { message: "Property p_holdercontactid must be a number" })
|
@Min(0, { message: 'Property p_holdercontactid must be at least 0 or more' })
|
||||||
@IsDefined({ message: "Property p_holdercontactid is required" })
|
@IsInt({ message: 'Property p_holdercontactid allows only whole numbers' })
|
||||||
p_holdercontactid: number;
|
@IsNumber({}, { message: 'Property p_holdercontactid must be a number' })
|
||||||
|
@IsDefined({ message: 'Property p_holdercontactid is required' })
|
||||||
|
p_holdercontactid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||||
@IsInt({ message: "Property p_spid allows only whole numbers" })
|
@IsInt({ message: 'Property p_spid allows only whole numbers' })
|
||||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||||
@IsDefined({ message: "Property p_spid is required" })
|
@IsDefined({ message: 'Property p_spid is required' })
|
||||||
p_spid: number;
|
p_spid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 50, { message: "Property p_firstname must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property p_firstname must be a string" })
|
message: 'Property p_firstname must be between 0 to 50 characters',
|
||||||
@IsDefined({ message: "Property p_firstname is required" })
|
})
|
||||||
p_firstname: string;
|
@IsString({ message: 'Property p_firstname must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_firstname is required' })
|
||||||
|
p_firstname: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 50, { message: "Property p_lastname must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property p_lastname must be a string" })
|
message: 'Property p_lastname must be between 0 to 50 characters',
|
||||||
@IsDefined({ message: "Property p_lastname is required" })
|
})
|
||||||
p_lastname: string;
|
@IsString({ message: 'Property p_lastname must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_lastname is required' })
|
||||||
|
p_lastname: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 3, { message: "Property p_middleinitial must be between 0 to 3 characters" })
|
@Length(0, 3, {
|
||||||
@IsString({ message: "Property p_middleinitial must be a string" })
|
message: 'Property p_middleinitial must be between 0 to 3 characters',
|
||||||
@IsOptional()
|
})
|
||||||
p_middleinitial?: string;
|
@IsString({ message: 'Property p_middleinitial must be a string' })
|
||||||
|
@IsOptional()
|
||||||
|
p_middleinitial?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 50, { message: "Property p_title must be between 0 to 50 characters" })
|
@Length(0, 50, {
|
||||||
@IsString({ message: "Property p_title must be a string" })
|
message: 'Property p_title must be between 0 to 50 characters',
|
||||||
@IsOptional()
|
})
|
||||||
p_title?: string;
|
@IsString({ message: 'Property p_title must be a string' })
|
||||||
|
@IsOptional()
|
||||||
|
p_title?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 20, { message: "Property p_phone must be between 0 to 20 characters" })
|
@Length(0, 20, {
|
||||||
@IsString({ message: "Property p_phone must be a string" })
|
message: 'Property p_phone must be between 0 to 20 characters',
|
||||||
@IsDefined({ message: "Property p_phone is required" })
|
})
|
||||||
p_phone: string;
|
@IsString({ message: 'Property p_phone must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_phone is required' })
|
||||||
|
p_phone: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 20, { message: "Property p_mobile must be between 0 to 20 characters" })
|
@Length(0, 20, {
|
||||||
@IsString({ message: "Property p_mobile must be a string" })
|
message: 'Property p_mobile must be between 0 to 20 characters',
|
||||||
@IsDefined({ message: "Property p_mobile is required" })
|
})
|
||||||
p_mobile: string;
|
@IsString({ message: 'Property p_mobile must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_mobile is required' })
|
||||||
|
p_mobile: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@Length(0, 20, { message: "Property p_fax must be between 0 to 20 characters" })
|
@Length(0, 20, {
|
||||||
@IsString({ message: "Property p_fax must be a string" })
|
message: 'Property p_fax must be between 0 to 20 characters',
|
||||||
@IsOptional()
|
})
|
||||||
p_fax?: string;
|
@IsString({ message: 'Property p_fax must be a string' })
|
||||||
|
@IsOptional()
|
||||||
|
p_fax?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 100, { message: "Property p_emailaddress must be between 0 to 100 characters" })
|
@Length(0, 100, {
|
||||||
@IsString({ message: "Property p_emailaddress must be a string" })
|
message: 'Property p_emailaddress must be between 0 to 100 characters',
|
||||||
@IsDefined({ message: "Property p_emailaddress is required" })
|
})
|
||||||
p_emailaddress: string;
|
@IsString({ message: 'Property p_emailaddress must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_emailaddress is required' })
|
||||||
|
p_emailaddress: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Length(0, 100, { message: "Property p_userid must be between 0 to 100 characters" })
|
@Length(0, 100, {
|
||||||
@IsString({ message: "Property p_userid must be a string" })
|
message: 'Property p_userid must be between 0 to 100 characters',
|
||||||
@IsDefined({ message: "Property p_userid is required" })
|
})
|
||||||
p_userid: string;
|
@IsString({ message: 'Property p_userid must be a string' })
|
||||||
|
@IsDefined({ message: 'Property p_userid is required' })
|
||||||
|
p_userid: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetHolderOrContactDTO {
|
export class GetHolderOrContactDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||||
@IsInt({ message: "Property p_spid allows only whole numbers" })
|
@IsInt({ message: 'Property p_spid allows only whole numbers' })
|
||||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||||
@IsDefined({ message: "Property p_spid is required" })
|
@IsDefined({ message: 'Property p_spid is required' })
|
||||||
p_spid: number;
|
p_spid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_holderid must not exceed 999999999" })
|
@Max(999999999, { message: 'Property p_holderid must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property p_holderid must be at least 0 or more" })
|
@Min(0, { message: 'Property p_holderid must be at least 0 or more' })
|
||||||
@IsInt({ message: "Property p_holderid allows only whole numbers" })
|
@IsInt({ message: 'Property p_holderid allows only whole numbers' })
|
||||||
@IsNumber({}, { message: "Property p_holderid must be a number" })
|
@IsNumber({}, { message: 'Property p_holderid must be a number' })
|
||||||
@IsDefined({ message: "Property p_holderid is required" })
|
@IsDefined({ message: 'Property p_holderid is required' })
|
||||||
p_holderid: number;
|
p_holderid: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetHolderContactActivateOrInactivateDTO {
|
export class GetHolderContactActivateOrInactivateDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_spid must not exceed 999999999" })
|
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property p_spid must be at least 0 or more" })
|
@Min(0, { message: 'Property p_spid must be at least 0 or more' })
|
||||||
@IsInt({ message: "Property p_spid allows only whole numbers" })
|
@IsInt({ message: 'Property p_spid allows only whole numbers' })
|
||||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||||
@IsDefined({ message: "Property p_spid is required" })
|
@IsDefined({ message: 'Property p_spid is required' })
|
||||||
p_spid: number;
|
p_spid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Max(999999999, { message: "Property p_holderid must not exceed 999999999" })
|
@Max(999999999, { message: 'Property p_holderid must not exceed 999999999' })
|
||||||
@Min(0, { message: "Property p_holderid must be at least 0 or more" })
|
@Min(0, { message: 'Property p_holderid must be at least 0 or more' })
|
||||||
@IsInt({ message: "Property p_holderid allows only whole numbers" })
|
@IsInt({ message: 'Property p_holderid allows only whole numbers' })
|
||||||
@IsNumber({}, { message: "Property p_holderid must be a number" })
|
@IsNumber({}, { message: 'Property p_holderid must be a number' })
|
||||||
@IsDefined({ message: "Property p_holderid is required" })
|
@IsDefined({ message: 'Property p_holderid is required' })
|
||||||
p_holderContactid: number;
|
p_holderContactid: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,8 +4,8 @@ import { ManageHoldersController } from './manage-holders.controller';
|
|||||||
import { DbModule } from 'src/db/db.module';
|
import { DbModule } from 'src/db/db.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports:[DbModule],
|
imports: [DbModule],
|
||||||
providers: [ManageHoldersService],
|
providers: [ManageHoldersService],
|
||||||
controllers: [ManageHoldersController]
|
controllers: [ManageHoldersController],
|
||||||
})
|
})
|
||||||
export class ManageHoldersModule {}
|
export class ManageHoldersModule {}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -1,37 +0,0 @@
|
|||||||
import { ApiProperty } from '@nestjs/swagger';
|
|
||||||
import { Type } from 'class-transformer';
|
|
||||||
import { IsArray, IsDefined, IsEmail, IsNumber, IsOptional, IsString, ValidateNested } from 'class-validator';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------
|
|
||||||
|
|
||||||
export class UserDTO {
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
id: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsDefined({ message: "Property name is required" })
|
|
||||||
@IsString({ message: "property name is required" })
|
|
||||||
name: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class TestDTO {
|
|
||||||
@ApiProperty({ required: true })
|
|
||||||
@IsNumber()
|
|
||||||
ItemNo: number;
|
|
||||||
|
|
||||||
@ApiProperty({ required: true, type: () => [UserDTO] })
|
|
||||||
@Type(() => UserDTO)
|
|
||||||
@ValidateNested({ each: true })
|
|
||||||
@IsArray()
|
|
||||||
user: UserDTO[];
|
|
||||||
}
|
|
||||||
@ -8,9 +8,17 @@ import { ManageFeeModule } from './manage-fee/manage-fee.module';
|
|||||||
import { ManageClientsModule } from './manage-clients/manage-clients.module';
|
import { ManageClientsModule } from './manage-clients/manage-clients.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports:[DbModule, HomePageModule, UscibManagedSpModule, ParamTableModule, ManageFeeModule, ManageHoldersModule, ManageClientsModule],
|
imports: [
|
||||||
|
DbModule,
|
||||||
|
HomePageModule,
|
||||||
|
UscibManagedSpModule,
|
||||||
|
ParamTableModule,
|
||||||
|
ManageFeeModule,
|
||||||
|
ManageHoldersModule,
|
||||||
|
ManageClientsModule,
|
||||||
|
],
|
||||||
providers: [],
|
providers: [],
|
||||||
controllers: [],
|
controllers: [],
|
||||||
exports:[]
|
exports: [],
|
||||||
})
|
})
|
||||||
export class OracleModule {}
|
export class OracleModule {}
|
||||||
|
|||||||
@ -1,48 +1,63 @@
|
|||||||
import { Body, Controller, Get, Patch, Post, Put, Query, UsePipes } from '@nestjs/common';
|
import { Body, Controller, Get, Patch, Post, Put, Query } from '@nestjs/common';
|
||||||
import { ApiQuery, ApiTags } from '@nestjs/swagger';
|
import { ApiQuery, ApiTags } from '@nestjs/swagger';
|
||||||
import { ParamTableService } from './param-table.service';
|
import { ParamTableService } from './param-table.service';
|
||||||
import { ActivateOrInactivateParamRecordDTO, CreateParamRecordDTO, CreateTableRecordDTO, getParamValuesDTO, UpdateParamRecordDTO } from './param-table.dto';
|
import {
|
||||||
|
ActivateOrInactivateParamRecordDTO,
|
||||||
|
CreateParamRecordDTO,
|
||||||
|
CreateTableRecordDTO,
|
||||||
|
getParamValuesDTO,
|
||||||
|
UpdateParamRecordDTO,
|
||||||
|
} from './param-table.dto';
|
||||||
|
|
||||||
@Controller('param-table')
|
@Controller('param-table')
|
||||||
export class ParamTableController {
|
export class ParamTableController {
|
||||||
|
constructor(private readonly paramTableService: ParamTableService) {}
|
||||||
|
|
||||||
constructor(private readonly paramTableService: ParamTableService) { }
|
@ApiTags('Param Table - Oracle')
|
||||||
|
@Get('/GetParamValues')
|
||||||
|
@ApiQuery({
|
||||||
|
name: 'P_SPID',
|
||||||
|
required: false,
|
||||||
|
type: Number,
|
||||||
|
description: 'The ID of the parameter',
|
||||||
|
})
|
||||||
|
@ApiQuery({
|
||||||
|
name: 'P_PARAMTYPE',
|
||||||
|
required: false,
|
||||||
|
type: String,
|
||||||
|
description: 'The type of the parameter',
|
||||||
|
})
|
||||||
|
getParamValues(@Query() body: getParamValuesDTO) {
|
||||||
|
return this.paramTableService.GETPARAMVALUES(body);
|
||||||
|
}
|
||||||
|
|
||||||
@ApiTags('Param Table - Oracle')
|
@ApiTags('Param Table - Oracle')
|
||||||
@Get('/GetParamValues')
|
@Post('/CreateTableRecord')
|
||||||
@ApiQuery({ name: 'P_SPID', required: false, type: Number, description: 'The ID of the parameter' })
|
createTableRecord(@Body() body: CreateTableRecordDTO) {
|
||||||
@ApiQuery({ name: 'P_PARAMTYPE', required: false, type: String, description: 'The type of the parameter' })
|
return this.paramTableService.CREATETABLERECORD(body);
|
||||||
getParamValues(@Query() body: getParamValuesDTO) {
|
}
|
||||||
return this.paramTableService.GETPARAMVALUES(body)
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiTags('Param Table - Oracle')
|
@ApiTags('Param Table - Oracle')
|
||||||
@Post('/CreateTableRecord')
|
@Post('/CreateParamRecord')
|
||||||
createTableRecord(@Body() body: CreateTableRecordDTO) {
|
createParamRecord(@Body() body: CreateParamRecordDTO) {
|
||||||
return this.paramTableService.CREATETABLERECORD(body)
|
return this.paramTableService.CREATEPARAMRECORD(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Param Table - Oracle')
|
@ApiTags('Param Table - Oracle')
|
||||||
@Post('/CreateParamRecord')
|
@Patch('/UpdateParamRecord')
|
||||||
createParamRecord(@Body() body: CreateParamRecordDTO) {
|
UpdateParamRecord(@Body() body: UpdateParamRecordDTO) {
|
||||||
return this.paramTableService.CREATEPARAMRECORD(body)
|
return this.paramTableService.UPDATEPARAMRECORD(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Param Table - Oracle')
|
@ApiTags('Param Table - Oracle')
|
||||||
@Patch('/UpdateParamRecord')
|
@Put('/InActivateParamRecord')
|
||||||
UpdateParamRecord(@Body() body: UpdateParamRecordDTO) {
|
inActivateParamRecord(@Body() body: ActivateOrInactivateParamRecordDTO) {
|
||||||
return this.paramTableService.UPDATEPARAMRECORD(body)
|
return this.paramTableService.INACTIVATEPARAMRECORD(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Param Table - Oracle')
|
@ApiTags('Param Table - Oracle')
|
||||||
@Put('/InActivateParamRecord')
|
@Put('/ReActivateParamRecord')
|
||||||
inActivateParamRecord(@Body() body: ActivateOrInactivateParamRecordDTO) {
|
reActivateParamRecord(@Body() body: ActivateOrInactivateParamRecordDTO) {
|
||||||
return this.paramTableService.INACTIVATEPARAMRECORD(body)
|
return this.paramTableService.REACTIVATEPARAMRECORD(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Param Table - Oracle')
|
|
||||||
@Put('/ReActivateParamRecord')
|
|
||||||
reActivateParamRecord(@Body() body: ActivateOrInactivateParamRecordDTO) {
|
|
||||||
return this.paramTableService.REACTIVATEPARAMRECORD(body)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,140 +1,147 @@
|
|||||||
import { ApiProperty } from "@nestjs/swagger";
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
import { Transform } from "class-transformer";
|
import { Transform } from 'class-transformer';
|
||||||
import { IsDefined, IsInt, IsNumber, IsOptional, IsString, Min, ValidateIf } from "class-validator";
|
import {
|
||||||
|
IsDefined,
|
||||||
|
IsInt,
|
||||||
|
IsNumber,
|
||||||
|
IsOptional,
|
||||||
|
IsString,
|
||||||
|
Min,
|
||||||
|
} from 'class-validator';
|
||||||
|
|
||||||
export class CreateTableRecordDTO {
|
export class CreateTableRecordDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property P_USERID must be a string" })
|
@IsString({ message: 'Property P_USERID must be a string' })
|
||||||
@IsDefined({ message: "Property P_USERID is required" })
|
@IsDefined({ message: 'Property P_USERID is required' })
|
||||||
P_USERID: string;
|
P_USERID: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property P_TABLEFULLDESC must be a string" })
|
@IsString({ message: 'Property P_TABLEFULLDESC must be a string' })
|
||||||
@IsDefined({ message: "Property P_TABLEFULLDESC is required" })
|
@IsDefined({ message: 'Property P_TABLEFULLDESC is required' })
|
||||||
P_TABLEFULLDESC: string;
|
P_TABLEFULLDESC: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CreateParamRecordDTO {
|
export class CreateParamRecordDTO {
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_SPID?: number;
|
P_SPID?: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_PARAMTYPE: string;
|
P_PARAMTYPE: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_PARAMDESC: string;
|
P_PARAMDESC: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_PARAMVALUE: string;
|
P_PARAMVALUE: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsString()
|
@IsString()
|
||||||
P_ADDLPARAMVALUE1?: string;
|
P_ADDLPARAMVALUE1?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsString()
|
@IsString()
|
||||||
P_ADDLPARAMVALUE2?: string;
|
P_ADDLPARAMVALUE2?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsString()
|
@IsString()
|
||||||
P_ADDLPARAMVALUE3?: string;
|
P_ADDLPARAMVALUE3?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsString()
|
@IsString()
|
||||||
P_ADDLPARAMVALUE4?: string;
|
P_ADDLPARAMVALUE4?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsString()
|
@IsString()
|
||||||
P_ADDLPARAMVALUE5?: string;
|
P_ADDLPARAMVALUE5?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_SORTSEQ: number;
|
P_SORTSEQ: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_USERID: string;
|
P_USERID: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class UpdateParamRecordDTO {
|
export class UpdateParamRecordDTO {
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_SPID?: number;
|
P_SPID?: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_PARAMID: number;
|
P_PARAMID: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_PARAMDESC: string;
|
P_PARAMDESC: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsString()
|
@IsString()
|
||||||
P_ADDLPARAMVALUE1?: string;
|
P_ADDLPARAMVALUE1?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsString()
|
@IsString()
|
||||||
P_ADDLPARAMVALUE2?: string;
|
P_ADDLPARAMVALUE2?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsString()
|
@IsString()
|
||||||
P_ADDLPARAMVALUE3?: string;
|
P_ADDLPARAMVALUE3?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsString()
|
@IsString()
|
||||||
P_ADDLPARAMVALUE4?: string;
|
P_ADDLPARAMVALUE4?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsString()
|
@IsString()
|
||||||
P_ADDLPARAMVALUE5?: string;
|
P_ADDLPARAMVALUE5?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_SORTSEQ: number;
|
P_SORTSEQ: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_USERID: string;
|
P_USERID: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class getParamValuesDTO {
|
export class getParamValuesDTO {
|
||||||
@IsInt({ message: "Property P_SPID must be a whole number" })
|
@IsInt({ message: 'Property P_SPID must be a whole number' })
|
||||||
@IsNumber({}, { message: "Property P_SPID must be a number" })
|
@IsNumber({}, { message: 'Property P_SPID must be a number' })
|
||||||
@Min(0, { message: "Property P_SPID must be at least 0" })
|
@Min(0, { message: 'Property P_SPID must be at least 0' })
|
||||||
@Transform(({ value }) => Number(value))
|
@Transform(({ value }) => Number(value))
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
P_SPID?: number;
|
P_SPID?: number;
|
||||||
|
|
||||||
@IsString({ message: "Property P_PARAMTYPE must be a string" })
|
@IsString({ message: 'Property P_PARAMTYPE must be a string' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
P_PARAMTYPE?: string;
|
P_PARAMTYPE?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ActivateOrInactivateParamRecordDTO {
|
export class ActivateOrInactivateParamRecordDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber({}, { message: "Property P_PARAMID must be a number" })
|
@IsNumber({}, { message: 'Property P_PARAMID must be a number' })
|
||||||
@IsDefined({ message: "Property P_PARAMID is required" })
|
@IsDefined({ message: 'Property P_PARAMID is required' })
|
||||||
P_PARAMID: number;
|
P_PARAMID: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property P_USERID must be a string" })
|
@IsString({ message: 'Property P_USERID must be a string' })
|
||||||
@IsDefined({ message: "Property P_USERID is required" })
|
@IsDefined({ message: 'Property P_USERID is required' })
|
||||||
P_USERID: string;
|
P_USERID: string;
|
||||||
}
|
}
|
||||||
@ -4,6 +4,6 @@ import { ParamTableService } from './param-table.service';
|
|||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
controllers: [ParamTableController],
|
controllers: [ParamTableController],
|
||||||
providers: [ParamTableService]
|
providers: [ParamTableService],
|
||||||
})
|
})
|
||||||
export class ParamTableModule {}
|
export class ParamTableModule {}
|
||||||
|
|||||||
@ -1,128 +1,134 @@
|
|||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { OracleDBService } from 'src/db/db.service';
|
import { OracleDBService } from 'src/db/db.service';
|
||||||
import * as oracledb from 'oracledb'
|
import * as oracledb from 'oracledb';
|
||||||
import { ActivateOrInactivateParamRecordDTO, CreateParamRecordDTO, CreateTableRecordDTO, getParamValuesDTO, UpdateParamRecordDTO } from './param-table.dto';
|
import {
|
||||||
|
ActivateOrInactivateParamRecordDTO,
|
||||||
|
CreateParamRecordDTO,
|
||||||
|
CreateTableRecordDTO,
|
||||||
|
getParamValuesDTO,
|
||||||
|
UpdateParamRecordDTO,
|
||||||
|
} from './param-table.dto';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ParamTableService {
|
export class ParamTableService {
|
||||||
constructor(private readonly oracleDBService: OracleDBService) { }
|
constructor(private readonly oracleDBService: OracleDBService) {}
|
||||||
|
|
||||||
async GETPARAMVALUES(body:getParamValuesDTO) {
|
async GETPARAMVALUES(body: getParamValuesDTO) {
|
||||||
|
const finalBody = {
|
||||||
|
P_SPID: body.P_SPID ? body.P_SPID : null,
|
||||||
|
P_PARAMTYPE: body.P_PARAMTYPE ? body.P_PARAMTYPE : null,
|
||||||
|
};
|
||||||
|
|
||||||
let finalBody = {
|
let connection;
|
||||||
P_SPID: body.P_SPID ? body.P_SPID : null,
|
let rows = [];
|
||||||
P_PARAMTYPE: body.P_PARAMTYPE ? body.P_PARAMTYPE : null
|
try {
|
||||||
}
|
connection = await this.oracleDBService.getConnection();
|
||||||
|
if (!connection) {
|
||||||
|
throw new Error('No DB Connected');
|
||||||
|
}
|
||||||
|
|
||||||
let connection;
|
const result = await connection.execute(
|
||||||
let rows = [];
|
`BEGIN
|
||||||
try {
|
|
||||||
connection = await this.oracleDBService.getConnection()
|
|
||||||
if (!connection) {
|
|
||||||
throw new Error('No DB Connected')
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = await connection.execute(
|
|
||||||
`BEGIN
|
|
||||||
MANAGEPARAMTABLE_PKG.GETPARAMVALUES(:P_SPID,:P_PARAMTYPE,:p_cursor);
|
MANAGEPARAMTABLE_PKG.GETPARAMVALUES(:P_SPID,:P_PARAMTYPE,:p_cursor);
|
||||||
END;`,
|
END;`,
|
||||||
{
|
{
|
||||||
P_SPID: {
|
P_SPID: {
|
||||||
val: finalBody.P_SPID,
|
val: finalBody.P_SPID,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
P_PARAMTYPE: {
|
P_PARAMTYPE: {
|
||||||
val: finalBody.P_PARAMTYPE,
|
val: finalBody.P_PARAMTYPE,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR,
|
||||||
},
|
},
|
||||||
p_cursor: {
|
p_cursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result.outBinds && result.outBinds.p_cursor) {
|
if (result.outBinds && result.outBinds.p_cursor) {
|
||||||
const cursor = result.outBinds.p_cursor;
|
const cursor = result.outBinds.p_cursor;
|
||||||
let rowsBatch;
|
let rowsBatch;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
rowsBatch = await cursor.getRows(100);
|
rowsBatch = await cursor.getRows(100);
|
||||||
rows = rows.concat(rowsBatch);
|
rows = rows.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
await cursor.close();
|
||||||
|
} else {
|
||||||
|
throw new Error('No cursor returned from the stored procedure');
|
||||||
|
}
|
||||||
|
|
||||||
await cursor.close();
|
return rows;
|
||||||
} else {
|
} catch (err) {
|
||||||
throw new Error('No cursor returned from the stored procedure');
|
if (err instanceof Error) {
|
||||||
}
|
return { error: err.message };
|
||||||
|
} else {
|
||||||
return rows;
|
return { error: 'An unknown error occurred' };
|
||||||
|
}
|
||||||
} catch (err) {
|
|
||||||
|
|
||||||
return { error: err.message }
|
|
||||||
} finally { }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async CREATETABLERECORD(body: CreateTableRecordDTO) {
|
async CREATETABLERECORD(body: CreateTableRecordDTO) {
|
||||||
let connection;
|
let connection;
|
||||||
try {
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
|
if (!connection) {
|
||||||
|
throw new Error('No DB Connected');
|
||||||
|
}
|
||||||
|
|
||||||
connection = await this.oracleDBService.getConnection()
|
const result = await connection.execute(
|
||||||
if (!connection) {
|
`BEGIN
|
||||||
throw new Error('No DB Connected')
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = await connection.execute(
|
|
||||||
`BEGIN
|
|
||||||
MANAGEPARAMTABLE_PKG.CREATETABLERECORD(:P_USERID,:P_TABLEFULLDESC,:p_cursor);
|
MANAGEPARAMTABLE_PKG.CREATETABLERECORD(:P_USERID,:P_TABLEFULLDESC,:p_cursor);
|
||||||
END;`,
|
END;`,
|
||||||
{
|
{
|
||||||
P_TABLEFULLDESC: {
|
P_TABLEFULLDESC: {
|
||||||
val: body.P_TABLEFULLDESC,
|
val: body.P_TABLEFULLDESC,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
P_USERID: {
|
P_USERID: {
|
||||||
val: body.P_USERID,
|
val: body.P_USERID,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
|
|
||||||
p_cursor: {
|
p_cursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
}, {
|
},
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
{
|
||||||
}
|
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||||
);
|
},
|
||||||
await connection.commit();
|
);
|
||||||
|
await connection.commit();
|
||||||
|
|
||||||
let fres = await result.outBinds.p_cursor.getRows();
|
const fres = await result.outBinds.p_cursor.getRows();
|
||||||
|
|
||||||
return fres
|
return fres;
|
||||||
|
} catch (err) {
|
||||||
} catch (err) {
|
if (err instanceof Error) {
|
||||||
|
return { error: err.message };
|
||||||
return { error: err.message }
|
} else {
|
||||||
} finally { }
|
return { error: 'An unknown error occurred' };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async CREATEPARAMRECORD(body: CreateParamRecordDTO) {
|
async CREATEPARAMRECORD(body: CreateParamRecordDTO) {
|
||||||
let connection;
|
let connection;
|
||||||
try {
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
|
if (!connection) {
|
||||||
|
throw new Error('No DB Connected');
|
||||||
|
}
|
||||||
|
|
||||||
connection = await this.oracleDBService.getConnection()
|
const result = await connection.execute(
|
||||||
if (!connection) {
|
`BEGIN
|
||||||
throw new Error('No DB Connected')
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = await connection.execute(
|
|
||||||
`BEGIN
|
|
||||||
MANAGEPARAMTABLE_PKG.CREATEPARAMRECORD(
|
MANAGEPARAMTABLE_PKG.CREATEPARAMRECORD(
|
||||||
:P_SPID,
|
:P_SPID,
|
||||||
:P_PARAMTYPE,
|
:P_PARAMTYPE,
|
||||||
@ -137,84 +143,85 @@ export class ParamTableService {
|
|||||||
:P_USERID,
|
:P_USERID,
|
||||||
:p_cursor);
|
:p_cursor);
|
||||||
END;`,
|
END;`,
|
||||||
{
|
{
|
||||||
P_SPID: {
|
P_SPID: {
|
||||||
val: body.P_SPID,
|
val: body.P_SPID,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
P_PARAMTYPE: {
|
P_PARAMTYPE: {
|
||||||
val: body.P_PARAMTYPE,
|
val: body.P_PARAMTYPE,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
P_PARAMDESC: {
|
P_PARAMDESC: {
|
||||||
val: body.P_PARAMDESC,
|
val: body.P_PARAMDESC,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
P_PARAMVALUE: {
|
P_PARAMVALUE: {
|
||||||
val: body.P_PARAMVALUE,
|
val: body.P_PARAMVALUE,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
P_ADDLPARAMVALUE1: {
|
P_ADDLPARAMVALUE1: {
|
||||||
val: body.P_ADDLPARAMVALUE1,
|
val: body.P_ADDLPARAMVALUE1,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
P_ADDLPARAMVALUE2: {
|
P_ADDLPARAMVALUE2: {
|
||||||
val: body.P_ADDLPARAMVALUE2,
|
val: body.P_ADDLPARAMVALUE2,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
P_ADDLPARAMVALUE3: {
|
P_ADDLPARAMVALUE3: {
|
||||||
val: body.P_ADDLPARAMVALUE3,
|
val: body.P_ADDLPARAMVALUE3,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
P_ADDLPARAMVALUE4: {
|
P_ADDLPARAMVALUE4: {
|
||||||
val: body.P_ADDLPARAMVALUE4,
|
val: body.P_ADDLPARAMVALUE4,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
P_ADDLPARAMVALUE5: {
|
P_ADDLPARAMVALUE5: {
|
||||||
val: body.P_ADDLPARAMVALUE5,
|
val: body.P_ADDLPARAMVALUE5,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
P_SORTSEQ: {
|
P_SORTSEQ: {
|
||||||
val: body.P_SORTSEQ,
|
val: body.P_SORTSEQ,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
P_USERID: {
|
P_USERID: {
|
||||||
val: body.P_USERID,
|
val: body.P_USERID,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
|
|
||||||
p_cursor: {
|
p_cursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
}, {
|
},
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
{
|
||||||
}
|
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||||
);
|
},
|
||||||
await connection.commit();
|
);
|
||||||
|
await connection.commit();
|
||||||
|
|
||||||
let fres = await result.outBinds.p_cursor.getRows();
|
const fres = await result.outBinds.p_cursor.getRows();
|
||||||
|
|
||||||
return fres
|
return fres;
|
||||||
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
} catch (err) {
|
return { error: err.message };
|
||||||
|
} else {
|
||||||
return { error: err.message }
|
return { error: 'An unknown error occurred' };
|
||||||
} finally { }
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async UPDATEPARAMRECORD(body: UpdateParamRecordDTO) {
|
async UPDATEPARAMRECORD(body: UpdateParamRecordDTO) {
|
||||||
let connection;
|
let connection;
|
||||||
try {
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
|
if (!connection) {
|
||||||
|
throw new Error('No DB Connected');
|
||||||
|
}
|
||||||
|
|
||||||
connection = await this.oracleDBService.getConnection()
|
const result = await connection.execute(
|
||||||
if (!connection) {
|
`BEGIN
|
||||||
throw new Error('No DB Connected')
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = await connection.execute(
|
|
||||||
`BEGIN
|
|
||||||
MANAGEPARAMTABLE_PKG.UPDATEPARAMRECORD(
|
MANAGEPARAMTABLE_PKG.UPDATEPARAMRECORD(
|
||||||
:P_SPID,
|
:P_SPID,
|
||||||
:P_PARAMID,
|
:P_PARAMID,
|
||||||
@ -228,140 +235,142 @@ export class ParamTableService {
|
|||||||
:P_USERID,
|
:P_USERID,
|
||||||
:p_cursor);
|
:p_cursor);
|
||||||
END;`,
|
END;`,
|
||||||
{
|
{
|
||||||
P_SPID: {
|
P_SPID: {
|
||||||
val: body.P_SPID,
|
val: body.P_SPID,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
P_PARAMID: {
|
P_PARAMID: {
|
||||||
val: body.P_PARAMID,
|
val: body.P_PARAMID,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
P_PARAMDESC: {
|
P_PARAMDESC: {
|
||||||
val: body.P_PARAMDESC,
|
val: body.P_PARAMDESC,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
P_ADDLPARAMVALUE1: {
|
P_ADDLPARAMVALUE1: {
|
||||||
val: body.P_ADDLPARAMVALUE1,
|
val: body.P_ADDLPARAMVALUE1,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
P_ADDLPARAMVALUE2: {
|
P_ADDLPARAMVALUE2: {
|
||||||
val: body.P_ADDLPARAMVALUE2,
|
val: body.P_ADDLPARAMVALUE2,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
P_ADDLPARAMVALUE3: {
|
P_ADDLPARAMVALUE3: {
|
||||||
val: body.P_ADDLPARAMVALUE3,
|
val: body.P_ADDLPARAMVALUE3,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
P_ADDLPARAMVALUE4: {
|
P_ADDLPARAMVALUE4: {
|
||||||
val: body.P_ADDLPARAMVALUE4,
|
val: body.P_ADDLPARAMVALUE4,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
P_ADDLPARAMVALUE5: {
|
P_ADDLPARAMVALUE5: {
|
||||||
val: body.P_ADDLPARAMVALUE5,
|
val: body.P_ADDLPARAMVALUE5,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
P_SORTSEQ: {
|
P_SORTSEQ: {
|
||||||
val: body.P_SORTSEQ,
|
val: body.P_SORTSEQ,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
P_USERID: {
|
P_USERID: {
|
||||||
val: body.P_USERID,
|
val: body.P_USERID,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
|
|
||||||
p_cursor: {
|
p_cursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
}, {
|
},
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
{
|
||||||
}
|
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||||
);
|
},
|
||||||
await connection.commit();
|
);
|
||||||
|
await connection.commit();
|
||||||
|
|
||||||
let fres = await result.outBinds.p_cursor.getRows();
|
const fres = await result.outBinds.p_cursor.getRows();
|
||||||
|
|
||||||
return fres
|
return fres;
|
||||||
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
} catch (err) {
|
return { error: err.message };
|
||||||
|
} else {
|
||||||
return { error: err.message }
|
return { error: 'An unknown error occurred' };
|
||||||
} finally { }
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async INACTIVATEPARAMRECORD(body: ActivateOrInactivateParamRecordDTO) {
|
async INACTIVATEPARAMRECORD(body: ActivateOrInactivateParamRecordDTO) {
|
||||||
let connection;
|
let connection;
|
||||||
try {
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
|
if (!connection) {
|
||||||
|
throw new Error('No DB Connected');
|
||||||
|
}
|
||||||
|
|
||||||
connection = await this.oracleDBService.getConnection()
|
const result = await connection.execute(
|
||||||
if (!connection) {
|
`BEGIN
|
||||||
throw new Error('No DB Connected')
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = await connection.execute(
|
|
||||||
`BEGIN
|
|
||||||
MANAGEPARAMTABLE_PKG.INACTIVATEPARAMRECORD(
|
MANAGEPARAMTABLE_PKG.INACTIVATEPARAMRECORD(
|
||||||
:P_PARAMID,
|
:P_PARAMID,
|
||||||
:P_USERID);
|
:P_USERID);
|
||||||
END;`,
|
END;`,
|
||||||
{
|
{
|
||||||
P_PARAMID: {
|
P_PARAMID: {
|
||||||
val: body.P_PARAMID,
|
val: body.P_PARAMID,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
P_USERID: {
|
P_USERID: {
|
||||||
val: body.P_USERID,
|
val: body.P_USERID,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
await connection.commit();
|
await connection.commit();
|
||||||
|
|
||||||
return "SP Executed Successfully"
|
return 'SP Executed Successfully';
|
||||||
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
} catch (err) {
|
return { error: err.message };
|
||||||
|
} else {
|
||||||
return { error: err.message }
|
return { error: 'An unknown error occurred' };
|
||||||
} finally { }
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async REACTIVATEPARAMRECORD(body: ActivateOrInactivateParamRecordDTO) {
|
async REACTIVATEPARAMRECORD(body: ActivateOrInactivateParamRecordDTO) {
|
||||||
let connection;
|
let connection;
|
||||||
try {
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
|
if (!connection) {
|
||||||
|
throw new Error('No DB Connected');
|
||||||
|
}
|
||||||
|
|
||||||
connection = await this.oracleDBService.getConnection()
|
const result = await connection.execute(
|
||||||
if (!connection) {
|
`BEGIN
|
||||||
throw new Error('No DB Connected')
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = await connection.execute(
|
|
||||||
`BEGIN
|
|
||||||
MANAGEPARAMTABLE_PKG.REACTIVATEPARAMRECORD(
|
MANAGEPARAMTABLE_PKG.REACTIVATEPARAMRECORD(
|
||||||
:P_PARAMID,
|
:P_PARAMID,
|
||||||
:P_USERID);
|
:P_USERID);
|
||||||
END;`,
|
END;`,
|
||||||
{
|
{
|
||||||
P_PARAMID: {
|
P_PARAMID: {
|
||||||
val: body.P_PARAMID,
|
val: body.P_PARAMID,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
P_USERID: {
|
P_USERID: {
|
||||||
val: body.P_USERID,
|
val: body.P_USERID,
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
await connection.commit();
|
await connection.commit();
|
||||||
|
|
||||||
return "SP Executed Successfully"
|
return 'SP Executed Successfully';
|
||||||
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
} catch (err) {
|
return { error: err.message };
|
||||||
|
} else {
|
||||||
return { error: err.message }
|
return { error: 'An unknown error occurred' };
|
||||||
} finally { }
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,22 +1,24 @@
|
|||||||
import { Body, Controller, Get, Param, ParseIntPipe, Post, Query } from '@nestjs/common';
|
import { Body, Controller, Get, Post, Query } from '@nestjs/common';
|
||||||
import { CreateCarnetSequenceDTO, GetCarnetSequenceDTO } from './carnet-sequence.dto';
|
import {
|
||||||
|
CreateCarnetSequenceDTO,
|
||||||
|
GetCarnetSequenceDTO,
|
||||||
|
} from './carnet-sequence.dto';
|
||||||
import { ApiTags } from '@nestjs/swagger';
|
import { ApiTags } from '@nestjs/swagger';
|
||||||
import { CarnetSequenceService } from './carnet-sequence.service';
|
import { CarnetSequenceService } from './carnet-sequence.service';
|
||||||
|
|
||||||
@Controller('carnet-sequence')
|
@Controller('carnet-sequence')
|
||||||
export class CarnetSequenceController {
|
export class CarnetSequenceController {
|
||||||
|
constructor(private readonly carnetSequenceService: CarnetSequenceService) {}
|
||||||
|
|
||||||
constructor(private readonly carnetSequenceService:CarnetSequenceService){}
|
@ApiTags('Carnet Sequence - Oracle')
|
||||||
|
@Post('/CreateCarnetSequence/')
|
||||||
|
createCarnetSequence(@Body() body: CreateCarnetSequenceDTO) {
|
||||||
|
return this.carnetSequenceService.createCarnetSequence(body);
|
||||||
|
}
|
||||||
|
|
||||||
@ApiTags('Carnet Sequence - Oracle')
|
@ApiTags('Carnet Sequence - Oracle')
|
||||||
@Post('/CreateCarnetSequence/')
|
@Get('/GetCarnetSequence')
|
||||||
createCarnetSequence(@Body() body: CreateCarnetSequenceDTO) {
|
getCarnetSequence(@Query() body: GetCarnetSequenceDTO) {
|
||||||
return this.carnetSequenceService.createCarnetSequence(body)
|
return this.carnetSequenceService.getCarnetSequence(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Carnet Sequence - Oracle')
|
|
||||||
@Get('/GetCarnetSequence')
|
|
||||||
getCarnetSequence(@Query() body: GetCarnetSequenceDTO) {
|
|
||||||
return this.carnetSequenceService.getCarnetSequence(body)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,42 +1,42 @@
|
|||||||
import { ApiProperty } from "@nestjs/swagger";
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
import { Transform } from "class-transformer";
|
import { Transform } from 'class-transformer';
|
||||||
import { IsDefined, IsInt, IsNumber, IsString, Min } from "class-validator";
|
import { IsDefined, IsInt, IsNumber, IsString, Min } from 'class-validator';
|
||||||
|
|
||||||
export class CreateCarnetSequenceDTO {
|
export class CreateCarnetSequenceDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||||
@IsDefined({ message: "Property p_spid is required" })
|
@IsDefined({ message: 'Property p_spid is required' })
|
||||||
p_spid: number;
|
p_spid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber({}, { message: "Property p_regionid must be a number" })
|
@IsNumber({}, { message: 'Property p_regionid must be a number' })
|
||||||
@IsDefined({ message: "Property p_regionid is required" })
|
@IsDefined({ message: 'Property p_regionid is required' })
|
||||||
p_regionid: number;
|
p_regionid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber({}, { message: "Property p_startnumber must be a number" })
|
@IsNumber({}, { message: 'Property p_startnumber must be a number' })
|
||||||
@IsDefined({ message: "Property p_startnumber is required" })
|
@IsDefined({ message: 'Property p_startnumber is required' })
|
||||||
@Min(0, { message: "Property p_startnumber must be at least 0" })
|
@Min(0, { message: 'Property p_startnumber must be at least 0' })
|
||||||
p_startnumber: number;
|
p_startnumber: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber({}, { message: "Property p_endnumber must be a number" })
|
@IsNumber({}, { message: 'Property p_endnumber must be a number' })
|
||||||
@IsDefined({ message: "Property p_endnumber is required" })
|
@IsDefined({ message: 'Property p_endnumber is required' })
|
||||||
@Min(0, { message: "Property p_endnumber must be at least 0" })
|
@Min(0, { message: 'Property p_endnumber must be at least 0' })
|
||||||
p_endnumber: number;
|
p_endnumber: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_carnettype must be a string" })
|
@IsString({ message: 'Property p_carnettype must be a string' })
|
||||||
@IsDefined({ message: "Property p_carnettype is required" })
|
@IsDefined({ message: 'Property p_carnettype is required' })
|
||||||
p_carnettype: string;
|
p_carnettype: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetCarnetSequenceDTO{
|
export class GetCarnetSequenceDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Min(0, { message: "Property p_spid must be at least 0" })
|
@Min(0, { message: 'Property p_spid must be at least 0' })
|
||||||
@IsInt({ message: "Property p_SPid must be a whole number" })
|
@IsInt({ message: 'Property p_SPid must be a whole number' })
|
||||||
@Transform(({ value }) => Number(value))
|
@Transform(({ value }) => Number(value))
|
||||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||||
@IsDefined({ message: "Property p_spid is required" })
|
@IsDefined({ message: 'Property p_spid is required' })
|
||||||
p_spid:number;
|
p_spid: number;
|
||||||
}
|
}
|
||||||
@ -4,6 +4,6 @@ import { CarnetSequenceService } from './carnet-sequence.service';
|
|||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
controllers: [CarnetSequenceController],
|
controllers: [CarnetSequenceController],
|
||||||
providers: [CarnetSequenceService]
|
providers: [CarnetSequenceService],
|
||||||
})
|
})
|
||||||
export class CarnetSequenceModule {}
|
export class CarnetSequenceModule {}
|
||||||
|
|||||||
@ -1,23 +1,25 @@
|
|||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import * as oracledb from 'oracledb';
|
import * as oracledb from 'oracledb';
|
||||||
import { OracleDBService } from 'src/db/db.service';
|
import { OracleDBService } from 'src/db/db.service';
|
||||||
import { CreateCarnetSequenceDTO, GetCarnetSequenceDTO } from './carnet-sequence.dto';
|
import {
|
||||||
|
CreateCarnetSequenceDTO,
|
||||||
|
GetCarnetSequenceDTO,
|
||||||
|
} from './carnet-sequence.dto';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class CarnetSequenceService {
|
export class CarnetSequenceService {
|
||||||
|
constructor(private readonly oracleDBService: OracleDBService) {}
|
||||||
|
|
||||||
constructor(private readonly oracleDBService:OracleDBService){}
|
async createCarnetSequence(body: CreateCarnetSequenceDTO) {
|
||||||
|
let connection;
|
||||||
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
|
if (!connection) {
|
||||||
|
throw new Error('No DB Connected');
|
||||||
|
}
|
||||||
|
|
||||||
async createCarnetSequence(body:CreateCarnetSequenceDTO) {
|
const result = await connection.execute(
|
||||||
let connection;
|
`BEGIN
|
||||||
try {
|
|
||||||
connection = await this.oracleDBService.getConnection()
|
|
||||||
if (!connection) {
|
|
||||||
throw new Error('No DB Connected')
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = await connection.execute(
|
|
||||||
`BEGIN
|
|
||||||
USCIB_Managed_Pkg.CreateCarnetSequence(
|
USCIB_Managed_Pkg.CreateCarnetSequence(
|
||||||
:p_spid,
|
:p_spid,
|
||||||
:p_regionid,
|
:p_regionid,
|
||||||
@ -25,99 +27,104 @@ export class CarnetSequenceService {
|
|||||||
:p_endnumber,
|
:p_endnumber,
|
||||||
:p_carnettype,
|
:p_carnettype,
|
||||||
:p_cursor);
|
:p_cursor);
|
||||||
END;`, {
|
END;`,
|
||||||
p_spid: {
|
{
|
||||||
val: body.p_spid,
|
p_spid: {
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
val: body.p_spid,
|
||||||
},
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
p_regionid: {
|
},
|
||||||
val: body.p_regionid,
|
p_regionid: {
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
val: body.p_regionid,
|
||||||
},
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
p_startnumber: {
|
},
|
||||||
val: body.p_startnumber,
|
p_startnumber: {
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
val: body.p_startnumber,
|
||||||
},
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
p_endnumber: {
|
},
|
||||||
val: body.p_endnumber,
|
p_endnumber: {
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
val: body.p_endnumber,
|
||||||
},
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
p_carnettype: {
|
},
|
||||||
val: body.p_carnettype,
|
p_carnettype: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_carnettype,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_cursor: {
|
},
|
||||||
type: oracledb.CURSOR,
|
p_cursor: {
|
||||||
dir: oracledb.BIND_OUT
|
type: oracledb.CURSOR,
|
||||||
}
|
dir: oracledb.BIND_OUT,
|
||||||
}, {
|
},
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
},
|
||||||
}
|
{
|
||||||
);
|
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
await connection.commit();
|
await connection.commit();
|
||||||
|
|
||||||
let fres = await result.outBinds.p_cursor.getRows();
|
const fres = await result.outBinds.p_cursor.getRows();
|
||||||
|
|
||||||
await result.outBinds.p_cursor.close()
|
await result.outBinds.p_cursor.close();
|
||||||
|
|
||||||
return fres
|
return fres;
|
||||||
|
} catch (err) {
|
||||||
} catch (err) {
|
if (err instanceof Error) {
|
||||||
|
return { error: err.message };
|
||||||
return { error: err.message }
|
} else {
|
||||||
} finally { }
|
return { error: 'An unknown error occurred' };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async getCarnetSequence(body: GetCarnetSequenceDTO) {
|
async getCarnetSequence(body: GetCarnetSequenceDTO) {
|
||||||
let connection;
|
let connection;
|
||||||
let rows = [];
|
let rows = [];
|
||||||
try {
|
try {
|
||||||
// Connect to the Oracle database using oracledb
|
// Connect to the Oracle database using oracledb
|
||||||
connection = await this.oracleDBService.getConnection()
|
connection = await this.oracleDBService.getConnection();
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected');
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
`BEGIN
|
`BEGIN
|
||||||
USCIB_Managed_Pkg.GetCarnetSequence(:p_spid,:p_cursor);
|
USCIB_Managed_Pkg.GetCarnetSequence(:p_spid,:p_cursor);
|
||||||
END;`,
|
END;`,
|
||||||
{
|
{
|
||||||
p_spid: {
|
p_spid: {
|
||||||
val: body.p_spid,
|
val: body.p_spid,
|
||||||
type: oracledb.DB_TYPE_NUMBER,
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
p_cursor: {
|
p_cursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result.outBinds && result.outBinds.p_cursor) {
|
if (result.outBinds && result.outBinds.p_cursor) {
|
||||||
const cursor = result.outBinds.p_cursor;
|
const cursor = result.outBinds.p_cursor;
|
||||||
let rowsBatch;
|
let rowsBatch;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
rowsBatch = await cursor.getRows(100); // Fetch 100 rows at a time
|
rowsBatch = await cursor.getRows(100); // Fetch 100 rows at a time
|
||||||
rows = rows.concat(rowsBatch);
|
rows = rows.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
await cursor.close();
|
||||||
|
} else {
|
||||||
|
throw new Error('No cursor returned from the stored procedure');
|
||||||
|
}
|
||||||
|
|
||||||
await cursor.close();
|
return rows;
|
||||||
} else {
|
} catch (err) {
|
||||||
throw new Error('No cursor returned from the stored procedure');
|
if (err instanceof Error) {
|
||||||
}
|
return { error: err.message };
|
||||||
|
} else {
|
||||||
return rows;
|
return { error: 'An unknown error occurred' };
|
||||||
|
}
|
||||||
} catch (err) {
|
|
||||||
|
|
||||||
return { error: err.message }
|
|
||||||
} finally { }
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,38 +1,29 @@
|
|||||||
import { RegionService } from './region.service';
|
import { RegionService } from './region.service';
|
||||||
|
|
||||||
import {
|
import { Get, Post, Body, Controller, Patch } from '@nestjs/common';
|
||||||
Get,
|
|
||||||
Post,
|
|
||||||
Body,
|
|
||||||
Controller,
|
|
||||||
Patch,
|
|
||||||
} from '@nestjs/common';
|
|
||||||
|
|
||||||
import { ApiTags } from '@nestjs/swagger';
|
import { ApiTags } from '@nestjs/swagger';
|
||||||
import { InsertRegionsDto, UpdateRegionDto } from './region.dto';
|
import { InsertRegionsDto, UpdateRegionDto } from './region.dto';
|
||||||
|
|
||||||
@Controller('oracle')
|
@Controller('oracle')
|
||||||
export class RegionController {
|
export class RegionController {
|
||||||
|
constructor(private readonly regionService: RegionService) {}
|
||||||
|
|
||||||
constructor(
|
@ApiTags('Regions - Oracle')
|
||||||
private readonly regionService: RegionService
|
@Post('/InsertRegions')
|
||||||
) { }
|
insertRegions(@Body() body: InsertRegionsDto) {
|
||||||
|
return this.regionService.insertRegions(body);
|
||||||
|
}
|
||||||
|
|
||||||
@ApiTags('Regions - Oracle')
|
@ApiTags('Regions - Oracle')
|
||||||
@Post('/InsertRegions')
|
@Patch('/UpdateRegion')
|
||||||
insertRegions(@Body() body: InsertRegionsDto) {
|
updateRegions(@Body() body: UpdateRegionDto) {
|
||||||
return this.regionService.insertRegions(body);
|
return this.regionService.updateRegions(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Regions - Oracle')
|
@ApiTags('Regions - Oracle')
|
||||||
@Patch('/UpdateRegion')
|
@Get('/GetRegions')
|
||||||
updateRegions(@Body() body: UpdateRegionDto) {
|
getRegions() {
|
||||||
return this.regionService.updateRegions(body);
|
return this.regionService.getRegions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('Regions - Oracle')
|
|
||||||
@Get('/GetRegions')
|
|
||||||
getRegions() {
|
|
||||||
return this.regionService.getRegions();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,26 +1,26 @@
|
|||||||
import { IsDefined, IsNumber,IsString } from "class-validator";
|
import { IsDefined, IsNumber, IsString } from 'class-validator';
|
||||||
import { ApiProperty } from "@nestjs/swagger";
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
|
|
||||||
export class InsertRegionsDto {
|
export class InsertRegionsDto {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_region must be a string" })
|
@IsString({ message: 'Property p_region must be a string' })
|
||||||
@IsDefined({ message: "Property p_region is required" })
|
@IsDefined({ message: 'Property p_region is required' })
|
||||||
p_region: string;
|
p_region: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_name must be a string" })
|
@IsString({ message: 'Property p_name must be a string' })
|
||||||
@IsDefined({ message: "Property p_name is required" })
|
@IsDefined({ message: 'Property p_name is required' })
|
||||||
p_name: string;
|
p_name: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class UpdateRegionDto {
|
export class UpdateRegionDto {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber({}, { message: "Property p_regionID must be a number" })
|
@IsNumber({}, { message: 'Property p_regionID must be a number' })
|
||||||
@IsDefined({ message: "Property p_regionID is required" })
|
@IsDefined({ message: 'Property p_regionID is required' })
|
||||||
p_regionID: number;
|
p_regionID: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_name must be a string" })
|
@IsString({ message: 'Property p_name must be a string' })
|
||||||
@IsDefined({ message: "Property p_name is required" })
|
@IsDefined({ message: 'Property p_name is required' })
|
||||||
p_name: string;
|
p_name: string;
|
||||||
}
|
}
|
||||||
@ -4,6 +4,6 @@ import { RegionService } from './region.service';
|
|||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
controllers: [RegionController],
|
controllers: [RegionController],
|
||||||
providers: [RegionService]
|
providers: [RegionService],
|
||||||
})
|
})
|
||||||
export class RegionModule {}
|
export class RegionModule {}
|
||||||
|
|||||||
@ -1,142 +1,148 @@
|
|||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { OracleDBService } from 'src/db/db.service';
|
import { OracleDBService } from 'src/db/db.service';
|
||||||
import * as oracledb from 'oracledb'
|
import * as oracledb from 'oracledb';
|
||||||
import { InsertRegionsDto, UpdateRegionDto } from './region.dto';
|
import { InsertRegionsDto, UpdateRegionDto } from './region.dto';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class RegionService {
|
export class RegionService {
|
||||||
|
constructor(private readonly oracleDBService: OracleDBService) {}
|
||||||
|
|
||||||
constructor(private readonly oracleDBService: OracleDBService) { }
|
async insertRegions(body: InsertRegionsDto) {
|
||||||
|
let connection;
|
||||||
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
|
if (!connection) {
|
||||||
|
throw new Error('No DB Connected');
|
||||||
|
}
|
||||||
|
|
||||||
async insertRegions(body: InsertRegionsDto) {
|
const result = await connection.execute(
|
||||||
let connection;
|
`BEGIN
|
||||||
try {
|
|
||||||
|
|
||||||
connection = await this.oracleDBService.getConnection()
|
|
||||||
if (!connection) {
|
|
||||||
throw new Error('No DB Connected')
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = await connection.execute(
|
|
||||||
`BEGIN
|
|
||||||
USCIB_Managed_Pkg.InsertNewRegion(:p_region,:p_name,:p_cursor);
|
USCIB_Managed_Pkg.InsertNewRegion(:p_region,:p_name,:p_cursor);
|
||||||
END;`, {
|
END;`,
|
||||||
p_region: {
|
{
|
||||||
val: body.p_region,
|
p_region: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_region,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_name: {
|
},
|
||||||
val: body.p_name,
|
p_name: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_name,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_cursor: {
|
},
|
||||||
type: oracledb.CURSOR,
|
p_cursor: {
|
||||||
dir: oracledb.BIND_OUT
|
type: oracledb.CURSOR,
|
||||||
}
|
dir: oracledb.BIND_OUT,
|
||||||
}, {
|
},
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
},
|
||||||
}
|
{
|
||||||
);
|
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
await connection.commit();
|
await connection.commit();
|
||||||
|
|
||||||
let fres = await result.outBinds.p_cursor.getRows();
|
const fres = await result.outBinds.p_cursor.getRows();
|
||||||
|
|
||||||
return fres
|
return fres;
|
||||||
|
} catch (err) {
|
||||||
} catch (err) {
|
if (err instanceof Error) {
|
||||||
|
return { error: err.message };
|
||||||
return { error: err.message }
|
} else {
|
||||||
} finally { }
|
return { error: 'An unknown error occurred' };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async updateRegions(body: UpdateRegionDto) {
|
async updateRegions(body: UpdateRegionDto) {
|
||||||
let connection;
|
let connection;
|
||||||
try {
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
|
if (!connection) {
|
||||||
|
throw new Error('No DB Connected');
|
||||||
|
}
|
||||||
|
|
||||||
connection = await this.oracleDBService.getConnection()
|
const result = await connection.execute(
|
||||||
if (!connection) {
|
`BEGIN
|
||||||
throw new Error('No DB Connected')
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = await connection.execute(
|
|
||||||
`BEGIN
|
|
||||||
USCIB_Managed_Pkg.UpdateRegion(:p_regionID,:p_name,:p_cursor);
|
USCIB_Managed_Pkg.UpdateRegion(:p_regionID,:p_name,:p_cursor);
|
||||||
END;`, {
|
END;`,
|
||||||
p_regionID: {
|
{
|
||||||
val: body.p_regionID,
|
p_regionID: {
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
val: body.p_regionID,
|
||||||
},
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
p_name: {
|
},
|
||||||
val: body.p_name,
|
p_name: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_name,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_cursor: {
|
},
|
||||||
type: oracledb.CURSOR,
|
p_cursor: {
|
||||||
dir: oracledb.BIND_OUT
|
type: oracledb.CURSOR,
|
||||||
}
|
dir: oracledb.BIND_OUT,
|
||||||
}, {
|
},
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
},
|
||||||
}
|
{
|
||||||
);
|
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
await connection.commit();
|
await connection.commit();
|
||||||
|
|
||||||
let fres = await result.outBinds.p_cursor.getRows();
|
const fres = await result.outBinds.p_cursor.getRows();
|
||||||
|
|
||||||
return fres
|
return fres;
|
||||||
|
} catch (err) {
|
||||||
} catch (err) {
|
if (err instanceof Error) {
|
||||||
|
return { error: err.message };
|
||||||
return { error: err.message }
|
} else {
|
||||||
} finally { }
|
return { error: 'An unknown error occurred' };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async getRegions() {
|
async getRegions() {
|
||||||
let connection;
|
let connection;
|
||||||
let rows = [];
|
let rows = [];
|
||||||
try {
|
try {
|
||||||
try {
|
try {
|
||||||
connection = await this.oracleDBService.getConnection()
|
connection = await this.oracleDBService.getConnection();
|
||||||
}
|
} catch (err) {
|
||||||
catch (err) {
|
console.log('DB ERROR: ', err);
|
||||||
console.log("DB ERROR: ", err);
|
return { error: 'Error while connecting to DB' };
|
||||||
return { error: "Error while connecting to DB" }
|
}
|
||||||
}
|
const result = await connection.execute(
|
||||||
const result = await connection.execute(
|
`BEGIN
|
||||||
`BEGIN
|
|
||||||
USCIB_Managed_Pkg.GetRegions(:p_cursor);
|
USCIB_Managed_Pkg.GetRegions(:p_cursor);
|
||||||
END;`,
|
END;`,
|
||||||
{
|
{
|
||||||
p_cursor: {
|
p_cursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result.outBinds && result.outBinds.p_cursor) {
|
if (result.outBinds && result.outBinds.p_cursor) {
|
||||||
const cursor = result.outBinds.p_cursor;
|
const cursor = result.outBinds.p_cursor;
|
||||||
let rowsBatch;
|
let rowsBatch;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
rowsBatch = await cursor.getRows(100);
|
rowsBatch = await cursor.getRows(100);
|
||||||
rows = rows.concat(rowsBatch);
|
rows = rows.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
await cursor.close();
|
await cursor.close();
|
||||||
} else {
|
} else {
|
||||||
throw new Error('No cursor returned from the stored procedure');
|
throw new Error('No cursor returned from the stored procedure');
|
||||||
}
|
}
|
||||||
|
|
||||||
return rows;
|
return rows;
|
||||||
|
} catch (err) {
|
||||||
} catch (err) {
|
if (err instanceof Error) {
|
||||||
|
return { error: err.message };
|
||||||
return { error: err.message }
|
} else {
|
||||||
} finally { }
|
return { error: 'An unknown error occurred' };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,47 +1,50 @@
|
|||||||
import { SpContactsService } from './sp-contacts.service';
|
import { SpContactsService } from './sp-contacts.service';
|
||||||
import { Body, Controller, Get, Param, ParseIntPipe, Post, Put, Query } from '@nestjs/common';
|
import { Body, Controller, Get, Post, Put, Query } from '@nestjs/common';
|
||||||
import { getSPDefaultcontactDTO, inactivateSPContactDTO, InsertSPContactsDTO, setSPDefaultcontactDTO, UpdateSPContactsDTO } from './sp-contacts.dto';
|
import {
|
||||||
|
getSPDefaultcontactDTO,
|
||||||
|
inactivateSPContactDTO,
|
||||||
|
InsertSPContactsDTO,
|
||||||
|
setSPDefaultcontactDTO,
|
||||||
|
UpdateSPContactsDTO,
|
||||||
|
} from './sp-contacts.dto';
|
||||||
import { ApiTags } from '@nestjs/swagger';
|
import { ApiTags } from '@nestjs/swagger';
|
||||||
|
|
||||||
@Controller('oracle')
|
@Controller('oracle')
|
||||||
export class SpContactsController {
|
export class SpContactsController {
|
||||||
|
constructor(private readonly spContactsService: SpContactsService) {}
|
||||||
|
|
||||||
constructor(
|
@ApiTags('SPContacts - Oracle')
|
||||||
private readonly spContactsService: SpContactsService,
|
@Post('/InsertSPContacts')
|
||||||
) { }
|
insertSPContacts(@Body() body: InsertSPContactsDTO) {
|
||||||
|
return this.spContactsService.insertSPContacts(body);
|
||||||
|
}
|
||||||
|
|
||||||
@ApiTags('SPContacts - Oracle')
|
@ApiTags('SPContacts - Oracle')
|
||||||
@Post('/InsertSPContacts')
|
@Post('/SetSPDefaultcontact')
|
||||||
insertSPContacts(@Body() body: InsertSPContactsDTO) {
|
setSPDefaultcontact(@Query() body: setSPDefaultcontactDTO) {
|
||||||
return this.spContactsService.insertSPContacts(body)
|
return this.spContactsService.setSPDefaultcontact(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('SPContacts - Oracle')
|
@ApiTags('SPContacts - Oracle')
|
||||||
@Post('/SetSPDefaultcontact')
|
@Put('/UpdateSPContacts')
|
||||||
setSPDefaultcontact(@Query() body:setSPDefaultcontactDTO) {
|
updateSPContacts(@Body() body: UpdateSPContactsDTO) {
|
||||||
return this.spContactsService.setSPDefaultcontact(body)
|
return this.spContactsService.updateSPContacts(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('SPContacts - Oracle')
|
@ApiTags('SPContacts - Oracle')
|
||||||
@Put('/UpdateSPContacts')
|
@Post('/InactivateSPContact')
|
||||||
updateSPContacts(@Body() body: UpdateSPContactsDTO) {
|
inactivateSPContact(@Query() body: inactivateSPContactDTO) {
|
||||||
return this.spContactsService.updateSPContacts(body)
|
return this.spContactsService.inactivateSPContact(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('SPContacts - Oracle')
|
@ApiTags('SPContacts - Oracle')
|
||||||
@Post('/InactivateSPContact')
|
@Get('/GetSPDefaultcontact')
|
||||||
inactivateSPContact(@Query() body:inactivateSPContactDTO) {
|
getSPDefaultcontact(@Query() body: getSPDefaultcontactDTO) {
|
||||||
return this.spContactsService.inactivateSPContact(body)
|
return this.spContactsService.getSPDefaultcontacts(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('SPContacts - Oracle')
|
// @Get('/GetAllSPcontacts')
|
||||||
@Get('/GetSPDefaultcontact')
|
// getSPcontacts() {
|
||||||
getSPDefaultcontact(@Query() body:getSPDefaultcontactDTO) {
|
// return this.oarcleService.getSPcontacts();
|
||||||
return this.spContactsService.getSPDefaultcontacts(body)
|
// }
|
||||||
}
|
|
||||||
|
|
||||||
// @Get('/GetAllSPcontacts')
|
|
||||||
// getSPcontacts() {
|
|
||||||
// return this.oarcleService.getSPcontacts();
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,112 +1,119 @@
|
|||||||
import { ApiProperty } from '@nestjs/swagger';
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
import { Transform } from 'class-transformer';
|
import { Transform } from 'class-transformer';
|
||||||
import { IsDefined, IsEmail, IsInt, IsNumber, IsString, Min } from 'class-validator';
|
import {
|
||||||
|
IsDefined,
|
||||||
|
IsEmail,
|
||||||
|
IsInt,
|
||||||
|
IsNumber,
|
||||||
|
IsString,
|
||||||
|
Min,
|
||||||
|
} from 'class-validator';
|
||||||
|
|
||||||
export class InsertSPContactsDTO {
|
export class InsertSPContactsDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
p_spid: number;
|
p_spid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
p_defcontactflag: string;
|
p_defcontactflag: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
p_firstname: string;
|
p_firstname: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
p_lastname: string;
|
p_lastname: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_MIDDLEINITIAL: string;
|
P_MIDDLEINITIAL: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
p_title: string;
|
p_title: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
p_phoneno: string;
|
p_phoneno: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
p_mobileno: string;
|
p_mobileno: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
p_faxno: string;
|
p_faxno: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsEmail()
|
@IsEmail()
|
||||||
p_emailaddress: string;
|
p_emailaddress: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
p_user_id: string;
|
p_user_id: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class UpdateSPContactsDTO {
|
export class UpdateSPContactsDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
p_spcontactid: number;
|
p_spcontactid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
p_firstname: string;
|
p_firstname: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
p_lastname: string;
|
p_lastname: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@IsString()
|
@IsString()
|
||||||
P_MIDDLEINITIAL: string;
|
P_MIDDLEINITIAL: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
p_title: string;
|
p_title: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
p_phoneno: string;
|
p_phoneno: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
p_mobileno: string;
|
p_mobileno: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
p_faxno: string;
|
p_faxno: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsEmail()
|
@IsEmail()
|
||||||
p_emailaddress: string;
|
p_emailaddress: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
p_user_id: string;
|
p_user_id: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class setSPDefaultcontactDTO{
|
export class setSPDefaultcontactDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Min(0, { message: "Property p_spcontactid must be at least 0" })
|
@Min(0, { message: 'Property p_spcontactid must be at least 0' })
|
||||||
@IsInt({ message: "Property p_SPid must be a whole number" })
|
@IsInt({ message: 'Property p_SPid must be a whole number' })
|
||||||
@Transform(({ value }) => Number(value))
|
@Transform(({ value }) => Number(value))
|
||||||
@IsNumber({}, { message: "Property p_spcontactid must be a number" })
|
@IsNumber({}, { message: 'Property p_spcontactid must be a number' })
|
||||||
@IsDefined({ message: "Property p_spcontactid is required" })
|
@IsDefined({ message: 'Property p_spcontactid is required' })
|
||||||
p_spcontactid:number;
|
p_spcontactid: number;
|
||||||
}
|
}
|
||||||
export class inactivateSPContactDTO extends setSPDefaultcontactDTO{}
|
export class inactivateSPContactDTO extends setSPDefaultcontactDTO {}
|
||||||
|
|
||||||
export class getSPDefaultcontactDTO {
|
export class getSPDefaultcontactDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Min(0, { message: "Property p_SPid must be at least 0" })
|
@Min(0, { message: 'Property p_SPid must be at least 0' })
|
||||||
@IsInt({ message: "Property p_SPid must be a whole number" })
|
@IsInt({ message: 'Property p_SPid must be a whole number' })
|
||||||
@Transform(({ value }) => Number(value))
|
@Transform(({ value }) => Number(value))
|
||||||
@IsNumber({}, { message: "Property p_SPid must be a number" })
|
@IsNumber({}, { message: 'Property p_SPid must be a number' })
|
||||||
@IsDefined({ message: "Property p_SPid is required" })
|
@IsDefined({ message: 'Property p_SPid is required' })
|
||||||
p_SPid:number;
|
p_SPid: number;
|
||||||
}
|
}
|
||||||
@ -4,8 +4,8 @@ import { SpContactsController } from './sp-contacts.controller';
|
|||||||
import { DbModule } from 'src/db/db.module';
|
import { DbModule } from 'src/db/db.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports:[DbModule],
|
imports: [DbModule],
|
||||||
providers: [SpContactsService],
|
providers: [SpContactsService],
|
||||||
controllers: [SpContactsController]
|
controllers: [SpContactsController],
|
||||||
})
|
})
|
||||||
export class SpContactsModule {}
|
export class SpContactsModule {}
|
||||||
|
|||||||
@ -1,30 +1,28 @@
|
|||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { OracleDBService } from 'src/db/db.service';
|
import { OracleDBService } from 'src/db/db.service';
|
||||||
import * as oracledb from 'oracledb'
|
import * as oracledb from 'oracledb';
|
||||||
import {
|
import {
|
||||||
getSPDefaultcontactDTO,
|
getSPDefaultcontactDTO,
|
||||||
inactivateSPContactDTO,
|
inactivateSPContactDTO,
|
||||||
InsertSPContactsDTO,
|
InsertSPContactsDTO,
|
||||||
setSPDefaultcontactDTO,
|
setSPDefaultcontactDTO,
|
||||||
UpdateSPContactsDTO
|
UpdateSPContactsDTO,
|
||||||
} from './sp-contacts.dto';
|
} from './sp-contacts.dto';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class SpContactsService {
|
export class SpContactsService {
|
||||||
|
constructor(private readonly oracleDBService: OracleDBService) {}
|
||||||
|
|
||||||
constructor(private readonly oracleDBService: OracleDBService) { }
|
async insertSPContacts(body: InsertSPContactsDTO) {
|
||||||
|
let connection;
|
||||||
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
|
if (!connection) {
|
||||||
|
throw new Error('No DB Connected');
|
||||||
|
}
|
||||||
|
|
||||||
async insertSPContacts(body: InsertSPContactsDTO) {
|
const result = await connection.execute(
|
||||||
let connection;
|
`BEGIN
|
||||||
try {
|
|
||||||
|
|
||||||
connection = await this.oracleDBService.getConnection()
|
|
||||||
if (!connection) {
|
|
||||||
throw new Error('No DB Connected')
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = await connection.execute(
|
|
||||||
`BEGIN
|
|
||||||
USCIB_Managed_Pkg.InsertSPContacts(
|
USCIB_Managed_Pkg.InsertSPContacts(
|
||||||
:p_spid,
|
:p_spid,
|
||||||
:p_defcontactflag,
|
:p_defcontactflag,
|
||||||
@ -38,116 +36,118 @@ export class SpContactsService {
|
|||||||
:p_emailaddress,
|
:p_emailaddress,
|
||||||
:p_user_id,
|
:p_user_id,
|
||||||
:p_cursor);
|
:p_cursor);
|
||||||
END;`, {
|
END;`,
|
||||||
p_spid: {
|
{
|
||||||
val: body.p_spid,
|
p_spid: {
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
val: body.p_spid,
|
||||||
},
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
p_defcontactflag: {
|
},
|
||||||
val: body.p_defcontactflag,
|
p_defcontactflag: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_defcontactflag,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_firstname: {
|
},
|
||||||
val: body.p_firstname,
|
p_firstname: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_firstname,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_lastname: {
|
},
|
||||||
val: body.p_lastname,
|
p_lastname: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_lastname,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
P_MIDDLEINITIAL: {
|
},
|
||||||
val: body.P_MIDDLEINITIAL,
|
P_MIDDLEINITIAL: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.P_MIDDLEINITIAL,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_title: {
|
},
|
||||||
val: body.p_title,
|
p_title: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_title,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_phoneno: {
|
},
|
||||||
val: body.p_phoneno,
|
p_phoneno: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_phoneno,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_mobileno: {
|
},
|
||||||
val: body.p_mobileno,
|
p_mobileno: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_mobileno,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_faxno: {
|
},
|
||||||
val: body.p_faxno,
|
p_faxno: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_faxno,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_emailaddress: {
|
},
|
||||||
val: body.p_emailaddress,
|
p_emailaddress: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_emailaddress,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_user_id: {
|
},
|
||||||
val: body.p_user_id,
|
p_user_id: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_user_id,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_cursor: {
|
},
|
||||||
type: oracledb.CURSOR,
|
p_cursor: {
|
||||||
dir: oracledb.BIND_OUT
|
type: oracledb.CURSOR,
|
||||||
}
|
dir: oracledb.BIND_OUT,
|
||||||
}, {
|
},
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
},
|
||||||
}
|
{
|
||||||
);
|
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
await connection.commit();
|
await connection.commit();
|
||||||
|
|
||||||
let fres = await result.outBinds.p_cursor.getRows();
|
const fres = await result.outBinds.p_cursor.getRows();
|
||||||
|
|
||||||
return fres
|
return fres;
|
||||||
|
} catch (err) {
|
||||||
} catch (err) {
|
if (err instanceof Error) {
|
||||||
|
return { error: err.message };
|
||||||
return { error: err.message }
|
} else {
|
||||||
} finally { }
|
return { error: 'An unknown error occurred' };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async setSPDefaultcontact(body: setSPDefaultcontactDTO) {
|
async setSPDefaultcontact(body: setSPDefaultcontactDTO) {
|
||||||
|
let connection;
|
||||||
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
|
if (!connection) {
|
||||||
|
throw new Error('No DB Connected');
|
||||||
|
}
|
||||||
|
|
||||||
let connection;
|
const result = await connection.execute(
|
||||||
try {
|
`BEGIN
|
||||||
|
|
||||||
connection = await this.oracleDBService.getConnection()
|
|
||||||
if (!connection) {
|
|
||||||
throw new Error('No DB Connected')
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = await connection.execute(
|
|
||||||
`BEGIN
|
|
||||||
USCIB_Managed_Pkg.SetDefaultContact(:p_spcontactid);
|
USCIB_Managed_Pkg.SetDefaultContact(:p_spcontactid);
|
||||||
END;`,
|
END;`,
|
||||||
{
|
{
|
||||||
p_spcontactid: {
|
p_spcontactid: {
|
||||||
val: body.p_spcontactid,
|
val: body.p_spcontactid,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
await connection.commit();
|
await connection.commit();
|
||||||
|
|
||||||
return "SP executed successfully"
|
|
||||||
|
|
||||||
} catch (err) {
|
|
||||||
|
|
||||||
return { error: err.message }
|
|
||||||
} finally { }
|
|
||||||
|
|
||||||
|
return 'SP executed successfully';
|
||||||
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
|
return { error: err.message };
|
||||||
|
} else {
|
||||||
|
return { error: 'An unknown error occurred' };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async updateSPContacts(body: UpdateSPContactsDTO) {
|
async updateSPContacts(body: UpdateSPContactsDTO) {
|
||||||
let connection;
|
let connection;
|
||||||
try {
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
|
if (!connection) {
|
||||||
|
throw new Error('No DB Connected');
|
||||||
|
}
|
||||||
|
|
||||||
connection = await this.oracleDBService.getConnection()
|
const result = await connection.execute(
|
||||||
if (!connection) {
|
`BEGIN
|
||||||
throw new Error('No DB Connected')
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = await connection.execute(
|
|
||||||
`BEGIN
|
|
||||||
USCIB_Managed_Pkg.UpdateSPContacts(
|
USCIB_Managed_Pkg.UpdateSPContacts(
|
||||||
:p_spcontactid,
|
:p_spcontactid,
|
||||||
:p_firstname,
|
:p_firstname,
|
||||||
@ -160,201 +160,201 @@ export class SpContactsService {
|
|||||||
:p_emailaddress,
|
:p_emailaddress,
|
||||||
:p_user_id,
|
:p_user_id,
|
||||||
:p_cursor);
|
:p_cursor);
|
||||||
END;`, {
|
END;`,
|
||||||
p_spcontactid: {
|
{
|
||||||
val: body.p_spcontactid,
|
p_spcontactid: {
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
val: body.p_spcontactid,
|
||||||
},
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
p_firstname: {
|
},
|
||||||
val: body.p_firstname,
|
p_firstname: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_firstname,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_lastname: {
|
},
|
||||||
val: body.p_lastname,
|
p_lastname: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_lastname,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
P_MIDDLEINITIAL: {
|
},
|
||||||
val: body.P_MIDDLEINITIAL,
|
P_MIDDLEINITIAL: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.P_MIDDLEINITIAL,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_title: {
|
},
|
||||||
val: body.p_title,
|
p_title: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_title,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_phoneno: {
|
},
|
||||||
val: body.p_phoneno,
|
p_phoneno: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_phoneno,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_mobileno: {
|
},
|
||||||
val: body.p_mobileno,
|
p_mobileno: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_mobileno,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_faxno: {
|
},
|
||||||
val: body.p_faxno,
|
p_faxno: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_faxno,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_emailaddress: {
|
},
|
||||||
val: body.p_emailaddress,
|
p_emailaddress: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_emailaddress,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_user_id: {
|
},
|
||||||
val: body.p_user_id,
|
p_user_id: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_user_id,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_cursor: {
|
},
|
||||||
type: oracledb.CURSOR,
|
p_cursor: {
|
||||||
dir: oracledb.BIND_OUT
|
type: oracledb.CURSOR,
|
||||||
}
|
dir: oracledb.BIND_OUT,
|
||||||
}, {
|
},
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
},
|
||||||
}
|
{
|
||||||
);
|
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
await connection.commit();
|
await connection.commit();
|
||||||
|
|
||||||
let fres = await result.outBinds.p_cursor.getRows();
|
const fres = await result.outBinds.p_cursor.getRows();
|
||||||
|
|
||||||
return fres
|
return fres;
|
||||||
|
} catch (err) {
|
||||||
} catch (err) {
|
if (err instanceof Error) {
|
||||||
|
return { error: err.message };
|
||||||
return { error: err.message }
|
} else {
|
||||||
} finally { }
|
return { error: 'An unknown error occurred' };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async inactivateSPContact(body: inactivateSPContactDTO) {
|
async inactivateSPContact(body: inactivateSPContactDTO) {
|
||||||
|
let connection;
|
||||||
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
|
if (!connection) {
|
||||||
|
throw new Error('No DB Connected');
|
||||||
|
}
|
||||||
|
|
||||||
let connection;
|
const result = await connection.execute(
|
||||||
try {
|
`BEGIN
|
||||||
|
|
||||||
connection = await this.oracleDBService.getConnection()
|
|
||||||
if (!connection) {
|
|
||||||
throw new Error('No DB Connected')
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = await connection.execute(
|
|
||||||
`BEGIN
|
|
||||||
USCIB_Managed_Pkg.InActivateSPContacts(:p_spcontactid);
|
USCIB_Managed_Pkg.InActivateSPContacts(:p_spcontactid);
|
||||||
END;`, {
|
END;`,
|
||||||
p_spcontactid: {
|
{
|
||||||
val: body.p_spcontactid,
|
p_spcontactid: {
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
val: body.p_spcontactid,
|
||||||
}
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
}
|
},
|
||||||
);
|
},
|
||||||
|
);
|
||||||
|
|
||||||
await connection.commit();
|
await connection.commit();
|
||||||
|
|
||||||
return "SP executed successfully"
|
|
||||||
|
|
||||||
} catch (err) {
|
|
||||||
|
|
||||||
return { error: err.message }
|
|
||||||
} finally { }
|
|
||||||
|
|
||||||
|
return 'SP executed successfully';
|
||||||
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
|
return { error: err.message };
|
||||||
|
} else {
|
||||||
|
return { error: 'An unknown error occurred' };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async getSPDefaultcontacts(body: getSPDefaultcontactDTO) {
|
async getSPDefaultcontacts(body: getSPDefaultcontactDTO) {
|
||||||
|
let connection;
|
||||||
|
let rows = [];
|
||||||
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
|
if (!connection) {
|
||||||
|
throw new Error('No DB Connected');
|
||||||
|
}
|
||||||
|
|
||||||
let connection;
|
const result = await connection.execute(
|
||||||
let rows = [];
|
`BEGIN
|
||||||
try {
|
|
||||||
|
|
||||||
connection = await this.oracleDBService.getConnection()
|
|
||||||
if (!connection) {
|
|
||||||
throw new Error('No DB Connected')
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = await connection.execute(
|
|
||||||
`BEGIN
|
|
||||||
USCIB_Managed_Pkg.GetSPDefaultContacts(:p_SPid,:p_cursor);
|
USCIB_Managed_Pkg.GetSPDefaultContacts(:p_SPid,:p_cursor);
|
||||||
END;`,
|
END;`,
|
||||||
{
|
{
|
||||||
p_SPid: {
|
p_SPid: {
|
||||||
val: body.p_SPid,
|
val: body.p_SPid,
|
||||||
type: oracledb.DB_TYPE_NUMBER,
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
p_cursor: {
|
p_cursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result.outBinds && result.outBinds.p_cursor) {
|
if (result.outBinds && result.outBinds.p_cursor) {
|
||||||
const cursor = result.outBinds.p_cursor;
|
const cursor = result.outBinds.p_cursor;
|
||||||
let rowsBatch;
|
let rowsBatch;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
rowsBatch = await cursor.getRows(100);
|
rowsBatch = await cursor.getRows(100);
|
||||||
rows = rows.concat(rowsBatch);
|
rows = rows.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
await cursor.close();
|
||||||
|
} else {
|
||||||
|
throw new Error('No cursor returned from the stored procedure');
|
||||||
|
}
|
||||||
|
|
||||||
await cursor.close();
|
return rows;
|
||||||
} else {
|
} catch (err) {
|
||||||
throw new Error('No cursor returned from the stored procedure');
|
if (err instanceof Error) {
|
||||||
}
|
return { error: err.message };
|
||||||
|
} else {
|
||||||
return rows;
|
return { error: 'An unknown error occurred' };
|
||||||
|
}
|
||||||
} catch (err) {
|
|
||||||
|
|
||||||
return { error: err.message }
|
|
||||||
} finally { }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async getSPcontacts() {
|
async getSPcontacts() {
|
||||||
let connection;
|
let connection;
|
||||||
let rows = [];
|
let rows = [];
|
||||||
try {
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
|
if (!connection) {
|
||||||
|
throw new Error('No DB Connected');
|
||||||
|
}
|
||||||
|
|
||||||
connection = await this.oracleDBService.getConnection()
|
const result = await connection.execute(
|
||||||
if (!connection) {
|
`BEGIN
|
||||||
throw new Error('No DB Connected')
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = await connection.execute(
|
|
||||||
`BEGIN
|
|
||||||
USCIB_Managed_Pkg.GetSPAllContacts(:p_cursor);
|
USCIB_Managed_Pkg.GetSPAllContacts(:p_cursor);
|
||||||
END;`,
|
END;`,
|
||||||
{
|
{
|
||||||
p_cursor: {
|
p_cursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result.outBinds && result.outBinds.p_cursor) {
|
if (result.outBinds && result.outBinds.p_cursor) {
|
||||||
const cursor = result.outBinds.p_cursor;
|
const cursor = result.outBinds.p_cursor;
|
||||||
let rowsBatch;
|
let rowsBatch;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
rowsBatch = await cursor.getRows(100);
|
rowsBatch = await cursor.getRows(100);
|
||||||
rows = rows.concat(rowsBatch);
|
rows = rows.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
await cursor.close();
|
||||||
|
} else {
|
||||||
|
throw new Error('No cursor returned from the stored procedure');
|
||||||
|
}
|
||||||
|
|
||||||
|
return rows;
|
||||||
|
} catch (err) {
|
||||||
await cursor.close();
|
if (err instanceof Error) {
|
||||||
} else {
|
return { error: err.message };
|
||||||
throw new Error('No cursor returned from the stored procedure');
|
} else {
|
||||||
}
|
return { error: 'An unknown error occurred' };
|
||||||
|
}
|
||||||
return rows;
|
|
||||||
|
|
||||||
} catch (err) {
|
|
||||||
|
|
||||||
return { error: err.message }
|
|
||||||
} finally { }
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,36 +1,37 @@
|
|||||||
import { Body, Controller, Get, Param, ParseIntPipe, Post, Put, Query } from '@nestjs/common';
|
import { Body, Controller, Get, Post, Put, Query } from '@nestjs/common';
|
||||||
import { SpService } from './sp.service';
|
import { SpService } from './sp.service';
|
||||||
import { ApiTags } from '@nestjs/swagger';
|
import { ApiTags } from '@nestjs/swagger';
|
||||||
import { getSelectedServiceproviderDTO, InsertNewServiceProviderDTO, UpdateServiceProviderDTO } from './sp.dto';
|
import {
|
||||||
|
getSelectedServiceproviderDTO,
|
||||||
|
InsertNewServiceProviderDTO,
|
||||||
|
UpdateServiceProviderDTO,
|
||||||
|
} from './sp.dto';
|
||||||
|
|
||||||
@Controller('oracle')
|
@Controller('oracle')
|
||||||
export class SpController {
|
export class SpController {
|
||||||
|
constructor(private readonly spService: SpService) {}
|
||||||
|
|
||||||
constructor(
|
@ApiTags('SP - Oracle')
|
||||||
private readonly spService: SpService
|
@Post('/InsertNewServiceProvider')
|
||||||
) { }
|
insertNewServiceProvider(@Body() body: InsertNewServiceProviderDTO) {
|
||||||
|
return this.spService.insertNewServiceProvider(body);
|
||||||
|
}
|
||||||
|
|
||||||
@ApiTags('SP - Oracle')
|
@ApiTags('SP - Oracle')
|
||||||
@Post('/InsertNewServiceProvider')
|
@Put('/UpdateServiceProvider')
|
||||||
insertNewServiceProvider(@Body() body: InsertNewServiceProviderDTO) {
|
updateServiceProider(@Body() body: UpdateServiceProviderDTO) {
|
||||||
return this.spService.insertNewServiceProvider(body)
|
return this.spService.updateServiceProvider(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('SP - Oracle')
|
@ApiTags('SP - Oracle')
|
||||||
@Put('/UpdateServiceProvider')
|
@Get('/GetAllServiceproviders')
|
||||||
updateServiceProider(@Body() body: UpdateServiceProviderDTO) {
|
getAllServiceproviders() {
|
||||||
return this.spService.updateServiceProvider(body)
|
return this.spService.getAllServiceproviders();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('SP - Oracle')
|
@ApiTags('SP - Oracle')
|
||||||
@Get('/GetAllServiceproviders')
|
@Get('/GetSelectedServiceprovider')
|
||||||
getAllServiceproviders() {
|
getSelectedServiceprovider(@Query() body: getSelectedServiceproviderDTO) {
|
||||||
return this.spService.getAllServiceproviders();
|
return this.spService.getServiceproviderByID(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiTags('SP - Oracle')
|
|
||||||
@Get('/GetSelectedServiceprovider')
|
|
||||||
getSelectedServiceprovider(@Query() body:getSelectedServiceproviderDTO) {
|
|
||||||
return this.spService.getServiceproviderByID(body);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,183 +1,189 @@
|
|||||||
import { ApiProperty } from '@nestjs/swagger';
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
import { Transform } from 'class-transformer';
|
import { Transform } from 'class-transformer';
|
||||||
import { IsDefined, IsInt, IsNumber, IsOptional, IsString, Min } from 'class-validator';
|
import {
|
||||||
|
IsDefined,
|
||||||
|
IsInt,
|
||||||
|
IsNumber,
|
||||||
|
IsOptional,
|
||||||
|
IsString,
|
||||||
|
Min,
|
||||||
|
} from 'class-validator';
|
||||||
|
|
||||||
export class InsertNewServiceProviderDTO {
|
export class InsertNewServiceProviderDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_name must be a string" })
|
@IsString({ message: 'Property p_name must be a string' })
|
||||||
@IsDefined({ message: "Property p_name is required" })
|
@IsDefined({ message: 'Property p_name is required' })
|
||||||
p_name: string;
|
p_name: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_lookupcode must be a string" })
|
@IsString({ message: 'Property p_lookupcode must be a string' })
|
||||||
@IsDefined({ message: "Property p_lookupcode is required" })
|
@IsDefined({ message: 'Property p_lookupcode is required' })
|
||||||
p_lookupcode: string;
|
p_lookupcode: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_address1 must be a string" })
|
@IsString({ message: 'Property p_address1 must be a string' })
|
||||||
@IsDefined({ message: "Property p_address1 is required" })
|
@IsDefined({ message: 'Property p_address1 is required' })
|
||||||
p_address1: string;
|
p_address1: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@IsString({ message: "Property p_address2 must be a string" })
|
@IsString({ message: 'Property p_address2 must be a string' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_address2?: string;
|
p_address2?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_city must be a string" })
|
@IsString({ message: 'Property p_city must be a string' })
|
||||||
@IsDefined({ message: "Property p_city is required" })
|
@IsDefined({ message: 'Property p_city is required' })
|
||||||
p_city: string;
|
p_city: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_state must be a string" })
|
@IsString({ message: 'Property p_state must be a string' })
|
||||||
@IsDefined({ message: "Property p_state is required" })
|
@IsDefined({ message: 'Property p_state is required' })
|
||||||
p_state: string;
|
p_state: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_zip must be a string" })
|
@IsString({ message: 'Property p_zip must be a string' })
|
||||||
@IsDefined({ message: "Property p_zip is required" })
|
@IsDefined({ message: 'Property p_zip is required' })
|
||||||
p_zip: string;
|
p_zip: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_country must be a string" })
|
@IsString({ message: 'Property p_country must be a string' })
|
||||||
@IsDefined({ message: "Property p_country is required" })
|
@IsDefined({ message: 'Property p_country is required' })
|
||||||
p_country: string;
|
p_country: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_issuingregion must be a string" })
|
@IsString({ message: 'Property p_issuingregion must be a string' })
|
||||||
@IsDefined({ message: "Property p_issuingregion is required" })
|
@IsDefined({ message: 'Property p_issuingregion is required' })
|
||||||
p_issuingregion: string;
|
p_issuingregion: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_replacementregion must be a string" })
|
@IsString({ message: 'Property p_replacementregion must be a string' })
|
||||||
@IsDefined({ message: "Property p_replacementregion is required" })
|
@IsDefined({ message: 'Property p_replacementregion is required' })
|
||||||
p_replacementregion: string;
|
p_replacementregion: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_bondsurety must be a string" })
|
@IsString({ message: 'Property p_bondsurety must be a string' })
|
||||||
@IsDefined({ message: "Property p_bondsurety is required" })
|
@IsDefined({ message: 'Property p_bondsurety is required' })
|
||||||
p_bondsurety: string;
|
p_bondsurety: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_cargopolicyno must be a string" })
|
@IsString({ message: 'Property p_cargopolicyno must be a string' })
|
||||||
@IsDefined({ message: "Property p_cargopolicyno is required" })
|
@IsDefined({ message: 'Property p_cargopolicyno is required' })
|
||||||
p_cargopolicyno: string;
|
p_cargopolicyno: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_cargosurety must be a string" })
|
@IsString({ message: 'Property p_cargosurety must be a string' })
|
||||||
@IsDefined({ message: "Property p_cargosurety is required" })
|
@IsDefined({ message: 'Property p_cargosurety is required' })
|
||||||
p_cargosurety: string;
|
p_cargosurety: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_user_id must be a string" })
|
@IsString({ message: 'Property p_user_id must be a string' })
|
||||||
@IsDefined({ message: "Property p_user_id is required" })
|
@IsDefined({ message: 'Property p_user_id is required' })
|
||||||
p_user_id: string;
|
p_user_id: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@IsString({ message: "Property P_NOTES must be a string" })
|
@IsString({ message: 'Property P_NOTES must be a string' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
P_NOTES?: string;
|
P_NOTES?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@IsString({ message: "Property P_FILEIDS must be a string" })
|
@IsString({ message: 'Property P_FILEIDS must be a string' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
P_FILEIDS?: string;
|
P_FILEIDS?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class UpdateServiceProviderDTO {
|
export class UpdateServiceProviderDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||||
@IsDefined({ message: "Property p_spid is required" })
|
@IsDefined({ message: 'Property p_spid is required' })
|
||||||
p_spid: number;
|
p_spid: number;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_name must be a string" })
|
@IsString({ message: 'Property p_name must be a string' })
|
||||||
@IsDefined({ message: "Property p_name is required" })
|
@IsDefined({ message: 'Property p_name is required' })
|
||||||
p_name: string;
|
p_name: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_lookupcode must be a string" })
|
@IsString({ message: 'Property p_lookupcode must be a string' })
|
||||||
@IsDefined({ message: "Property p_lookupcode is required" })
|
@IsDefined({ message: 'Property p_lookupcode is required' })
|
||||||
p_lookupcode: string;
|
p_lookupcode: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_address1 must be a string" })
|
@IsString({ message: 'Property p_address1 must be a string' })
|
||||||
@IsDefined({ message: "Property p_address1 is required" })
|
@IsDefined({ message: 'Property p_address1 is required' })
|
||||||
p_address1: string;
|
p_address1: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@IsString({ message: "Property p_address2 must be a string" })
|
@IsString({ message: 'Property p_address2 must be a string' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
p_address2?: string;
|
p_address2?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_city must be a string" })
|
@IsString({ message: 'Property p_city must be a string' })
|
||||||
@IsDefined({ message: "Property p_city is required" })
|
@IsDefined({ message: 'Property p_city is required' })
|
||||||
p_city: string;
|
p_city: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_state must be a string" })
|
@IsString({ message: 'Property p_state must be a string' })
|
||||||
@IsDefined({ message: "Property p_state is required" })
|
@IsDefined({ message: 'Property p_state is required' })
|
||||||
p_state: string;
|
p_state: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_zip must be a string" })
|
@IsString({ message: 'Property p_zip must be a string' })
|
||||||
@IsDefined({ message: "Property p_zip is required" })
|
@IsDefined({ message: 'Property p_zip is required' })
|
||||||
p_zip: string;
|
p_zip: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_country must be a string" })
|
@IsString({ message: 'Property p_country must be a string' })
|
||||||
@IsDefined({ message: "Property p_country is required" })
|
@IsDefined({ message: 'Property p_country is required' })
|
||||||
p_country: string;
|
p_country: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_issuingregion must be a string" })
|
@IsString({ message: 'Property p_issuingregion must be a string' })
|
||||||
@IsDefined({ message: "Property p_issuingregion is required" })
|
@IsDefined({ message: 'Property p_issuingregion is required' })
|
||||||
p_issuingregion: string;
|
p_issuingregion: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_replacementregion must be a string" })
|
@IsString({ message: 'Property p_replacementregion must be a string' })
|
||||||
@IsDefined({ message: "Property p_replacementregion is required" })
|
@IsDefined({ message: 'Property p_replacementregion is required' })
|
||||||
p_replacementregion: string;
|
p_replacementregion: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_bondsurety must be a string" })
|
@IsString({ message: 'Property p_bondsurety must be a string' })
|
||||||
@IsDefined({ message: "Property p_bondsurety is required" })
|
@IsDefined({ message: 'Property p_bondsurety is required' })
|
||||||
p_bondsurety: string;
|
p_bondsurety: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_cargopolicyno must be a string" })
|
@IsString({ message: 'Property p_cargopolicyno must be a string' })
|
||||||
@IsDefined({ message: "Property p_cargopolicyno is required" })
|
@IsDefined({ message: 'Property p_cargopolicyno is required' })
|
||||||
p_cargopolicyno: string;
|
p_cargopolicyno: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_cargosurety must be a string" })
|
@IsString({ message: 'Property p_cargosurety must be a string' })
|
||||||
@IsDefined({ message: "Property p_cargosurety is required" })
|
@IsDefined({ message: 'Property p_cargosurety is required' })
|
||||||
p_cargosurety: string;
|
p_cargosurety: string;
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsString({ message: "Property p_user_id must be a string" })
|
@IsString({ message: 'Property p_user_id must be a string' })
|
||||||
@IsDefined({ message: "Property p_user_id is required" })
|
@IsDefined({ message: 'Property p_user_id is required' })
|
||||||
p_user_id: string;
|
p_user_id: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@IsString({ message: "Property P_NOTES must be a string" })
|
@IsString({ message: 'Property P_NOTES must be a string' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
P_NOTES?: string;
|
P_NOTES?: string;
|
||||||
|
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
@IsString({ message: "Property P_FILEIDS must be a string" })
|
@IsString({ message: 'Property P_FILEIDS must be a string' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
P_FILEIDS?: string;
|
P_FILEIDS?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class getSelectedServiceproviderDTO{
|
export class getSelectedServiceproviderDTO {
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Min(0, { message: "Property p_spid must be at least 0" })
|
@Min(0, { message: 'Property p_spid must be at least 0' })
|
||||||
@IsInt({ message: "Property p_SPid must be a whole number" })
|
@IsInt({ message: 'Property p_SPid must be a whole number' })
|
||||||
@Transform(({ value }) => Number(value))
|
@Transform(({ value }) => Number(value))
|
||||||
@IsNumber({}, { message: "Property p_spid must be a number" })
|
@IsNumber({}, { message: 'Property p_spid must be a number' })
|
||||||
@IsDefined({ message: "Property p_spid is required" })
|
@IsDefined({ message: 'Property p_spid is required' })
|
||||||
p_spid:number;
|
p_spid: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,6 @@ import { SpService } from './sp.service';
|
|||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
controllers: [SpController],
|
controllers: [SpController],
|
||||||
providers: [SpService]
|
providers: [SpService],
|
||||||
})
|
})
|
||||||
export class SpModule {}
|
export class SpModule {}
|
||||||
|
|||||||
@ -1,25 +1,26 @@
|
|||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { OracleDBService } from 'src/db/db.service';
|
import { OracleDBService } from 'src/db/db.service';
|
||||||
import * as oracledb from 'oracledb'
|
import * as oracledb from 'oracledb';
|
||||||
import { getSelectedServiceproviderDTO, InsertNewServiceProviderDTO, UpdateServiceProviderDTO } from './sp.dto';
|
import {
|
||||||
|
getSelectedServiceproviderDTO,
|
||||||
|
InsertNewServiceProviderDTO,
|
||||||
|
UpdateServiceProviderDTO,
|
||||||
|
} from './sp.dto';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class SpService {
|
export class SpService {
|
||||||
|
constructor(private readonly oracleDBService: OracleDBService) {}
|
||||||
|
|
||||||
constructor(private readonly oracleDBService: OracleDBService) { }
|
async insertNewServiceProvider(body: InsertNewServiceProviderDTO) {
|
||||||
|
let connection;
|
||||||
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
|
if (!connection) {
|
||||||
|
throw new Error('No DB Connected');
|
||||||
|
}
|
||||||
|
|
||||||
async insertNewServiceProvider(body: InsertNewServiceProviderDTO) {
|
const result = await connection.execute(
|
||||||
|
`BEGIN
|
||||||
let connection;
|
|
||||||
try {
|
|
||||||
|
|
||||||
connection = await this.oracleDBService.getConnection()
|
|
||||||
if (!connection) {
|
|
||||||
throw new Error('No DB Connected')
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = await connection.execute(
|
|
||||||
`BEGIN
|
|
||||||
USCIB_Managed_Pkg.InsertNewSP(
|
USCIB_Managed_Pkg.InsertNewSP(
|
||||||
:p_name,
|
:p_name,
|
||||||
:p_lookupcode,
|
:p_lookupcode,
|
||||||
@ -38,105 +39,106 @@ export class SpService {
|
|||||||
:P_NOTES,
|
:P_NOTES,
|
||||||
:P_FILEIDS,
|
:P_FILEIDS,
|
||||||
:p_cursor);
|
:p_cursor);
|
||||||
END;`, {
|
END;`,
|
||||||
p_name: {
|
{
|
||||||
val: body.p_name,
|
p_name: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_name,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_lookupcode: {
|
},
|
||||||
val: body.p_lookupcode,
|
p_lookupcode: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_lookupcode,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_address1: {
|
},
|
||||||
val: body.p_address1,
|
p_address1: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_address1,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_address2: {
|
},
|
||||||
val: body.p_address2,
|
p_address2: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_address2,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_city: {
|
},
|
||||||
val: body.p_city,
|
p_city: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_city,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_state: {
|
},
|
||||||
val: body.p_state,
|
p_state: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_state,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_zip: {
|
},
|
||||||
val: body.p_zip,
|
p_zip: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_zip,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_country: {
|
},
|
||||||
val: body.p_country,
|
p_country: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_country,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_issuingregion: {
|
},
|
||||||
val: body.p_issuingregion,
|
p_issuingregion: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_issuingregion,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_replacementregion: {
|
},
|
||||||
val: body.p_replacementregion,
|
p_replacementregion: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_replacementregion,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_bondsurety: {
|
},
|
||||||
val: body.p_bondsurety,
|
p_bondsurety: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_bondsurety,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_cargopolicyno: {
|
},
|
||||||
val: body.p_cargopolicyno,
|
p_cargopolicyno: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_cargopolicyno,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_cargosurety: {
|
},
|
||||||
val: body.p_cargosurety,
|
p_cargosurety: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_cargosurety,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_user_id: {
|
},
|
||||||
val: body.p_user_id,
|
p_user_id: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_user_id,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
P_NOTES: {
|
},
|
||||||
val: body.P_NOTES,
|
P_NOTES: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.P_NOTES,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
P_FILEIDS: {
|
},
|
||||||
val: body.P_FILEIDS,
|
P_FILEIDS: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.P_FILEIDS,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
|
},
|
||||||
|
|
||||||
p_cursor: {
|
p_cursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
}, {
|
},
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
{
|
||||||
}
|
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||||
);
|
},
|
||||||
await connection.commit();
|
);
|
||||||
|
await connection.commit();
|
||||||
|
|
||||||
let fres = await result.outBinds.p_cursor.getRows();
|
const fres = await result.outBinds.p_cursor.getRows();
|
||||||
|
|
||||||
return fres
|
|
||||||
|
|
||||||
} catch (err) {
|
|
||||||
|
|
||||||
return { error: err.message }
|
|
||||||
} finally { }
|
|
||||||
|
|
||||||
|
return fres;
|
||||||
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
|
return { error: err.message };
|
||||||
|
} else {
|
||||||
|
return { error: 'An unknown error occurred' };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async updateServiceProvider(body: UpdateServiceProviderDTO) {
|
async updateServiceProvider(body: UpdateServiceProviderDTO) {
|
||||||
|
let connection;
|
||||||
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
|
if (!connection) {
|
||||||
|
throw new Error('No DB Connected');
|
||||||
|
}
|
||||||
|
|
||||||
let connection;
|
const result = await connection.execute(
|
||||||
try {
|
`BEGIN
|
||||||
|
|
||||||
connection = await this.oracleDBService.getConnection()
|
|
||||||
if (!connection) {
|
|
||||||
throw new Error('No DB Connected')
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = await connection.execute(
|
|
||||||
`BEGIN
|
|
||||||
USCIB_Managed_Pkg.UpdateSP(
|
USCIB_Managed_Pkg.UpdateSP(
|
||||||
:p_spid,
|
:p_spid,
|
||||||
:p_name,
|
:p_name,
|
||||||
@ -156,197 +158,197 @@ export class SpService {
|
|||||||
:P_NOTES,
|
:P_NOTES,
|
||||||
:P_FILEIDS,
|
:P_FILEIDS,
|
||||||
:p_cursor);
|
:p_cursor);
|
||||||
END;`, {
|
END;`,
|
||||||
p_spid: {
|
{
|
||||||
val: body.p_spid,
|
p_spid: {
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
val: body.p_spid,
|
||||||
},
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
p_name: {
|
},
|
||||||
val: body.p_name,
|
p_name: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_name,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_lookupcode: {
|
},
|
||||||
val: body.p_lookupcode,
|
p_lookupcode: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_lookupcode,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_address1: {
|
},
|
||||||
val: body.p_address1,
|
p_address1: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_address1,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_address2: {
|
},
|
||||||
val: body.p_address2,
|
p_address2: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_address2,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_city: {
|
},
|
||||||
val: body.p_city,
|
p_city: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_city,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_state: {
|
},
|
||||||
val: body.p_state,
|
p_state: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_state,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_zip: {
|
},
|
||||||
val: body.p_zip,
|
p_zip: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_zip,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_country: {
|
},
|
||||||
val: body.p_country,
|
p_country: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_country,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_issuingregion: {
|
},
|
||||||
val: body.p_issuingregion,
|
p_issuingregion: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_issuingregion,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_replacementregion: {
|
},
|
||||||
val: body.p_replacementregion,
|
p_replacementregion: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_replacementregion,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_bondsurety: {
|
},
|
||||||
val: body.p_bondsurety,
|
p_bondsurety: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_bondsurety,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_cargopolicyno: {
|
},
|
||||||
val: body.p_cargopolicyno,
|
p_cargopolicyno: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_cargopolicyno,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_cargosurety: {
|
},
|
||||||
val: body.p_cargosurety,
|
p_cargosurety: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_cargosurety,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_user_id: {
|
},
|
||||||
val: body.p_user_id,
|
p_user_id: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.p_user_id,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
P_NOTES: {
|
},
|
||||||
val: body.P_NOTES,
|
P_NOTES: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.P_NOTES,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
P_FILEIDS: {
|
},
|
||||||
val: body.P_FILEIDS,
|
P_FILEIDS: {
|
||||||
type: oracledb.DB_TYPE_VARCHAR
|
val: body.P_FILEIDS,
|
||||||
},
|
type: oracledb.DB_TYPE_VARCHAR,
|
||||||
p_cursor: {
|
},
|
||||||
type: oracledb.CURSOR,
|
p_cursor: {
|
||||||
dir: oracledb.BIND_OUT
|
type: oracledb.CURSOR,
|
||||||
}
|
dir: oracledb.BIND_OUT,
|
||||||
}, {
|
},
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
},
|
||||||
}
|
{
|
||||||
);
|
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
await connection.commit();
|
await connection.commit();
|
||||||
|
|
||||||
let fres = await result.outBinds.p_cursor.getRows();
|
const fres = await result.outBinds.p_cursor.getRows();
|
||||||
|
|
||||||
return fres
|
|
||||||
|
|
||||||
} catch (err) {
|
|
||||||
|
|
||||||
return { error: err.message }
|
|
||||||
} finally { }
|
|
||||||
|
|
||||||
|
return fres;
|
||||||
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
|
return { error: err.message };
|
||||||
|
} else {
|
||||||
|
return { error: 'An unknown error occurred' };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async getAllServiceproviders() {
|
async getAllServiceproviders() {
|
||||||
|
let connection;
|
||||||
|
let rows = [];
|
||||||
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
|
if (!connection) {
|
||||||
|
throw new Error('No DB Connected');
|
||||||
|
}
|
||||||
|
|
||||||
let connection;
|
const result = await connection.execute(
|
||||||
let rows = [];
|
`BEGIN
|
||||||
try {
|
|
||||||
|
|
||||||
connection = await this.oracleDBService.getConnection()
|
|
||||||
if (!connection) {
|
|
||||||
throw new Error('No DB Connected')
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = await connection.execute(
|
|
||||||
`BEGIN
|
|
||||||
USCIB_Managed_Pkg.GetAllSPs(:p_cursor);
|
USCIB_Managed_Pkg.GetAllSPs(:p_cursor);
|
||||||
END;`,
|
END;`,
|
||||||
{
|
{
|
||||||
p_cursor: {
|
p_cursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result.outBinds && result.outBinds.p_cursor) {
|
if (result.outBinds && result.outBinds.p_cursor) {
|
||||||
const cursor = result.outBinds.p_cursor;
|
const cursor = result.outBinds.p_cursor;
|
||||||
let rowsBatch;
|
let rowsBatch;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
rowsBatch = await cursor.getRows(100);
|
rowsBatch = await cursor.getRows(100);
|
||||||
rows = rows.concat(rowsBatch);
|
rows = rows.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
await cursor.close();
|
||||||
|
|
||||||
await cursor.close();
|
return rows;
|
||||||
|
} else {
|
||||||
return rows;
|
throw new Error('No cursor returned from the stored procedure');
|
||||||
} else {
|
}
|
||||||
throw new Error('No cursor returned from the stored procedure');
|
} catch (err) {
|
||||||
}
|
if (err instanceof Error) {
|
||||||
|
return { error: err.message };
|
||||||
} catch (err) {
|
} else {
|
||||||
|
return { error: 'An unknown error occurred' };
|
||||||
return { error: err.message }
|
}
|
||||||
} finally { }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async getServiceproviderByID(body:getSelectedServiceproviderDTO) {
|
async getServiceproviderByID(body: getSelectedServiceproviderDTO) {
|
||||||
|
let connection;
|
||||||
|
let rows = [];
|
||||||
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
|
if (!connection) {
|
||||||
|
throw new Error('No DB Connected');
|
||||||
|
}
|
||||||
|
|
||||||
let connection;
|
const result = await connection.execute(
|
||||||
let rows = [];
|
`BEGIN
|
||||||
try {
|
|
||||||
|
|
||||||
connection = await this.oracleDBService.getConnection()
|
|
||||||
if (!connection) {
|
|
||||||
throw new Error('No DB Connected')
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = await connection.execute(
|
|
||||||
`BEGIN
|
|
||||||
USCIB_Managed_Pkg.GetSPbySPID(:p_spid,:p_cursor);
|
USCIB_Managed_Pkg.GetSPbySPID(:p_spid,:p_cursor);
|
||||||
END;`,
|
END;`,
|
||||||
{
|
{
|
||||||
p_spid: {
|
p_spid: {
|
||||||
val: body.p_spid,
|
val: body.p_spid,
|
||||||
type: oracledb.DB_TYPE_NUMBER,
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
},
|
},
|
||||||
p_cursor: {
|
p_cursor: {
|
||||||
type: oracledb.CURSOR,
|
type: oracledb.CURSOR,
|
||||||
dir: oracledb.BIND_OUT
|
dir: oracledb.BIND_OUT,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result.outBinds && result.outBinds.p_cursor) {
|
if (result.outBinds && result.outBinds.p_cursor) {
|
||||||
const cursor = result.outBinds.p_cursor;
|
const cursor = result.outBinds.p_cursor;
|
||||||
let rowsBatch;
|
let rowsBatch;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
rowsBatch = await cursor.getRows(100);
|
rowsBatch = await cursor.getRows(100);
|
||||||
rows = rows.concat(rowsBatch);
|
rows = rows.concat(rowsBatch);
|
||||||
} while (rowsBatch.length > 0);
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
await cursor.close();
|
await cursor.close();
|
||||||
} else {
|
} else {
|
||||||
throw new Error('No cursor returned from the stored procedure');
|
throw new Error('No cursor returned from the stored procedure');
|
||||||
}
|
}
|
||||||
|
|
||||||
return rows;
|
|
||||||
|
|
||||||
} catch (err) {
|
|
||||||
|
|
||||||
return { error: err.message }
|
|
||||||
} finally { }
|
|
||||||
|
|
||||||
|
return rows;
|
||||||
|
} catch (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
|
return { error: err.message };
|
||||||
|
} else {
|
||||||
|
return { error: 'An unknown error occurred' };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,6 @@ import { CarnetSequenceModule } from './carnet-sequence/carnet-sequence.module';
|
|||||||
@Module({
|
@Module({
|
||||||
controllers: [],
|
controllers: [],
|
||||||
providers: [],
|
providers: [],
|
||||||
imports: [RegionModule, SpModule, SpContactsModule, CarnetSequenceModule]
|
imports: [RegionModule, SpModule, SpContactsModule, CarnetSequenceModule],
|
||||||
})
|
})
|
||||||
export class UscibManagedSpModule {}
|
export class UscibManagedSpModule {}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user