added new api according to doc

This commit is contained in:
Kallesh B S 2025-03-24 17:21:59 +05:30
parent dbd040e033
commit 0227d9ced0
5 changed files with 801 additions and 47 deletions

View File

@ -1,3 +1,7 @@
GET http://localhost:3000/oracle/GetCarnetDetailsbyCarnetStatus/1/v/false
###
// CreateBasicFee // CreateBasicFee
POST http://localhost:3000/oracle/CreateBasicFee POST http://localhost:3000/oracle/CreateBasicFee
Content-Type: application/json Content-Type: application/json

View File

@ -1,17 +1,72 @@
import { NestFactory } from '@nestjs/core'; import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module'; import { AppModule } from './app.module';
import { 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, {cors:{ const app = await NestFactory.create(AppModule, {
"origin": "*", cors: {
"methods": "GET,HEAD,PUT,PATCH,POST,DELETE", "origin": "*",
"preflightContinue": false, "methods": "GET,HEAD,PUT,PATCH,POST,DELETE",
"optionsSuccessStatus": 204 "preflightContinue": false,
}}); "optionsSuccessStatus": 204
app.useGlobalPipes(new ValidationPipe()); }
});
const returnErrorChildren = (x: any) => {
if (x.children.length !== 0) {
return x.children;
}
return null
}
function extractConstraints(validationErrors:ValidationError[]) {
const constraints: { [key: string]: string }[] = [];
function traverse(errors:ValidationError[]) {
// console.log(errors);
// console.log("--------------");
for (const error of errors) {
// If the error has constraints, add them to the list
console.log(error);
console.log("--------------");
if (error.constraints) {
constraints.push(error.constraints);
}
// // If there are children, recursively traverse them
if (error.children && error.children.length > 0) {
traverse(error.children);
}
}
}
traverse(validationErrors);
return constraints;
}
const customExceptionFactory = (validationErrors: ValidationError[]) => {
let res = extractConstraints(validationErrors);
let newResult = res.map(x=>{
return {message:x[Object.keys(x)[0]]}
}).filter(Boolean);
return new BadRequestException({ message: 'Validation failed', errors: newResult });
};
// app.useGlobalPipes(new ValidationPipe({ exceptionFactory:customExceptionFactory, whitelist: true, forbidNonWhitelisted: true, transform: true }));
app.useGlobalPipes(new ValidationPipe({
exceptionFactory: customExceptionFactory,
stopAtFirstError: true,
whitelist: true,
forbidNonWhitelisted: true,
transform: true
}));
const config = new DocumentBuilder() const config = new DocumentBuilder()
.setTitle('API') .setTitle('API')

View File

@ -1,6 +1,7 @@
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 { GetCarnetDetailsbyCarnetStatusDTO, SaveCarnetApplicationDTO, TransmitApplicationtoProcessDTO } from "./oracle.dto";
@Injectable() @Injectable()
export class HomePageDataService { export class HomePageDataService {
@ -284,14 +285,14 @@ export class HomePageDataService {
} catch (err) { } catch (err) {
console.error('Error fetching users: ', err); console.error('Error fetching users: ', err);
return {error: err.message} return { error: err.message }
} finally { } } finally { }
} }
async GetCarnetSummaryData(p_emailaddr: string) { async GetCarnetSummaryData(p_emailaddr: string) {
let connection; let connection;
let rows:any = []; let rows: any = [];
try { try {
connection = await this.oracleDBService.getConnection() connection = await this.oracleDBService.getConnection()
@ -372,9 +373,330 @@ export class HomePageDataService {
} catch (err) { } catch (err) {
console.error('Error fetching users: ', err); console.error('Error fetching users: ', err);
return {error: err.message} return { error: err.message }
} finally { } } finally { }
} }
async SaveCarnetApplication(body: SaveCarnetApplicationDTO) {
let connection;
let rows = [];
try {
connection = await this.oracleDBService.getConnection()
if (!connection) {
throw new Error('No DB Connected')
}
const result = await connection.execute(
`BEGIN
CARNETAPPLICATION_PKG.SaveCarnetApplication(
:p_spid
:p_clientid
:p_locationid
:p_userid
:p_headerid
:p_applicationname
:p_holderid
:p_commercialsampleflag
:p_profequipmentflag
:p_exhibitionsfairflag
:p_autoflag
:p_horseflag
:p_authrep
:p_gltable
:p_ussets
:p_countrytable
:p_shiptotype
:p_shipaddrid
:p_formofsecurity
:p_insprotection
:p_ldiprotection
:p_deliverytype
:p_deliverymethod
:p_paymentmethod
:p_custcourierno
:p_refno
:p_notes
:P_cursor
);
END;`,
{
p_spid: {
val: body.p_spid,
type: oracledb.DB_TYPE_NUMBER
},
p_clientid: {
val: body.p_spid,
type: oracledb.DB_TYPE_NUMBER
},
p_locationid: {
val: body.p_spid,
type: oracledb.DB_TYPE_NUMBER
},
p_userid: {
val: body.p_spid,
type: oracledb.DB_TYPE_NVARCHAR
},
p_headerid: {
val: body.p_spid,
type: oracledb.DB_TYPE_NUMBER
},
p_applicationname: {
val: body.p_spid,
type: oracledb.DB_TYPE_NVARCHAR
},
p_holderid: {
val: body.p_spid,
type: oracledb.DB_TYPE_NUMBER
},
p_commercialsampleflag: {
val: body.p_spid,
type: oracledb.DB_TYPE_NVARCHAR
},
p_profequipmentflag: {
val: body.p_spid,
type: oracledb.DB_TYPE_NVARCHAR
},
p_exhibitionsfairflag: {
val: body.p_spid,
type: oracledb.DB_TYPE_NVARCHAR
},
p_autoflag: {
val: body.p_spid,
type: oracledb.DB_TYPE_NVARCHAR
},
p_horseflag: {
val: body.p_spid,
type: oracledb.DB_TYPE_NVARCHAR
},
p_authrep: {
val: body.p_spid,
type: oracledb.DB_TYPE_NVARCHAR
},
p_gltable: {
val: body.p_spid,
type: oracledb.DB_TYPE_OBJECT
},
p_ussets: {
val: body.p_spid,
type: oracledb.DB_TYPE_NUMBER
},
p_countrytable: {
val: body.p_spid,
type: oracledb.DB_TYPE_OBJECT
},
p_shiptotype: {
val: body.p_spid,
type: oracledb.DB_TYPE_NVARCHAR
},
p_shipaddrid: {
val: body.p_spid,
type: oracledb.DB_TYPE_NUMBER
},
p_formofsecurity: {
val: body.p_spid,
type: oracledb.DB_TYPE_NVARCHAR
},
p_insprotection: {
val: body.p_spid,
type: oracledb.DB_TYPE_NVARCHAR
},
p_ldiprotection: {
val: body.p_spid,
type: oracledb.DB_TYPE_NVARCHAR
},
p_deliverytype: {
val: body.p_spid,
type: oracledb.DB_TYPE_NVARCHAR
},
p_deliverymethod: {
val: body.p_spid,
type: oracledb.DB_TYPE_NVARCHAR
},
p_paymentmethod: {
val: body.p_spid,
type: oracledb.DB_TYPE_NVARCHAR
},
p_custcourierno: {
val: body.p_spid,
type: oracledb.DB_TYPE_NVARCHAR
},
p_refno: {
val: body.p_spid,
type: oracledb.DB_TYPE_NVARCHAR
},
p_notes: {
val: body.p_spid,
type: oracledb.DB_TYPE_NVARCHAR
},
P_cursor: {
type: oracledb.CURSOR,
dir: oracledb.BIND_OUT
}
}, {
outFormat: oracledb.OUT_FORMAT_OBJECT
}
);
await connection.commit();
// let fres = await result.outBinds.P_cursor.getRows();
if (result.outBinds && result.outBinds.P_cursor) {
const cursor = result.outBinds.P_cursor;
let rowsBatch;
do {
rowsBatch = await cursor.getRows(100);
rows = rows.concat(rowsBatch);
} while (rowsBatch.length > 0);
await cursor.close();
} else {
throw new Error('No cursor returned from the stored procedure');
}
return rows;
// return fres
} catch (err) {
console.error('Error fetching users: ', err);
return { error: err.message }
} finally { }
}
async TransmitApplicationtoProcess(body: TransmitApplicationtoProcessDTO) {
let connection;
let rows = [];
try {
connection = await this.oracleDBService.getConnection()
if (!connection) {
throw new Error('No DB Connected')
}
const result = await connection.execute(
`BEGIN
CARNETAPPLICATION_PKG.TransmitApplicationtoProcess(
:p_spid,
:p_userid,
:p_headerid,
:P_cursor
);
END;`,
{
p_spid: {
val: body.p_spid,
type: oracledb.DB_TYPE_NUMBER
},
p_userid: {
val: body.p_userid,
type: oracledb.DB_TYPE_NVARCHAR
},
p_headerid: {
val: body.p_headerid,
type: oracledb.DB_TYPE_NUMBER
},
P_cursor: {
type: oracledb.CURSOR,
dir: oracledb.BIND_OUT
}
}, {
outFormat: oracledb.OUT_FORMAT_OBJECT
}
);
await connection.commit();
if (result.outBinds && result.outBinds.P_cursor) {
const cursor = result.outBinds.P_cursor;
let rowsBatch;
do {
rowsBatch = await cursor.getRows(100);
rows = rows.concat(rowsBatch);
} while (rowsBatch.length > 0);
await cursor.close();
} else {
throw new Error('No cursor returned from the stored procedure');
}
return rows;
// return fres
} catch (err) {
console.error('Error fetching users: ', err);
return { error: err.message }
} finally { }
}
async GetCarnetDetailsbyCarnetStatus(body: GetCarnetDetailsbyCarnetStatusDTO) {
let connection;
let rows: any = [];
try {
connection = await this.oracleDBService.getConnection()
if (!connection) {
throw new Error('No DB Connected')
}
const result = await connection.execute(
`BEGIN
CARNETCONTROLCENTER_PKG.GetCarnetDetails(:p_spid,:p_userid,:p_CarnetStattus,:P_cursor);
END;`,
{
p_spid: {
val: body.p_spid,
type: oracledb.DB_TYPE_NUMBER,
},
p_userid: {
val: body.p_userid,
type: oracledb.DB_TYPE_NVARCHAR,
},
p_CarnetStattus: {
val: body.p_CarnetStatus,
type: oracledb.DB_TYPE_NVARCHAR,
},
P_cursor: {
type: oracledb.CURSOR,
dir: oracledb.BIND_OUT
}
},
{
outFormat: oracledb.OUT_FORMAT_OBJECT
}
);
if (result.outBinds && result.outBinds.P_cursor) {
const cursor = result.outBinds.P_cursor;
let rowsBatch;
do {
rowsBatch = await cursor.getRows(100);
rows = rows.concat(rowsBatch);
} while (rowsBatch.length > 0);
await cursor.close();
} else {
throw new Error('No cursor returned from the stored procedure');
}
return rows;
} catch (err) {
console.error('Error fetching users: ', err);
return { error: err.message }
} finally { }
}
} }

View File

@ -1,6 +1,6 @@
import { Body, Controller, Get, Param, ParseIntPipe, Patch, Post, Put, Query, UsePipes } from '@nestjs/common'; import { BadRequestException, Body, Controller, Get, Param, ParseIntPipe, Patch, Post, Put, Query, UsePipes } from '@nestjs/common';
import { OracleService } from './oracle.service'; import { OracleService } from './oracle.service';
import { ActivateOrInactivateParamRecordDTO, CreateBasicFeeDTO, CreateBondRateDTO, CreateCargoRateDTO, CreateCarnetSequenceDTO, CreateCfFeeDTO, CreateCsFeeDTO, CreateEfFeeDTO, CreateFeeCommDTO, CreateParamRecordDTO, CreateTableRecordDTO, InsertNewServiceProviderDTO, InsertRegionsDto, InsertSPContactsDTO, UpdateBasicFeeDTO, UpdateBondRateDTO, UpdateCargoRateDTO, UpdateCfFeeDTO, UpdateCsFeeDTO, UpdateEfFeeDTO, UpdateFeeCommBodyDTO, UpdateFeeCommDTO, UpdateParamRecordDTO, UpdateRegionDto, UpdateServiceProviderDTO, UpdateSPContactsDTO } from './oracle.dto'; import { ActivateOrInactivateParamRecordDTO, CreateBasicFeeDTO, CreateBondRateDTO, CreateCargoRateDTO, CreateCarnetSequenceDTO, CreateCfFeeDTO, CreateCsFeeDTO, CreateEfFeeDTO, CreateFeeCommDTO, CreateParamRecordDTO, CreateTableRecordDTO, GetCarnetDetailsbyCarnetStatusDTO, InsertNewServiceProviderDTO, InsertRegionsDto, InsertSPContactsDTO, SaveCarnetApplicationDTO, TestDTO, TransmitApplicationtoProcessDTO, UpdateBasicFeeDTO, UpdateBondRateDTO, UpdateCargoRateDTO, UpdateCfFeeDTO, UpdateCsFeeDTO, UpdateEfFeeDTO, UpdateFeeCommBodyDTO, UpdateFeeCommDTO, UpdateParamRecordDTO, UpdateRegionDto, UpdateServiceProviderDTO, UpdateSPContactsDTO } from './oracle.dto';
import { ParamTableService } from './paramTable.service'; import { ParamTableService } from './paramTable.service';
import { ManageFeeService } from './manageFee.service'; import { ManageFeeService } from './manageFee.service';
import { ApiOperation, ApiPropertyOptional, ApiQuery, ApiTags } from '@nestjs/swagger'; import { ApiOperation, ApiPropertyOptional, ApiQuery, ApiTags } from '@nestjs/swagger';
@ -28,6 +28,53 @@ export class OracleController {
return this.homePageDataService.GetCarnetSummaryData(id); return this.homePageDataService.GetCarnetSummaryData(id);
} }
@ApiTags('HomePage - Oracle')
@Post('/SaveCarnetApplication')
SaveCarnetApplication(@Body() body: SaveCarnetApplicationDTO) {
return this.homePageDataService.SaveCarnetApplication(body);
// return body;
}
@ApiTags('HomePage - Oracle')
@Post('/TransmitApplicationtoProcess')
TransmitApplicationtoProcess(@Body() body: TransmitApplicationtoProcessDTO) {
return this.homePageDataService.TransmitApplicationtoProcess(body);
}
@ApiTags('HomePage - Oracle')
@Get('/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.homePageDataService.GetCarnetDetailsbyCarnetStatus(body);
}
catch (err) {
return new BadRequestException({ message: 'Validation faileda', error: err.message })
}
}
// @ApiTags('HomePage - Oracle')
// @Post('/test')
// test(@Body() body:TestDTO) {
// return body;
// }
// Regions // Regions
@ApiTags('Regions - Oracle') @ApiTags('Regions - Oracle')
@ -337,63 +384,63 @@ export class OracleController {
@Get('/GetBasicFeeRates/:P_SPID/:P_ACTIVE_INACTIVE') @Get('/GetBasicFeeRates/:P_SPID/:P_ACTIVE_INACTIVE')
GetBasicFeeRates( GetBasicFeeRates(
@Param('P_SPID', ParseIntPipe) P_SPID: number, @Param('P_SPID', ParseIntPipe) P_SPID: number,
@Param('P_ACTIVE_INACTIVE',) P_ACTIVE_INACTIVE:string @Param('P_ACTIVE_INACTIVE',) P_ACTIVE_INACTIVE: string
) { ) {
return this.manageFeeService.GETBASICFEERATES(P_SPID,P_ACTIVE_INACTIVE) return this.manageFeeService.GETBASICFEERATES(P_SPID, P_ACTIVE_INACTIVE)
} }
@ApiTags('Manage Fee - Oracle') @ApiTags('Manage Fee - Oracle')
@Get('/GetBondRates/:P_SPID/:P_ACTIVE_INACTIVE') @Get('/GetBondRates/:P_SPID/:P_ACTIVE_INACTIVE')
GetBondRates( GetBondRates(
@Param('P_SPID', ParseIntPipe) P_SPID: number, @Param('P_SPID', ParseIntPipe) P_SPID: number,
@Param('P_ACTIVE_INACTIVE',) P_ACTIVE_INACTIVE:string @Param('P_ACTIVE_INACTIVE',) P_ACTIVE_INACTIVE: string
) { ) {
return this.manageFeeService.GETBONDRATES(P_SPID,P_ACTIVE_INACTIVE) return this.manageFeeService.GETBONDRATES(P_SPID, P_ACTIVE_INACTIVE)
} }
@ApiTags('Manage Fee - Oracle') @ApiTags('Manage Fee - Oracle')
@Get('/GetCargoRates/:P_SPID/:P_ACTIVE_INACTIVE') @Get('/GetCargoRates/:P_SPID/:P_ACTIVE_INACTIVE')
GetCargoRates( GetCargoRates(
@Param('P_SPID', ParseIntPipe) P_SPID: number, @Param('P_SPID', ParseIntPipe) P_SPID: number,
@Param('P_ACTIVE_INACTIVE',) P_ACTIVE_INACTIVE:string @Param('P_ACTIVE_INACTIVE',) P_ACTIVE_INACTIVE: string
) { ) {
return this.manageFeeService.GETCARGORATES(P_SPID,P_ACTIVE_INACTIVE) return this.manageFeeService.GETCARGORATES(P_SPID, P_ACTIVE_INACTIVE)
} }
@ApiTags('Manage Fee - Oracle') @ApiTags('Manage Fee - Oracle')
@Get('/GetCfFeeRates/:P_SPID/:P_ACTIVE_INACTIVE') @Get('/GetCfFeeRates/:P_SPID/:P_ACTIVE_INACTIVE')
GetCfFeeRates( GetCfFeeRates(
@Param('P_SPID', ParseIntPipe) P_SPID: number, @Param('P_SPID', ParseIntPipe) P_SPID: number,
@Param('P_ACTIVE_INACTIVE',) P_ACTIVE_INACTIVE:string @Param('P_ACTIVE_INACTIVE',) P_ACTIVE_INACTIVE: string
) { ) {
return this.manageFeeService.GETCFFEERATES(P_SPID,P_ACTIVE_INACTIVE) return this.manageFeeService.GETCFFEERATES(P_SPID, P_ACTIVE_INACTIVE)
} }
@ApiTags('Manage Fee - Oracle') @ApiTags('Manage Fee - Oracle')
@Get('/GetCsFeeRates/:P_SPID/:P_ACTIVE_INACTIVE') @Get('/GetCsFeeRates/:P_SPID/:P_ACTIVE_INACTIVE')
GetCsFeeRates( GetCsFeeRates(
@Param('P_SPID', ParseIntPipe) P_SPID: number, @Param('P_SPID', ParseIntPipe) P_SPID: number,
@Param('P_ACTIVE_INACTIVE',) P_ACTIVE_INACTIVE:string @Param('P_ACTIVE_INACTIVE',) P_ACTIVE_INACTIVE: string
) { ) {
return this.manageFeeService.GETCSFEERATES(P_SPID,P_ACTIVE_INACTIVE) return this.manageFeeService.GETCSFEERATES(P_SPID, P_ACTIVE_INACTIVE)
} }
@ApiTags('Manage Fee - Oracle') @ApiTags('Manage Fee - Oracle')
@Get('/GetEfFeeRates/:P_SPID/:P_ACTIVE_INACTIVE') @Get('/GetEfFeeRates/:P_SPID/:P_ACTIVE_INACTIVE')
GetEfFeeRates( GetEfFeeRates(
@Param('P_SPID', ParseIntPipe) P_SPID: number, @Param('P_SPID', ParseIntPipe) P_SPID: number,
@Param('P_ACTIVE_INACTIVE',) P_ACTIVE_INACTIVE:string @Param('P_ACTIVE_INACTIVE',) P_ACTIVE_INACTIVE: string
) { ) {
return this.manageFeeService.GETEFFEERATES(P_SPID,P_ACTIVE_INACTIVE) return this.manageFeeService.GETEFFEERATES(P_SPID, P_ACTIVE_INACTIVE)
} }
@ApiTags('Manage Fee - Oracle') @ApiTags('Manage Fee - Oracle')
@Get('/GetFeeComm/:P_SPID/:P_ACTIVE_INACTIVE') @Get('/GetFeeComm/:P_SPID/:P_ACTIVE_INACTIVE')
GetFeeComm( GetFeeComm(
@Param('P_SPID', ParseIntPipe) P_SPID: number, @Param('P_SPID', ParseIntPipe) P_SPID: number,
@Param('P_ACTIVE_INACTIVE') P_ACTIVE_INACTIVE:string @Param('P_ACTIVE_INACTIVE') P_ACTIVE_INACTIVE: string
) { ) {
return this.manageFeeService.GETFEECOMM(P_SPID,P_ACTIVE_INACTIVE) return this.manageFeeService.GETFEECOMM(P_SPID, P_ACTIVE_INACTIVE)
} }
} }

View File

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