inprogress uppercase

This commit is contained in:
Kallesh B S 2025-06-02 16:04:51 +05:30
parent 14adadcf98
commit fd80c8213c
25 changed files with 2350 additions and 2860 deletions

View File

@ -6,7 +6,7 @@ import { MssqlModule } from './mssql/mssql.module';
import { OriginCheckMiddleware } from './middleware/OriginCheck.middleware'; import { OriginCheckMiddleware } from './middleware/OriginCheck.middleware';
@Module({ @Module({
imports: [MssqlModule, AuthModule, DbModule, OracleModule], imports: [ AuthModule, DbModule, OracleModule],
controllers: [], controllers: [],
providers: [], providers: [],
}) })

View File

@ -3,7 +3,7 @@
// carnet // carnet
import { ApiProperty } from "@nestjs/swagger"; import { ApiProperty } from "@nestjs/swagger";
import { IsDefined, IsNumber, IsString, Min } from "class-validator"; import { IsDefined, IsNumber, IsString, Length, Min } from "class-validator";
export class START_NUMBER_DTO { export class START_NUMBER_DTO {
@ApiProperty({ required: true }) @ApiProperty({ required: true })
@ -25,3 +25,14 @@ export class CARNET_TYPE_DTO {
@IsDefined({ message: 'Property p_carnettype is required' }) @IsDefined({ message: 'Property p_carnettype is required' })
P_CARNETTYPE: string; P_CARNETTYPE: string;
} }
export class CARNETSTATUS_DTO {
@ApiProperty({ required: true })
@Length(0, 20, {
message: 'Property P_CARNETSTATUS must be between 0 to 20 characters',
})
@IsString()
@IsDefined({ message: 'Property P_CARNETSTATUS is required' })
P_CARNETSTATUS: string;
}

View File

@ -0,0 +1,10 @@
import { IntersectionType } from "@nestjs/swagger";
import { SPID_DTO } from "../sp/sp-property.dto";
import { USERID_DTO } from "../property.dto";
import { CARNETSTATUS_DTO } from "./carnet-property.dto";
export class GetCarnetDetailsbyCarnetStatusDTO extends IntersectionType(
SPID_DTO,
USERID_DTO,
CARNETSTATUS_DTO
) { }

View File

@ -0,0 +1,62 @@
import { ApiProperty } from "@nestjs/swagger";
import { Type } from "class-transformer";
import { IsArray, IsDefined, IsString, Length, ValidateNested } from "class-validator";
import { CLIENTLOCADDRESSTABLE_ROW_DTO } from "./client.dto";
export class CLIENTNAME_DTO {
@ApiProperty({ required: true })
// @Max(999999999, { message: "Property P_CLIENTNAME must not exceed 999999999" })
// @Min(0, { message: "Property P_CLIENTNAME must be at least 0 or more" })
// @IsInt({ message: "Property P_CLIENTNAME allows only whole numbers" })
// @IsNumber({}, { message: "Property P_CLIENTNAME must be a number" })
// @IsDefined({ message: "Property P_CLIENTNAME is required" })
@Length(0, 50, {
message: 'Property P_CLIENTNAME must be between 0 to 50 characters',
})
@IsString({ message: 'Property P_CLIENTNAME must be a string' })
@IsDefined({ message: 'Property P_CLIENTNAME is required' })
P_CLIENTNAME: string;
}
export class REVENUELOCATION_DTO {
@ApiProperty({ required: true })
@Length(0, 2, {
message: 'Property P_REVENUELOCATION must be between 0 to 2 characters',
})
@IsString({ message: 'Property P_REVENUELOCATION must be a string' })
@IsDefined({ message: 'Property P_REVENUELOCATION is required' })
P_REVENUELOCATION: string;
}
export class PREPARERNAME_DTO {
@ApiProperty({ required: true })
@Length(0, 50, {
message: 'Property P_PREPARERNAME must be between 0 to 50 characters',
})
@IsString({ message: 'Property P_PREPARERNAME must be a string' })
@IsDefined({ message: 'Property P_PREPARERNAME is required' })
P_PREPARERNAME: string;
}
export class STATUS_DTO {
@ApiProperty({ required: true })
@Length(0, 10, {
message: 'Property P_STATUS must be between 0 to 10 characters',
})
@IsString({ message: 'Property P_STATUS must be a string' })
@IsDefined({ message: 'Property P_STATUS is required' })
P_STATUS: string;
}
export class CLIENTLOCADDRESSTABLE_DTO{
@ApiProperty({ required: true, type: () => [CLIENTLOCADDRESSTABLE_ROW_DTO] })
@Type(() => CLIENTLOCADDRESSTABLE_ROW_DTO)
@ValidateNested({ each: true })
@IsArray({
message: 'Property P_CLIENTLOCADDRESSTABLE allows only array type',
})
@IsDefined({ message: 'Property P_CLIENTLOCADDRESSTABLE is required' })
P_CLIENTLOCADDRESSTABLE: CLIENTLOCADDRESSTABLE_ROW_DTO[];
}

View File

@ -0,0 +1,103 @@
import { IntersectionType, PartialType } from "@nestjs/swagger";
import { ADDRESS1_DTO, ADDRESS2_DTO, CITY_DTO, CLIENT_CONTACTID_DTO, CLIENTID_DTO, COUNTRY_DTO, ISSUING_REGION_DTO, LOOKUP_CODE_DTO, NAME_DTO, NAMEOF_DTO, STATE_DTO, USERID_DTO, ZIP_DTO } from "../property.dto";
import { SPID_DTO } from "../sp/sp-property.dto";
import { CLIENTLOCADDRESSTABLE_DTO, CLIENTNAME_DTO, PREPARERNAME_DTO, REVENUELOCATION_DTO, STATUS_DTO } from "./client-property.dto";
import { DEFAULT_CONTACT_FLAG_DTO, EMAIL_ADDRESS_DTO, FAX_NO_DTO, FIRSTNAME_DTO, LASTNAME_DTO, MIDDLE_INITIAL_DTO, MOBILE_NO_DTO, PHONE_NO_DTO, TITLE_DTO } from "../contact/contact-property.dto";
import { CLIENTLOCATIONID_DTO, LOCATIONNAME_DTO } from "../location/location-property.dto";
import { CONTACTSTABLE_DTO } from "../holder/holder-property.dto";
export class CLIENTLOCADDRESSTABLE_ROW_DTO extends IntersectionType(
NAMEOF_DTO,
ADDRESS1_DTO,
PartialType(ADDRESS2_DTO),
CITY_DTO,
STATE_DTO,
ZIP_DTO,
COUNTRY_DTO
) { }
export class CreateClientDataDTO extends IntersectionType(
SPID_DTO,
CLIENTNAME_DTO,
LOOKUP_CODE_DTO,
ADDRESS1_DTO,
PartialType(ADDRESS2_DTO),
CITY_DTO,
STATE_DTO,
PartialType(ZIP_DTO),
PartialType(COUNTRY_DTO),
ISSUING_REGION_DTO,
REVENUELOCATION_DTO,
USERID_DTO
) { }
export class UpdateClientDTO extends IntersectionType(
SPID_DTO,
CLIENTID_DTO,
PREPARERNAME_DTO,
ADDRESS1_DTO,
PartialType(ADDRESS2_DTO),
CITY_DTO,
STATE_DTO,
ZIP_DTO,
COUNTRY_DTO,
REVENUELOCATION_DTO,
USERID_DTO
) { }
export class UpdateClientContactsDTO extends IntersectionType(
SPID_DTO,
CLIENT_CONTACTID_DTO,
FIRSTNAME_DTO,
LASTNAME_DTO,
PartialType(MIDDLE_INITIAL_DTO),
PartialType(TITLE_DTO),
PHONE_NO_DTO,
FAX_NO_DTO,
PartialType(MOBILE_NO_DTO),
EMAIL_ADDRESS_DTO,
USERID_DTO
) { }
export class GetPreparersDTO extends IntersectionType(
SPID_DTO,
PartialType(NAME_DTO),
PartialType(LOOKUP_CODE_DTO),
PartialType(CITY_DTO),
PartialType(STATE_DTO),
STATUS_DTO
) { }
export class UpdateClientLocationsDTO extends IntersectionType(
SPID_DTO,
CLIENTLOCATIONID_DTO,
LOCATIONNAME_DTO,
ADDRESS1_DTO,
PartialType(ADDRESS2_DTO),
PartialType(CITY_DTO),
STATE_DTO,
ZIP_DTO,
COUNTRY_DTO,
USERID_DTO
) { }
export class CreateClientContactsDTO extends IntersectionType(
SPID_DTO,
CLIENTID_DTO,
CONTACTSTABLE_DTO,
DEFAULT_CONTACT_FLAG_DTO,
USERID_DTO
) { }
export class CreateClientLocationsDTO extends IntersectionType(
SPID_DTO,
CLIENTID_DTO,
CLIENTLOCADDRESSTABLE_DTO,
USERID_DTO
) { }
export class GetPreparerByClientidContactsByClientidLocByClientidDTO extends IntersectionType(
SPID_DTO,
CLIENTID_DTO
) { }

View File

@ -1 +1,117 @@
import { ApiProperty } from "@nestjs/swagger";
import { IsNumber, IsString } from "class-validator";
export class EFFDATE_DTO {
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
}
export class FEES_DTO {
@ApiProperty({ required: true })
@IsNumber()
P_FEES: number;
}
export class SPCLCOMMODITY_DTO {
@ApiProperty({ required: true })
@IsString()
P_SPCLCOMMODITY: string;
}
export class SPCLCOUNTRY_DTO {
@ApiProperty({ required: true })
@IsString()
P_SPCLCOUNTRY: string;
}
export class RATE_DTO {
@ApiProperty({ required: true })
@IsNumber()
P_RATE: number;
}
export class STARTSETS_DTO {
@ApiProperty({ required: true })
@IsNumber()
P_STARTSETS: number;
}
export class ENDSETS_DTO {
@ApiProperty({ required: true })
@IsNumber()
P_ENDSETS: number;
}
export class CUSTOMERTYPE_DTO {
@ApiProperty({ required: true })
@IsString()
P_CUSTOMERTYPE: string;
}
export class STARTTIME_DTO {
@ApiProperty({ required: true })
@IsNumber()
P_STARTTIME: number;
}
export class ENDTIME_DTO {
@ApiProperty({ required: true })
@IsNumber()
P_ENDTIME: number;
}
export class TIMEZONE_DTO {
@ApiProperty({ required: true })
@IsString()
P_TIMEZONE: string;
}
export class COMMRATE_DTO {
@ApiProperty({ required: true })
@IsNumber()
P_COMMRATE: number;
}
export class BASICFEESETUPID_DTO {
@ApiProperty({ required: true })
@IsNumber()
P_BASICFEESETUPID: number;
}
export class BONDRATESETUPID_DTO {
@ApiProperty({ required: true })
@IsNumber()
P_BONDRATESETUPID: number;
}
export class CARGORATESETUPID_DTO {
@ApiProperty({ required: true })
@IsNumber()
P_CARGORATESETUPID: number;
}
export class CFFEESETUPID_DTO {
@ApiProperty({ required: true })
@IsNumber()
P_CFFEESETUPID: number;
}
export class CSFEESETUPID_DTO {
@ApiProperty({ required: true })
@IsNumber()
P_CSFEESETUPID: number;
}
export class EFFEESETUPID_DTO {
@ApiProperty({ required: true })
@IsNumber()
P_EFFEESETUPID: number;
}
export class FEECOMMID_DTO {
@ApiProperty({ required: true })
@IsNumber()
P_FEECOMMID: number;
}

View File

@ -1,8 +1,137 @@
import { IntersectionType } from "@nestjs/swagger"; import { IntersectionType } from "@nestjs/swagger";
import { SPID_DTO } from "../sp/sp-property.dto"; import { SPID_DTO } from "../sp/sp-property.dto";
import { ACTIVE_INACTIVE_STATUS_DTO } from "../property.dto"; import { ACTIVE_INACTIVE_STATUS_DTO, DELIVERYTYPE_DTO, USERID_DTO } from "../property.dto";
import { CARNET_TYPE_DTO, END_NUMBER_DTO, START_NUMBER_DTO } from "../carnet/carnet-property.dto";
import { HOLDERTYPE_DTO } from "../holder/holder-property.dto";
import { USCIBMEMBERFLAG_DTO } from "../flag/flag-property.dto";
import { BASICFEESETUPID_DTO, BONDRATESETUPID_DTO, CARGORATESETUPID_DTO, CFFEESETUPID_DTO, COMMRATE_DTO, CSFEESETUPID_DTO, CUSTOMERTYPE_DTO, EFFDATE_DTO, EFFEESETUPID_DTO, ENDSETS_DTO, ENDTIME_DTO, FEECOMMID_DTO, FEES_DTO, RATE_DTO, SPCLCOMMODITY_DTO, SPCLCOUNTRY_DTO, STARTSETS_DTO, STARTTIME_DTO, TIMEZONE_DTO } from "./fee-property.dto";
import { PARAMID_DTO } from "../param-table/param-table-property.dto";
export class GetFeeGeneralDTO extends IntersectionType( export class GetFeeGeneralDTO extends IntersectionType(
SPID_DTO, SPID_DTO,
ACTIVE_INACTIVE_STATUS_DTO ACTIVE_INACTIVE_STATUS_DTO
) {} ) { }
export class CreateBasicFeeDTO extends IntersectionType(
SPID_DTO,
START_NUMBER_DTO,
END_NUMBER_DTO,
EFFDATE_DTO,
FEES_DTO,
USERID_DTO
) { }
export class CreateBondRateDTO extends IntersectionType(
SPID_DTO,
HOLDERTYPE_DTO,
USCIBMEMBERFLAG_DTO,
SPCLCOMMODITY_DTO,
SPCLCOUNTRY_DTO,
EFFDATE_DTO,
RATE_DTO,
USERID_DTO
) { }
export class CreateCargoRateDTO extends IntersectionType(
SPID_DTO,
CARNET_TYPE_DTO,
STARTSETS_DTO,
ENDSETS_DTO,
EFFDATE_DTO,
RATE_DTO,
USERID_DTO
) { }
export class CreateCfFeeDTO extends IntersectionType(
SPID_DTO,
STARTSETS_DTO,
ENDSETS_DTO,
EFFDATE_DTO,
CUSTOMERTYPE_DTO,
CARNET_TYPE_DTO,
RATE_DTO,
USERID_DTO
) { }
export class CreateCsFeeDTO extends IntersectionType(
SPID_DTO,
CUSTOMERTYPE_DTO,
CARNET_TYPE_DTO,
EFFDATE_DTO,
RATE_DTO,
USERID_DTO
) { }
export class CreateEfFeeDTO extends IntersectionType(
SPID_DTO,
CUSTOMERTYPE_DTO,
DELIVERYTYPE_DTO,
STARTTIME_DTO,
ENDTIME_DTO,
TIMEZONE_DTO,
EFFDATE_DTO,
FEES_DTO,
USERID_DTO
) { }
export class CreateFeeCommDTO extends IntersectionType(
SPID_DTO,
PARAMID_DTO,
COMMRATE_DTO,
EFFDATE_DTO,
USERID_DTO
) { }
export class UpdateBasicFeeDTO extends IntersectionType(
BASICFEESETUPID_DTO,
FEES_DTO,
EFFDATE_DTO,
USERID_DTO
) { }
export class UpdateBondRateDTO extends IntersectionType(
BONDRATESETUPID_DTO,
RATE_DTO,
EFFDATE_DTO,
USERID_DTO
) { }
export class UpdateCargoRateDTO extends IntersectionType(
CARGORATESETUPID_DTO,
RATE_DTO,
EFFDATE_DTO,
USERID_DTO
) { }
export class UpdateCfFeeDTO extends IntersectionType(
CFFEESETUPID_DTO,
RATE_DTO,
EFFDATE_DTO,
USERID_DTO
) { }
export class UpdateCsFeeDTO extends IntersectionType(
CSFEESETUPID_DTO,
RATE_DTO,
EFFDATE_DTO,
USERID_DTO
) { }
export class UpdateEfFeeDTO extends IntersectionType(
EFFEESETUPID_DTO,
FEES_DTO,
EFFDATE_DTO,
USERID_DTO
) { }
export class UpdateFeeCommDTO extends IntersectionType(
FEECOMMID_DTO,
RATE_DTO,
EFFDATE_DTO,
USERID_DTO
) { }
// export class UpdateFeeCommBodyDTO {
// @ApiProperty({ type: UpdateFeeCommDTO, required: true }) // Correctly reference UpdateFeeCommDTO
// p_fees_comm: UpdateFeeCommDTO; // No need for @IsObject()
// }

View File

@ -1,5 +1,5 @@
import { ApiProperty } from "@nestjs/swagger"; import { ApiProperty } from "@nestjs/swagger";
import { IsDefined, IsInt, IsNumber, Max, Min } from "class-validator"; import { IsDefined, IsInt, IsNumber, IsString, Length, Max, Min } from "class-validator";
export class CLIENTLOCATIONID_DTO { export class CLIENTLOCATIONID_DTO {
@ApiProperty({ required: true }) @ApiProperty({ required: true })
@ -12,3 +12,13 @@ export class CLIENTLOCATIONID_DTO {
@IsDefined({ message: 'Property P_CLIENTLOCATIONID is required' }) @IsDefined({ message: 'Property P_CLIENTLOCATIONID is required' })
P_CLIENTLOCATIONID: number; P_CLIENTLOCATIONID: number;
} }
export class LOCATIONNAME_DTO {
@ApiProperty({ required: true })
@Length(0, 50, {
message: 'Property P_LOCATIONNAME must be between 0 to 50 characters',
})
@IsString({ message: 'Property P_LOCATIONNAME must be a string' })
@IsDefined({ message: 'Property P_LOCATIONNAME is required' })
P_LOCATIONNAME: string;
}

View File

@ -224,7 +224,15 @@ export class CLIENT_CONTACTID_DTO {
} }
export class NAMEOF_DTO {
@ApiProperty({ required: true })
@Length(0, 50, {
message: 'Property Nameof must be between 0 to 50 characters',
})
@IsString({ message: 'Property Nameof must be a string' })
@IsDefined({ message: 'Property Nameof is required' })
P_NAMEOF: string;
}

View File

@ -1,7 +1,12 @@
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 { ApiTags } from '@nestjs/swagger'; import { ApiTags } from '@nestjs/swagger';
import { CreateClientContactsDTO, CreateClientDataDTO, CreateClientLocationsDTO, GetPreparerByClientidContactsByClientidLocByClientidDTO, GetPreparersDTO, UpdateClientContactsDTO, UpdateClientDTO, UpdateClientLocationsDTO } from 'src/oracle/manage-clients/manage-clients.dto';
import {
CreateClientContactsDTO, CreateClientDataDTO,
CreateClientLocationsDTO, GetPreparerByClientidContactsByClientidLocByClientidDTO,
GetPreparersDTO, UpdateClientContactsDTO, UpdateClientDTO, UpdateClientLocationsDTO
} from 'src/dto/client/client.dto';
@Controller('mssql') @Controller('mssql')
export class ManageClientsController { export class ManageClientsController {
@ -72,8 +77,4 @@ export class ManageClientsController {
) { ) {
return this.manageClientsService.GetPreparerLocByClientid(body); return this.manageClientsService.GetPreparerLocByClientid(body);
} }
} }

View File

@ -1,8 +1,12 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { Connection, Request } from 'mssql'; import { Connection, Request } from 'mssql';
import { MssqlDBService } from 'src/db/db.service'; import { MssqlDBService } from 'src/db/db.service';
import { CreateClientContactsDTO, CreateClientDataDTO, CreateClientLocationsDTO, GetPreparerByClientidContactsByClientidLocByClientidDTO, GetPreparersDTO, UpdateClientContactsDTO, UpdateClientDTO, UpdateClientLocationsDTO } from 'src/oracle/manage-clients/manage-clients.dto';
import * as mssql from 'mssql'; import * as mssql from 'mssql';
import {
CreateClientContactsDTO, CreateClientDataDTO,
CreateClientLocationsDTO, GetPreparerByClientidContactsByClientidLocByClientidDTO,
GetPreparersDTO, UpdateClientContactsDTO, UpdateClientDTO, UpdateClientLocationsDTO
} from 'src/dto/client/client.dto';
@Injectable() @Injectable()
export class ManageClientsService { export class ManageClientsService {
@ -10,18 +14,18 @@ export class ManageClientsService {
CreateClientData = async (body: CreateClientDataDTO) => { CreateClientData = async (body: CreateClientDataDTO) => {
const newBody = { const newBody = {
p_spid: null, P_SPID: null,
p_clientname: null, P_CLIENTNAME: null,
p_lookupcode: null, P_LOOKUPCODE: null,
p_address1: null, P_ADDRESS1: null,
p_address2: null, P_ADDRESS2: null,
p_city: null, P_CITY: null,
p_state: null, P_STATE: null,
p_zip: null, P_ZIP: null,
p_country: null, P_COUNTRY: null,
p_issuingregion: null, P_ISSUINGREGION: null,
p_revenuelocation: null, P_REVENUELOCATION: null,
p_userid: null, P_USERID: null,
p_contactstable: null, p_contactstable: null,
p_clientlocaddresstable: null, p_clientlocaddresstable: null,
}; };
@ -46,18 +50,18 @@ export class ManageClientsService {
try { try {
connection = await this.mssqlDBService.getConnection(); connection = await this.mssqlDBService.getConnection();
const request = new Request(connection); const request = new Request(connection);
request.input('p_spid', mssql.Int, finalBody.p_spid); request.input('P_SPID', mssql.Int, finalBody.P_SPID);
request.input('p_clientname', mssql.VarChar(50), finalBody.p_clientname); request.input('P_CLIENTNAME', mssql.VarChar(50), finalBody.P_CLIENTNAME);
request.input('p_lookupcode', mssql.VarChar(20), finalBody.p_lookupcode); request.input('P_LOOKUPCODE', mssql.VarChar(20), finalBody.P_LOOKUPCODE);
request.input('p_address1', mssql.VarChar(50), finalBody.p_address1); request.input('P_ADDRESS1', mssql.VarChar(50), finalBody.P_ADDRESS1);
request.input('p_address2', mssql.VarChar(50), finalBody.p_address2); request.input('P_ADDRESS2', mssql.VarChar(50), finalBody.P_ADDRESS2);
request.input('p_city', mssql.VarChar(30), finalBody.p_city); request.input('P_CITY', mssql.VarChar(30), finalBody.P_CITY);
request.input('p_state', mssql.VarChar(2), finalBody.p_state); request.input('P_STATE', mssql.VarChar(2), finalBody.P_STATE);
request.input('p_zip', mssql.VarChar(10), finalBody.p_zip); request.input('P_ZIP', mssql.VarChar(10), finalBody.P_ZIP);
request.input('p_country', mssql.VarChar(2), finalBody.p_country); request.input('P_COUNTRY', mssql.VarChar(2), finalBody.P_COUNTRY);
request.input('p_issuingregion', mssql.VarChar(2), finalBody.p_issuingregion); request.input('P_ISSUINGREGION', mssql.VarChar(2), finalBody.P_ISSUINGREGION);
request.input('p_revenuelocation', mssql.VarChar(2), finalBody.p_revenuelocation); request.input('P_REVENUELOCATION', mssql.VarChar(2), finalBody.P_REVENUELOCATION);
request.input('p_userid', mssql.VarChar(100), finalBody.p_userid); request.input('P_USERID', mssql.VarChar(100), finalBody.P_USERID);
const contactTable = new mssql.Table('carnetsys.ContactsTable'); const contactTable = new mssql.Table('carnetsys.ContactsTable');
contactTable.create = true; contactTable.create = true;
@ -70,19 +74,6 @@ export class ManageClientsService {
contactTable.columns.add('MobileNo', mssql.VarChar(20)); contactTable.columns.add('MobileNo', mssql.VarChar(20));
contactTable.columns.add('FaxNo', mssql.VarChar(20)); contactTable.columns.add('FaxNo', mssql.VarChar(20));
// finalBody.p_contactstable.forEach((contact) => {
// contactTable.rows.add(
// contact.FirstName,
// contact.LastName,
// contact.MiddleInitial,
// contact.Title,
// contact.EmailAddress,
// contact.PhoneNo,
// contact.MobileNo,
// contact.FaxNo,
// );
// });
request.input('p_contactstable', contactTable); request.input('p_contactstable', contactTable);
const clientLocAddressTable = new mssql.Table('carnetsys.ClientLocAddressTable'); const clientLocAddressTable = new mssql.Table('carnetsys.ClientLocAddressTable');
@ -95,18 +86,6 @@ export class ManageClientsService {
clientLocAddressTable.columns.add('Zip', mssql.VarChar(10)); clientLocAddressTable.columns.add('Zip', mssql.VarChar(10));
clientLocAddressTable.columns.add('Country', mssql.VarChar(2)); clientLocAddressTable.columns.add('Country', mssql.VarChar(2));
// finalBody.p_clientlocaddresstable.forEach((contact) => {
// clientLocAddressTable.rows.add(
// contact.Nameof,
// contact.Address1,
// contact.Address2,
// contact.City,
// contact.State,
// contact.Zip,
// contact.Country,
// );
// });
request.input('p_clientlocaddresstable', clientLocAddressTable); request.input('p_clientlocaddresstable', clientLocAddressTable);
const result = await request.execute('carnetsys.CreateClientData'); const result = await request.execute('carnetsys.CreateClientData');
@ -122,8 +101,8 @@ export class ManageClientsService {
try { try {
connection = await this.mssqlDBService.getConnection(); connection = await this.mssqlDBService.getConnection();
const request = new Request(connection); const request = new Request(connection);
request.input('p_spid', mssql.Int, body.p_spid); request.input('P_SPID', mssql.Int, body.P_SPID);
request.input('p_clientid', mssql.Int, body.p_clientid); request.input('P_CLIENTID', mssql.Int, body.P_CLIENTID);
const result = await request.execute('carnetsys.GetPreparerbyClientID'); const result = await request.execute('carnetsys.GetPreparerbyClientID');
return { data: result.recordset }; return { data: result.recordset };
} catch (error) { } catch (error) {
@ -133,17 +112,17 @@ export class ManageClientsService {
UpdateClient = async (body: UpdateClientDTO) => { UpdateClient = async (body: UpdateClientDTO) => {
const newBody = { const newBody = {
p_spid: null, P_SPID: null,
p_clientid: null, P_CLIENTID: null,
p_preparername: null, P_PREPARERNAME: null,
p_address1: null, P_ADDRESS1: null,
p_address2: null, P_ADDRESS2: null,
p_city: null, P_CITY: null,
p_state: null, P_STATE: null,
p_zip: null, P_ZIP: null,
p_country: null, P_COUNTRY: null,
p_revenuelocation: null, P_REVENUELOCATION: null,
p_userid: null, P_USERID: null,
}; };
const reqBody = JSON.parse(JSON.stringify(body)); const reqBody = JSON.parse(JSON.stringify(body));
@ -167,17 +146,17 @@ export class ManageClientsService {
try { try {
connection = await this.mssqlDBService.getConnection(); connection = await this.mssqlDBService.getConnection();
const request = new Request(connection); const request = new Request(connection);
request.input('p_spid', mssql.Int, finalBody.p_spid); request.input('P_SPID', mssql.Int, finalBody.P_SPID);
request.input('p_clientid', mssql.Int, finalBody.p_clientid); request.input('P_CLIENTID', mssql.Int, finalBody.P_CLIENTID);
request.input('p_preparername', mssql.VarChar(50), finalBody.p_preparername); request.input('P_PREPARERNAME', mssql.VarChar(50), finalBody.P_PREPARERNAME);
request.input('p_address1', mssql.VarChar(50), finalBody.p_address1); request.input('P_ADDRESS1', mssql.VarChar(50), finalBody.P_ADDRESS1);
request.input('p_address2', mssql.VarChar(50), finalBody.p_address2); request.input('P_ADDRESS2', mssql.VarChar(50), finalBody.P_ADDRESS2);
request.input('p_city', mssql.VarChar(30), finalBody.p_city); request.input('P_CITY', mssql.VarChar(30), finalBody.P_CITY);
request.input('p_state', mssql.VarChar(2), finalBody.p_state); request.input('P_STATE', mssql.VarChar(2), finalBody.P_STATE);
request.input('p_zip', mssql.VarChar(10), finalBody.p_zip); request.input('P_ZIP', mssql.VarChar(10), finalBody.P_ZIP);
request.input('p_country', mssql.VarChar(2), finalBody.p_country); request.input('P_COUNTRY', mssql.VarChar(2), finalBody.P_COUNTRY);
request.input('p_revenuelocation', mssql.VarChar(2), finalBody.p_revenuelocation); request.input('P_REVENUELOCATION', mssql.VarChar(2), finalBody.P_REVENUELOCATION);
request.input('p_userid', mssql.VarChar(100), finalBody.p_userid); request.input('P_USERID', mssql.VarChar(100), finalBody.P_USERID);
const result = await request.execute('carnetsys.UpdateClient'); const result = await request.execute('carnetsys.UpdateClient');
@ -190,11 +169,11 @@ export class ManageClientsService {
CreateClientContact = async (body: CreateClientContactsDTO) => { CreateClientContact = async (body: CreateClientContactsDTO) => {
const newBody = { const newBody = {
p_spid: null, P_SPID: null,
p_clientid: null, P_CLIENTID: null,
p_contactstable: null, p_contactstable: null,
p_defcontactflag: null, P_DEFCONTACTFLAG: null,
p_userid: null, P_USERID: null,
}; };
const reqBody = JSON.parse(JSON.stringify(body)); const reqBody = JSON.parse(JSON.stringify(body));
@ -220,8 +199,8 @@ export class ManageClientsService {
try { try {
connection = await this.mssqlDBService.getConnection(); connection = await this.mssqlDBService.getConnection();
const request = new Request(connection); const request = new Request(connection);
request.input('p_spid', mssql.Int, finalBody.p_spid); request.input('P_SPID', mssql.Int, finalBody.P_SPID);
request.input('p_clientid', mssql.Int, finalBody.p_clientid); request.input('P_CLIENTID', mssql.Int, finalBody.P_CLIENTID);
const contactTable = new mssql.Table('carnetsys.ContactsTable'); const contactTable = new mssql.Table('carnetsys.ContactsTable');
contactTable.create = true; contactTable.create = true;
@ -234,7 +213,7 @@ export class ManageClientsService {
contactTable.columns.add('MobileNo', mssql.VarChar(20)); contactTable.columns.add('MobileNo', mssql.VarChar(20));
contactTable.columns.add('FaxNo', mssql.VarChar(20)); contactTable.columns.add('FaxNo', mssql.VarChar(20));
finalBody.p_contactstable.forEach((contact) => { finalBody.P_CONTACTSTABLE.forEach((contact) => {
contactTable.rows.add( contactTable.rows.add(
contact.P_FIRSTNAME, contact.P_FIRSTNAME,
contact.P_LASTNAME, contact.P_LASTNAME,
@ -249,8 +228,8 @@ export class ManageClientsService {
request.input('p_contactstable', contactTable); request.input('p_contactstable', contactTable);
request.input('p_defcontactflag', mssql.VarChar(1), finalBody.p_defcontactflag); request.input('P_DEFCONTACTFLAG', mssql.VarChar(1), finalBody.P_DEFCONTACTFLAG);
request.input('p_userid', mssql.VarChar(100), finalBody.p_userid); request.input('P_USERID', mssql.VarChar(100), finalBody.P_USERID);
const result = await request.execute('carnetsys.CreateClientContact'); const result = await request.execute('carnetsys.CreateClientContact');
@ -263,17 +242,17 @@ export class ManageClientsService {
UpdateClientContacts = async (body: UpdateClientContactsDTO) => { UpdateClientContacts = async (body: UpdateClientContactsDTO) => {
const newBody = { const newBody = {
p_spid: null, P_SPID: null,
p_clientcontactid: null, P_CLIENTCONTACTID: null,
p_firstname: null, P_FIRSTNAME: null,
p_lastname: null, P_LASTNAME: null,
p_middleinitial: null, P_MIDDLEINITIAL: null,
p_title: null, P_TITLE: null,
p_phone: null, P_PHONENO: null,
p_fax: null, P_FAXNO: null,
p_mobileno: null, P_MOBILENO: null,
p_emailaddress: null, P_EMAILADDRESS: null,
p_userid: null, P_USERID: null,
}; };
const reqBody = JSON.parse(JSON.stringify(body)); const reqBody = JSON.parse(JSON.stringify(body));
@ -296,17 +275,17 @@ export class ManageClientsService {
try { try {
connection = await this.mssqlDBService.getConnection(); connection = await this.mssqlDBService.getConnection();
const request = new Request(connection); const request = new Request(connection);
request.input('p_spid', mssql.Int, finalBody.p_spid); request.input('P_SPID', mssql.Int, finalBody.P_SPID);
request.input('p_clientcontactid', mssql.Int, finalBody.p_clientcontactid); request.input('P_CLIENTCONTACTID', mssql.Int, finalBody.P_CLIENTCONTACTID);
request.input('p_firstname', mssql.VarChar(50), finalBody.p_firstname); request.input('P_FIRSTNAME', mssql.VarChar(50), finalBody.P_FIRSTNAME);
request.input('p_lastname', mssql.VarChar(50), finalBody.p_lastname); request.input('P_LASTNAME', mssql.VarChar(50), finalBody.P_LASTNAME);
request.input('p_middleinitial', mssql.VarChar(3), finalBody.p_middleinitial); request.input('P_MIDDLEINITIAL', mssql.VarChar(3), finalBody.P_MIDDLEINITIAL);
request.input('p_title', mssql.VarChar(50), finalBody.p_title); request.input('P_TITLE', mssql.VarChar(50), finalBody.P_TITLE);
request.input('p_phone', mssql.VarChar(20), finalBody.p_phone); request.input('P_PHONENO', mssql.VarChar(20), finalBody.P_PHONENO);
request.input('p_fax', mssql.VarChar(20), finalBody.p_fax); request.input('P_FAXNO', mssql.VarChar(20), finalBody.P_FAXNO);
request.input('p_mobileno', mssql.VarChar(20), finalBody.p_mobileno); request.input('P_MOBILENO', mssql.VarChar(20), finalBody.P_MOBILENO);
request.input('p_emailaddress', mssql.VarChar(100), finalBody.p_emailaddress); request.input('P_EMAILADDRESS', mssql.VarChar(100), finalBody.P_EMAILADDRESS);
request.input('p_userid', mssql.VarChar(100), finalBody.p_userid); request.input('P_USERID', mssql.VarChar(100), finalBody.P_USERID);
const result = await request.execute('carnetsys.UpdateClientContacts'); const result = await request.execute('carnetsys.UpdateClientContacts');
return { data: result.recordset }; return { data: result.recordset };
@ -319,16 +298,16 @@ export class ManageClientsService {
UpdateClientLocations = async (body: UpdateClientLocationsDTO) => { UpdateClientLocations = async (body: UpdateClientLocationsDTO) => {
const newBody = { const newBody = {
p_spid: null, P_SPID: null,
p_clientlocationid: null, P_CLIENTLOCATIONID: null,
p_lcoationname: null, P_LOCATIONNAME: null,
p_address1: null, P_ADDRESS1: null,
p_address2: null, P_ADDRESS2: null,
p_city: null, P_CITY: null,
p_state: null, P_STATE: null,
p_zip: null, P_ZIP: null,
p_country: null, P_COUNTRY: null,
p_userid: null, P_USERID: null,
}; };
const reqBody = JSON.parse(JSON.stringify(body)); const reqBody = JSON.parse(JSON.stringify(body));
@ -351,16 +330,16 @@ export class ManageClientsService {
try { try {
connection = await this.mssqlDBService.getConnection(); connection = await this.mssqlDBService.getConnection();
const request = new Request(connection); const request = new Request(connection);
request.input('p_spid', mssql.Int, finalBody.p_spid); request.input('P_SPID', mssql.Int, finalBody.P_SPID);
request.input('p_clientlocationid', mssql.Int, finalBody.p_clientlocationid); request.input('P_CLIENTLOCATIONID', mssql.Int, finalBody.P_CLIENTLOCATIONID);
request.input('p_lcoationname', mssql.VarChar(50), finalBody.p_lcoationname); request.input('P_LOCATIONNAME', mssql.VarChar(50), finalBody.P_LOCATIONNAME);
request.input('p_address1', mssql.VarChar(50), finalBody.p_address1); request.input('P_ADDRESS1', mssql.VarChar(50), finalBody.P_ADDRESS1);
request.input('p_address2', mssql.VarChar(50), finalBody.p_address2); request.input('P_ADDRESS2', mssql.VarChar(50), finalBody.P_ADDRESS2);
request.input('p_city', mssql.VarChar(30), finalBody.p_city); request.input('P_CITY', mssql.VarChar(30), finalBody.P_CITY);
request.input('p_state', mssql.VarChar(2), finalBody.p_state); request.input('P_STATE', mssql.VarChar(2), finalBody.P_STATE);
request.input('p_zip', mssql.VarChar(10), finalBody.p_zip); request.input('P_ZIP', mssql.VarChar(10), finalBody.P_ZIP);
request.input('p_country', mssql.VarChar(2), finalBody.p_country); request.input('P_COUNTRY', mssql.VarChar(2), finalBody.P_COUNTRY);
request.input('p_userid', mssql.VarChar(100), finalBody.p_userid); request.input('P_USERID', mssql.VarChar(100), finalBody.P_USERID);
const result = await request.execute('carnetsys.UpdateClientlocations'); const result = await request.execute('carnetsys.UpdateClientlocations');
return { data: result.recordset }; return { data: result.recordset };
@ -373,11 +352,11 @@ export class ManageClientsService {
CreateClientLocation = async (body: CreateClientLocationsDTO) => { CreateClientLocation = async (body: CreateClientLocationsDTO) => {
const newBody = { const newBody = {
p_spid: null, P_SPID: null,
p_clientid: null, P_CLIENTID: null,
p_clientlocaddresstable: null, p_clientlocaddresstable: null,
p_defcontactflag: null, P_DEFCONTACTFLAG: null,
p_userid: null, P_USERID: null,
}; };
const reqBody = JSON.parse(JSON.stringify(body)); const reqBody = JSON.parse(JSON.stringify(body));
@ -403,8 +382,8 @@ export class ManageClientsService {
try { try {
connection = await this.mssqlDBService.getConnection(); connection = await this.mssqlDBService.getConnection();
const request = new Request(connection); const request = new Request(connection);
request.input('p_spid', mssql.Int, finalBody.p_spid); request.input('P_SPID', mssql.Int, finalBody.P_SPID);
request.input('p_clientid', mssql.Int, finalBody.p_clientid); request.input('P_CLIENTID', mssql.Int, finalBody.P_CLIENTID);
const clientLocAddressTable = new mssql.Table('carnetsys.ClientLocAddressTable'); const clientLocAddressTable = new mssql.Table('carnetsys.ClientLocAddressTable');
@ -417,21 +396,21 @@ export class ManageClientsService {
clientLocAddressTable.columns.add('Zip', mssql.VarChar(10)); clientLocAddressTable.columns.add('Zip', mssql.VarChar(10));
clientLocAddressTable.columns.add('Country', mssql.VarChar(2)); clientLocAddressTable.columns.add('Country', mssql.VarChar(2));
finalBody.p_clientlocaddresstable.forEach((contact) => { finalBody.P_CLIENTLOCADDRESSTABLE.forEach((contact) => {
clientLocAddressTable.rows.add( clientLocAddressTable.rows.add(
contact.Nameof, contact.P_NAMEOF,
contact.Address1, contact.P_ADDRESS1,
contact.Address2, contact.P_ADDRESS2,
contact.City, contact.P_CITY,
contact.State, contact.P_STATE,
contact.Zip, contact.P_ZIP,
contact.Country, contact.P_COUNTRY,
); );
}); });
request.input('p_clientlocaddresstable', clientLocAddressTable); request.input('p_clientlocaddresstable', clientLocAddressTable);
request.input('p_userid', mssql.VarChar(100), finalBody.p_userid); request.input('P_USERID', mssql.VarChar(100), finalBody.P_USERID);
const result = await request.execute('carnetsys.CreateClientLocation'); const result = await request.execute('carnetsys.CreateClientLocation');
return { data: result.recordset }; return { data: result.recordset };
@ -445,12 +424,12 @@ export class ManageClientsService {
GetPreparers = async (body: GetPreparersDTO) => { GetPreparers = async (body: GetPreparersDTO) => {
const newBody = { const newBody = {
p_spid: null, P_SPID: null,
p_name: null, P_NAME: null,
p_lookupcode: null, P_LOOKUPCODE: null,
p_city: null, P_CITY: null,
p_state: null, P_STATE: null,
p_status: null P_STATUS: null
}; };
const reqBody = JSON.parse(JSON.stringify(body)); const reqBody = JSON.parse(JSON.stringify(body));
@ -476,12 +455,12 @@ export class ManageClientsService {
try { try {
connection = await this.mssqlDBService.getConnection(); connection = await this.mssqlDBService.getConnection();
const request = new Request(connection); const request = new Request(connection);
request.input('p_spid', mssql.Int, finalBody.p_spid); request.input('P_SPID', mssql.Int, finalBody.P_SPID);
request.input('p_name', mssql.VarChar(50), finalBody.p_name); request.input('P_NAME', mssql.VarChar(50), finalBody.P_NAME);
request.input('p_lookupcode', mssql.VarChar(30), finalBody.p_lookupcode); request.input('P_LOOKUPCODE', mssql.VarChar(30), finalBody.P_LOOKUPCODE);
request.input('p_city', mssql.VarChar(20), finalBody.p_city); request.input('P_CITY', mssql.VarChar(20), finalBody.P_CITY);
request.input('p_state', mssql.VarChar(2), finalBody.p_state); request.input('P_STATE', mssql.VarChar(2), finalBody.P_STATE);
request.input('p_status', mssql.VarChar(10), finalBody.p_status); request.input('P_STATUS', mssql.VarChar(10), finalBody.P_STATUS);
const result = await request.execute('carnetsys.GetPreparers'); const result = await request.execute('carnetsys.GetPreparers');
return { data: result.recordset }; return { data: result.recordset };
@ -498,12 +477,12 @@ export class ManageClientsService {
) => { ) => {
const newBody = { const newBody = {
p_spid: null, P_SPID: null,
p_name: null, P_NAME: null,
p_lookupcode: null, P_LOOKUPCODE: null,
p_city: null, P_CITY: null,
p_state: null, P_STATE: null,
p_status: null P_STATUS: null
}; };
const reqBody = JSON.parse(JSON.stringify(body)); const reqBody = JSON.parse(JSON.stringify(body));
@ -529,8 +508,8 @@ export class ManageClientsService {
try { try {
connection = await this.mssqlDBService.getConnection(); connection = await this.mssqlDBService.getConnection();
const request = new Request(connection); const request = new Request(connection);
request.input('p_spid', mssql.Int, finalBody.p_spid); request.input('P_SPID', mssql.Int, finalBody.P_SPID);
request.input('p_clientid', mssql.Int, finalBody.p_clientid); request.input('P_CLIENTID', mssql.Int, finalBody.P_CLIENTID);
const result = await request.execute('carnetsys.GetPreparerContactsbyClientID'); const result = await request.execute('carnetsys.GetPreparerContactsbyClientID');
return { data: result.recordset }; return { data: result.recordset };
@ -546,12 +525,12 @@ export class ManageClientsService {
body: GetPreparerByClientidContactsByClientidLocByClientidDTO, body: GetPreparerByClientidContactsByClientidLocByClientidDTO,
) => { ) => {
const newBody = { const newBody = {
p_spid: null, P_SPID: null,
p_name: null, P_NAME: null,
p_lookupcode: null, P_LOOKUPCODE: null,
p_city: null, P_CITY: null,
p_state: null, P_STATE: null,
p_status: null P_STATUS: null
}; };
const reqBody = JSON.parse(JSON.stringify(body)); const reqBody = JSON.parse(JSON.stringify(body));
@ -577,8 +556,8 @@ export class ManageClientsService {
try { try {
connection = await this.mssqlDBService.getConnection(); connection = await this.mssqlDBService.getConnection();
const request = new Request(connection); const request = new Request(connection);
request.input('p_spid', mssql.Int, finalBody.p_spid); request.input('P_SPID', mssql.Int, finalBody.P_SPID);
request.input('p_clientid', mssql.Int, finalBody.p_clientid); request.input('P_CLIENTID', mssql.Int, finalBody.P_CLIENTID);
const result = await request.execute('carnetsys.GetPreparerLocbyClientID'); const result = await request.execute('carnetsys.GetPreparerLocbyClientID');
return { data: result.recordset }; return { data: result.recordset };

View File

@ -1,8 +1,11 @@
import { Body, Controller, Get, 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 { CreateBasicFeeDTO, CreateBondRateDTO, CreateCargoRateDTO, CreateCfFeeDTO, CreateCsFeeDTO, CreateEfFeeDTO, CreateFeeCommDTO, UpdateBasicFeeDTO, UpdateBondRateDTO, UpdateCargoRateDTO, UpdateCfFeeDTO, UpdateCsFeeDTO, UpdateEfFeeDTO, UpdateFeeCommDTO } from 'src/oracle/manage-fee/manage-fee.dto';
import { ApiTags } from '@nestjs/swagger'; import { ApiTags } from '@nestjs/swagger';
import { GetFeeGeneralDTO } from 'src/dto/fee/fee.dto'; import {
CreateBasicFeeDTO, CreateBondRateDTO, CreateCargoRateDTO, CreateCfFeeDTO, CreateCsFeeDTO,
CreateEfFeeDTO, CreateFeeCommDTO, GetFeeGeneralDTO, UpdateBasicFeeDTO, UpdateBondRateDTO,
UpdateCargoRateDTO, UpdateCfFeeDTO, UpdateCsFeeDTO, UpdateEfFeeDTO, UpdateFeeCommDTO
} from 'src/dto/fee/fee.dto';
@Controller('mssql') @Controller('mssql')
export class ManageFeeController { export class ManageFeeController {

View File

@ -1,11 +1,14 @@
import { Injectable, Logger } from '@nestjs/common'; import { Injectable, Logger } from '@nestjs/common';
import { MssqlDBService } from 'src/db/db.service'; import { MssqlDBService } from 'src/db/db.service';
import { InternalServerException } from 'src/exceptions/internalServerError.exception'; import { InternalServerException } from 'src/exceptions/internalServerError.exception';
import { CreateBasicFeeDTO, CreateBondRateDTO, CreateCargoRateDTO, CreateCfFeeDTO, CreateCsFeeDTO, CreateEfFeeDTO, CreateFeeCommDTO, UpdateBasicFeeDTO, UpdateBondRateDTO, UpdateCargoRateDTO, UpdateCfFeeDTO, UpdateCsFeeDTO, UpdateEfFeeDTO, UpdateFeeCommDTO } from 'src/oracle/manage-fee/manage-fee.dto';
import { BadRequestException } from 'src/exceptions/badRequest.exception'; import { BadRequestException } from 'src/exceptions/badRequest.exception';
import { Connection, Request } from 'mssql'; import { Connection, Request } from 'mssql';
import * as mssql from 'mssql'; import * as mssql from 'mssql';
import { GetFeeGeneralDTO } from 'src/dto/fee/fee.dto'; import {
CreateBasicFeeDTO, CreateBondRateDTO, CreateCargoRateDTO, CreateCfFeeDTO, CreateCsFeeDTO,
CreateEfFeeDTO, CreateFeeCommDTO, GetFeeGeneralDTO, UpdateBasicFeeDTO, UpdateBondRateDTO,
UpdateCargoRateDTO, UpdateCfFeeDTO, UpdateCsFeeDTO, UpdateEfFeeDTO, UpdateFeeCommDTO
} from 'src/dto/fee/fee.dto';
@Injectable() @Injectable()
export class ManageFeeService { export class ManageFeeService {
@ -43,8 +46,8 @@ export class ManageFeeService {
connection = await this.mssqlDBService.getConnection(); connection = await this.mssqlDBService.getConnection();
const request = new Request(connection); const request = new Request(connection);
request.input('P_SPID', mssql.Int, body.P_SPID); request.input('P_SPID', mssql.Int, body.P_SPID);
request.input('P_STARTCARNETVALUE', mssql.Int, body.P_STARTCARNETVALUE); request.input('P_STARTCARNETVALUE', mssql.Int, body.P_STARTNUMBER);
request.input('P_ENDCARNETVALUE', mssql.Int, body.P_ENDCARNETVALUE); request.input('P_ENDCARNETVALUE', mssql.Int, body.P_ENDNUMBER);
request.input('P_EFFDATE', mssql.VarChar(100), body.P_EFFDATE); request.input('P_EFFDATE', mssql.VarChar(100), body.P_EFFDATE);
request.input('P_FEES', mssql.Int, body.P_FEES); request.input('P_FEES', mssql.Int, body.P_FEES);
request.input('P_USERID', mssql.VarChar(100), body.P_USERID); request.input('P_USERID', mssql.VarChar(100), body.P_USERID);

View File

@ -270,7 +270,7 @@ export class CarnetApplicationService {
); );
END;`, END;`,
{ {
P_USERID: { val: body.p_userid, type: oracledb.DB_TYPE_NUMBER }, P_USERID: { val: body.P_USERID, type: oracledb.DB_TYPE_NUMBER },
P_HEADERID: { val: body.P_HEADERID, type: oracledb.DB_TYPE_NUMBER }, P_HEADERID: { val: body.P_HEADERID, type: oracledb.DB_TYPE_NUMBER },
P_CURSOR: { dir: oracledb.BIND_OUT, type: oracledb.CURSOR }, P_CURSOR: { dir: oracledb.BIND_OUT, type: oracledb.CURSOR },
// P_CURSOR: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT } // P_CURSOR: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT }
@ -305,7 +305,7 @@ export class CarnetApplicationService {
); );
END;`, END;`,
{ {
P_USERID: { val: body.p_userid, type: oracledb.DB_TYPE_NUMBER }, P_USERID: { val: body.P_USERID, type: oracledb.DB_TYPE_NUMBER },
P_HEADERID: { val: body.P_HEADERID, type: oracledb.DB_TYPE_NUMBER }, P_HEADERID: { val: body.P_HEADERID, type: oracledb.DB_TYPE_NUMBER },
P_CURSOR: { dir: oracledb.BIND_OUT, type: oracledb.CURSOR }, P_CURSOR: { dir: oracledb.BIND_OUT, type: oracledb.CURSOR },
// P_CURSOR: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT } // P_CURSOR: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT }
@ -340,7 +340,7 @@ export class CarnetApplicationService {
); );
END;`, END;`,
{ {
P_USERID: { val: body.p_userid, type: oracledb.DB_TYPE_NUMBER }, P_USERID: { val: body.P_USERID, type: oracledb.DB_TYPE_NUMBER },
P_HEADERID: { val: body.P_HEADERID, type: oracledb.DB_TYPE_NUMBER }, P_HEADERID: { val: body.P_HEADERID, type: oracledb.DB_TYPE_NUMBER },
P_CURSOR: { dir: oracledb.BIND_OUT, type: oracledb.CURSOR }, P_CURSOR: { dir: oracledb.BIND_OUT, type: oracledb.CURSOR },
// P_CURSOR: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT } // P_CURSOR: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT }
@ -375,7 +375,7 @@ export class CarnetApplicationService {
); );
END;`, END;`,
{ {
P_USERID: { val: body.p_userid, type: oracledb.DB_TYPE_NUMBER }, P_USERID: { val: body.P_USERID, type: oracledb.DB_TYPE_NUMBER },
P_HEADERID: { val: body.P_HEADERID, type: oracledb.DB_TYPE_NUMBER }, P_HEADERID: { val: body.P_HEADERID, type: oracledb.DB_TYPE_NUMBER },
P_CURSOR: { dir: oracledb.BIND_OUT, type: oracledb.CURSOR }, P_CURSOR: { dir: oracledb.BIND_OUT, type: oracledb.CURSOR },
// P_CURSOR: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT } // P_CURSOR: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT }
@ -410,7 +410,7 @@ export class CarnetApplicationService {
); );
END;`, END;`,
{ {
P_USERID: { val: body.p_userid, type: oracledb.DB_TYPE_NUMBER }, P_USERID: { val: body.P_USERID, type: oracledb.DB_TYPE_NUMBER },
P_HEADERID: { val: body.P_HEADERID, type: oracledb.DB_TYPE_NUMBER }, P_HEADERID: { val: body.P_HEADERID, type: oracledb.DB_TYPE_NUMBER },
P_CURSOR: { dir: oracledb.BIND_OUT, type: oracledb.CURSOR }, P_CURSOR: { dir: oracledb.BIND_OUT, type: oracledb.CURSOR },
// P_CURSOR: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT } // P_CURSOR: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT }

View File

@ -11,11 +11,9 @@ import {
import { HomePageService } from './home-page.service'; import { HomePageService } from './home-page.service';
import { ApiTags } from '@nestjs/swagger'; import { ApiTags } from '@nestjs/swagger';
import { import { SPID_DTO } from 'src/dto/sp/sp-property.dto';
SaveCarnetApplicationDTO, import { GetCarnetDetailsbyCarnetStatusDTO } from 'src/dto/carnet/carnet.dto';
TransmitApplicationtoProcessDTO, import { EMAIL_DTO, USERID_DTO } from 'src/dto/property.dto';
GetCarnetDetailsbyCarnetStatusDTO,
} from './home-page.dto';
@ApiTags('HomePage - Oracle') @ApiTags('HomePage - Oracle')
@Controller('oracle') @Controller('oracle')
@ -23,58 +21,32 @@ export class HomePageController {
constructor(private readonly homePageService: HomePageService) { } constructor(private readonly homePageService: HomePageService) { }
@Get('GetHomePageData/:id') @Get('GetHomePageData/:P_SPID')
GetHomePageData(@Param('id', ParseIntPipe) id: number) { GetHomePageData(@Param() params: SPID_DTO) {
return this.homePageService.GetHomePageData(id); return this.homePageService.GetHomePageData(params);
} }
@Get('GetCarnetSummaryData/:userid') @Get('GetCarnetSummaryData/:P_EMAILADDR')
GetCarnetSummaryData(@Param('userid') id: string) { GetCarnetSummaryData(@Param() params: EMAIL_DTO) {
return this.homePageService.GetCarnetSummaryData(id); return this.homePageService.GetCarnetSummaryData(params);
} }
@Get('GetCarnetDetailsbyCarnetStatus/:p_spid/:p_userid/:p_CarnetStatus') @Get('GetCarnetDetailsbyCarnetStatus/:P_SPID/:P_USERID/:P_CARNETSTATUS')
GetCarnetDetailsbyCarnetStatus( GetCarnetDetailsbyCarnetStatus(@Param() params: GetCarnetDetailsbyCarnetStatusDTO) {
@Param('p_spid', ParseIntPipe) p_spid: number, return this.homePageService.GetCarnetDetailsbyCarnetStatus(params);
@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,
});
}
} }
// NOTE : this has been moved to carent-application module // NOTE : this has been moved to carent-application module
// @Post('/oracle/SaveCarnetApplication') // @Post('/oracle/SaveCarnetApplication')
SaveCarnetApplication(@Body() body: SaveCarnetApplicationDTO) { // SaveCarnetApplication(@Body() body: SaveCarnetApplicationDTO) {
return this.homePageService.SaveCarnetApplication(body); // return this.homePageService.SaveCarnetApplication(body);
} // }
// NOTE : this has been moved to carent-application module // NOTE : this has been moved to carent-application module
// @Post('/oracle/TransmitApplicationtoProcess') // @Post('/oracle/TransmitApplicationtoProcess')
TransmitApplicationtoProcess(@Body() body: TransmitApplicationtoProcessDTO) { // TransmitApplicationtoProcess(@Body() body: TransmitApplicationtoProcessDTO) {
return this.homePageService.TransmitApplicationtoProcess(body); // return this.homePageService.TransmitApplicationtoProcess(body);
} // }
} }

View File

@ -13,351 +13,351 @@ import {
ValidateNested, ValidateNested,
} from 'class-validator'; } 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, { // @Length(0, 1000, {
message: 'Property ItemDescription must be between 1 and 1000 characters', // message: 'Property ItemDescription must be between 1 and 1000 characters',
}) // })
@IsString({ message: 'Property ItemDescription should be string' }) // @IsString({ message: 'Property ItemDescription should be string' })
@IsDefined({ message: 'Property ItemDescription is required' }) // @IsDefined({ message: 'Property ItemDescription is required' })
ItemDescription: string; // ItemDescription: string;
@ApiProperty({ required: true }) // @ApiProperty({ required: true })
@IsNumber({}, { message: 'Property ItemValue should be number' }) // @IsNumber({}, { message: 'Property ItemValue should be number' })
@IsDefined({ message: 'Property ItemValue is required' }) // @IsDefined({ message: 'Property ItemValue is required' })
ItemValue: number; // ItemValue: number;
@ApiProperty({ required: true }) // @ApiProperty({ required: true })
@Max(99999999999, { // @Max(99999999999, {
message: 'Property Noofpieces must not exceed 99999999999', // message: 'Property Noofpieces must not exceed 99999999999',
}) // })
@Min(0, { message: 'Property Noofpieces must be at least 0 or more' }) // @Min(0, { message: 'Property Noofpieces must be at least 0 or more' })
@IsInt() // @IsInt()
@IsNumber({}, { message: 'Property Noofpieces must be a number' }) // @IsNumber({}, { message: 'Property Noofpieces must be a number' })
@IsDefined({ message: 'Property Noofpieces is required' }) // @IsDefined({ message: 'Property Noofpieces is required' })
Noofpieces: number; // Noofpieces: number;
@ApiProperty({ required: false }) // @ApiProperty({ required: false })
@IsNumber() // @IsNumber()
@IsOptional() // @IsOptional()
ItemWeight?: number; // ItemWeight?: number;
@ApiProperty({ required: false }) // @ApiProperty({ required: false })
@Length(0, 10, { // @Length(0, 10, {
message: 'Property ItemWeightUOM must be between 0 and 10 characters', // message: 'Property ItemWeightUOM must be between 0 and 10 characters',
}) // })
@IsString() // @IsString()
@IsOptional() // @IsOptional()
ItemWeightUOM?: string; // ItemWeightUOM?: string;
@ApiProperty({ required: true }) // @ApiProperty({ required: true })
@Length(0, 2, { // @Length(0, 2, {
message: 'Property GoodsOriginCountry must be between 0 and 2 characters', // message: 'Property GoodsOriginCountry must be between 0 and 2 characters',
}) // })
@IsString({ message: 'Property GoodsOriginCountry should be string' }) // @IsString({ message: 'Property GoodsOriginCountry should be string' })
@IsDefined({ message: 'Property name is required' }) // @IsDefined({ message: 'Property name is required' })
GoodsOriginCountry: string; // GoodsOriginCountry: string;
} // }
export class p_countrytableDTO { // export class p_countrytableDTO {
@ApiProperty({ required: true }) // @ApiProperty({ required: true })
@Length(0, 1, { // @Length(0, 1, {
message: 'Property VisitTransitInd must be 0 to 1 characters', // message: 'Property VisitTransitInd must be 0 to 1 characters',
}) // })
@IsString() // @IsString()
@IsDefined({ message: 'Property VisitTransitInd is required' }) // @IsDefined({ message: 'Property VisitTransitInd is required' })
VisitTransitInd: string; // VisitTransitInd: string;
@ApiProperty({ required: true }) // @ApiProperty({ required: true })
@Length(0, 2, { // @Length(0, 2, {
message: 'Property CountryCode must be between 0 to 2 characters', // message: 'Property CountryCode must be between 0 to 2 characters',
}) // })
@IsString() // @IsString()
@IsDefined({ message: 'Property CountryCode is required' }) // @IsDefined({ message: 'Property CountryCode is required' })
CountryCode: string; // CountryCode: string;
@ApiProperty({ required: true }) // @ApiProperty({ required: true })
@Max(999, { message: 'Property NoOfTimesEntLeave must not exceed 999' }) // @Max(999, { message: 'Property NoOfTimesEntLeave must not exceed 999' })
@Min(0, { message: 'Property NoOfTimesEntLeave must be at least 0 or more' }) // @Min(0, { message: 'Property NoOfTimesEntLeave must be at least 0 or more' })
@IsInt() // @IsInt()
@IsNumber({}, { message: 'Property NoOfTimesEntLeave must be a number' }) // @IsNumber({}, { message: 'Property NoOfTimesEntLeave must be a number' })
@IsDefined({ message: 'Property NoOfTimesEntLeave is required' }) // @IsDefined({ message: 'Property NoOfTimesEntLeave is required' })
NoOfTimesEntLeave: number; // NoOfTimesEntLeave: number;
} // }
export class SaveCarnetApplicationDTO { // export class SaveCarnetApplicationDTO {
@ApiProperty({ required: true }) // @ApiProperty({ required: true })
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' }) // @Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
@Min(0, { message: 'Property p_spid must be at least 0 or more' }) // @Min(0, { message: 'Property p_spid must be at least 0 or more' })
@IsInt() // @IsInt()
@IsNumber({}, { message: 'Property p_spid must be a number' }) // @IsNumber({}, { message: 'Property p_spid must be a number' })
p_spid: number; // p_spid: number;
@ApiProperty({ required: true }) // @ApiProperty({ required: true })
@Max(999999999, { message: 'Property p_clientid must not exceed 999999999' }) // @Max(999999999, { message: 'Property p_clientid must not exceed 999999999' })
@Min(0, { message: 'Property p_clientid must be at least 0 or more' }) // @Min(0, { message: 'Property p_clientid must be at least 0 or more' })
@IsInt() // @IsInt()
@IsNumber({}, { message: 'Property p_clientid must be a number' }) // @IsNumber({}, { message: 'Property p_clientid must be a number' })
p_clientid: number; // p_clientid: number;
@ApiProperty({ required: true }) // @ApiProperty({ required: true })
@Max(999999999, { // @Max(999999999, {
message: 'Property p_locationid must not exceed 999999999', // message: 'Property p_locationid must not exceed 999999999',
}) // })
@Min(0, { message: 'Property p_locationid must be at least 0 or more' }) // @Min(0, { message: 'Property p_locationid must be at least 0 or more' })
@IsInt() // @IsInt()
@IsNumber({}, { message: 'Property p_locationid must be a number' }) // @IsNumber({}, { message: 'Property p_locationid must be a number' })
p_locationid: number; // p_locationid: number;
@ApiProperty({ required: true }) // @ApiProperty({ required: true })
@Length(0, 50, { // @Length(0, 50, {
message: 'Property p_userid must be between 0 to 50 characters', // message: 'Property p_userid must be between 0 to 50 characters',
}) // })
@IsString() // @IsString()
p_userid: string; // p_userid: string;
@ApiProperty({ required: false }) // @ApiProperty({ required: false })
@Max(999999999, { message: 'Property p_headerid must not exceed 999999999' }) // @Max(999999999, { message: 'Property p_headerid must not exceed 999999999' })
@Min(0, { message: 'Property p_headerid must be at least 0 or more' }) // @Min(0, { message: 'Property p_headerid must be at least 0 or more' })
@IsInt() // @IsInt()
@IsNumber({}, { message: 'Property p_headerid must be a number' }) // @IsNumber({}, { message: 'Property p_headerid must be a number' })
@IsOptional() // @IsOptional()
p_headerid?: number; // p_headerid?: number;
@ApiProperty({ required: true }) // @ApiProperty({ required: true })
@Length(0, 50, { // @Length(0, 50, {
message: 'Property p_applicationname must be between 0 to 50 characters', // message: 'Property p_applicationname must be between 0 to 50 characters',
}) // })
@IsString() // @IsString()
p_applicationname: string; // p_applicationname: string;
@ApiProperty({ required: false }) // @ApiProperty({ required: false })
@Max(999999999, { message: 'Property p_holderid must not exceed 999999999' }) // @Max(999999999, { message: 'Property p_holderid must not exceed 999999999' })
@Min(0, { message: 'Property p_holderid must be at least 0 or more' }) // @Min(0, { message: 'Property p_holderid must be at least 0 or more' })
@IsInt() // @IsInt()
@IsNumber({}, { message: 'Property p_holderid must be a number' }) // @IsNumber({}, { message: 'Property p_holderid must be a number' })
@IsOptional() // @IsOptional()
p_holderid?: number; // p_holderid?: number;
@ApiProperty({ required: false }) // @ApiProperty({ required: false })
@Length(0, 1, { // @Length(0, 1, {
message: // message:
'Property p_commercialsampleflag must be between 0 to 1 characters', // 'Property p_commercialsampleflag must be between 0 to 1 characters',
}) // })
@IsString() // @IsString()
@IsOptional() // @IsOptional()
p_commercialsampleflag?: string; // p_commercialsampleflag?: string;
@ApiProperty({ required: false }) // @ApiProperty({ required: false })
@Length(0, 1, { // @Length(0, 1, {
message: 'Property p_profequipmentflag must be between 0 to 1 characters', // message: 'Property p_profequipmentflag must be between 0 to 1 characters',
}) // })
@IsString() // @IsString()
@IsOptional() // @IsOptional()
p_profequipmentflag?: string; // p_profequipmentflag?: string;
@ApiProperty({ required: false }) // @ApiProperty({ required: false })
@Length(0, 1, { // @Length(0, 1, {
message: 'Property p_exhibitionsfairflag must be between 0 to 1 characters', // message: 'Property p_exhibitionsfairflag must be between 0 to 1 characters',
}) // })
@IsString() // @IsString()
@IsOptional() // @IsOptional()
p_exhibitionsfairflag?: string; // p_exhibitionsfairflag?: string;
@ApiProperty({ required: false }) // @ApiProperty({ required: false })
@Length(0, 1, { // @Length(0, 1, {
message: 'Property p_autoflag must be between 0 to 1 characters', // message: 'Property p_autoflag must be between 0 to 1 characters',
}) // })
@IsString() // @IsString()
@IsOptional() // @IsOptional()
p_autoflag?: string; // p_autoflag?: string;
@ApiProperty({ required: false }) // @ApiProperty({ required: false })
@Length(0, 1, { // @Length(0, 1, {
message: 'Property p_horseflag must be between 0 to 1 characters', // message: 'Property p_horseflag must be between 0 to 1 characters',
}) // })
@IsString() // @IsString()
@IsOptional() // @IsOptional()
p_horseflag?: string; // p_horseflag?: string;
@ApiProperty({ required: false }) // @ApiProperty({ required: false })
@Length(0, 200, { // @Length(0, 200, {
message: 'Property p_authrep must be between 0 to 200 characters', // message: 'Property p_authrep must be between 0 to 200 characters',
}) // })
@IsString() // @IsString()
@IsOptional() // @IsOptional()
p_authrep?: string; // 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, { // @Length(0, 10, {
message: 'Property p_shiptotype must be between 0 to 10 characters', // message: 'Property p_shiptotype must be between 0 to 10 characters',
}) // })
@IsString() // @IsString()
@IsOptional() // @IsOptional()
p_shiptotype?: string; // p_shiptotype?: string;
@ApiProperty({ required: false }) // @ApiProperty({ required: false })
@Max(999999999, { // @Max(999999999, {
message: 'Property p_shipaddrid must not exceed 999999999', // message: 'Property p_shipaddrid must not exceed 999999999',
}) // })
@Min(0, { message: 'Property p_shipaddrid must be at least 0 or more' }) // @Min(0, { message: 'Property p_shipaddrid must be at least 0 or more' })
@IsInt() // @IsInt()
@IsNumber({}, { message: 'Property p_shipaddrid must be a number' }) // @IsNumber({}, { message: 'Property p_shipaddrid must be a number' })
@IsOptional() // @IsOptional()
p_shipaddrid?: number; // p_shipaddrid?: number;
@ApiProperty({ required: false }) // @ApiProperty({ required: false })
@Length(0, 1, { // @Length(0, 1, {
message: 'Property p_formofsecurity must be between 0 to 1 characters', // message: 'Property p_formofsecurity must be between 0 to 1 characters',
}) // })
@IsString() // @IsString()
@IsOptional() // @IsOptional()
p_formofsecurity?: string; // p_formofsecurity?: string;
@ApiProperty({ required: false }) // @ApiProperty({ required: false })
@Length(0, 10, { // @Length(0, 10, {
message: 'Property p_insprotection must be between 0 to 10 characters', // message: 'Property p_insprotection must be between 0 to 10 characters',
}) // })
@IsString() // @IsString()
@IsOptional() // @IsOptional()
p_insprotection?: string; // p_insprotection?: string;
@ApiProperty({ required: false }) // @ApiProperty({ required: false })
@Length(0, 10, { // @Length(0, 10, {
message: 'Property p_ldiprotection must be between 0 to 10 characters', // message: 'Property p_ldiprotection must be between 0 to 10 characters',
}) // })
@IsString() // @IsString()
@IsOptional() // @IsOptional()
p_ldiprotection?: string; // p_ldiprotection?: string;
@ApiProperty({ required: false }) // @ApiProperty({ required: false })
@Length(0, 10, { // @Length(0, 10, {
message: 'Property p_deliverytype must be between 0 to 10 characters', // message: 'Property p_deliverytype must be between 0 to 10 characters',
}) // })
@IsString() // @IsString()
@IsOptional() // @IsOptional()
p_deliverytype?: string; // p_deliverytype?: string;
@ApiProperty({ required: false }) // @ApiProperty({ required: false })
@Length(0, 10, { // @Length(0, 10, {
message: 'Property p_deliverymethod must be between 0 to 10 characters', // message: 'Property p_deliverymethod must be between 0 to 10 characters',
}) // })
@IsString() // @IsString()
@IsOptional() // @IsOptional()
p_deliverymethod?: string; // p_deliverymethod?: string;
@ApiProperty({ required: false }) // @ApiProperty({ required: false })
@Length(0, 10, { // @Length(0, 10, {
message: 'Property p_paymentmethod must be between 0 to 10 characters', // message: 'Property p_paymentmethod must be between 0 to 10 characters',
}) // })
@IsString() // @IsString()
@IsOptional() // @IsOptional()
p_paymentmethod?: string; // p_paymentmethod?: string;
@ApiProperty({ required: false }) // @ApiProperty({ required: false })
@Length(0, 20, { // @Length(0, 20, {
message: 'Property p_custcourierno must be between 0 to 20 characters', // message: 'Property p_custcourierno must be between 0 to 20 characters',
}) // })
@IsString() // @IsString()
@IsOptional() // @IsOptional()
p_custcourierno?: string; // p_custcourierno?: string;
@ApiProperty({ required: false }) // @ApiProperty({ required: false })
@Length(0, 20, { // @Length(0, 20, {
message: 'Property p_refno must be between 0 to 20 characters', // message: 'Property p_refno must be between 0 to 20 characters',
}) // })
@IsString() // @IsString()
@IsOptional() // @IsOptional()
p_refno?: string; // p_refno?: string;
@ApiProperty({ required: false }) // @ApiProperty({ required: false })
@Length(0, 2000, { // @Length(0, 2000, {
message: 'Property p_notes must be between 0 to 2000 characters', // message: 'Property p_notes must be between 0 to 2000 characters',
}) // })
@IsString() // @IsString()
@IsOptional() // @IsOptional()
p_notes?: string; // 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, { // @Length(0, 50, {
message: 'Property p_userid must be between 0 to 50 characters', // message: 'Property p_userid must be between 0 to 50 characters',
}) // })
@IsString() // @IsString()
@IsDefined({ message: 'Property p_userid is required' }) // @IsDefined({ message: 'Property p_userid is required' })
p_userid: string; // p_userid: string;
@ApiProperty({ required: true }) // @ApiProperty({ required: true })
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' }) // @Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
@Min(0, { message: 'Property p_spid must be at least 0 or more' }) // @Min(0, { message: 'Property p_spid must be at least 0 or more' })
@IsInt() // @IsInt()
@IsNumber({}, { message: 'Property p_headerid must be a number' }) // @IsNumber({}, { message: 'Property p_headerid must be a number' })
@IsDefined({ message: 'Property p_headerid is required' }) // @IsDefined({ message: 'Property p_headerid is required' })
p_headerid: number; // p_headerid: number;
} // }
export class GetCarnetDetailsbyCarnetStatusDTO { // export class GetCarnetDetailsbyCarnetStatusDTO {
@ApiProperty({ required: true }) // @ApiProperty({ required: true })
@Max(999999999, { message: 'Property p_spid must not exceed 999999999' }) // @Max(999999999, { message: 'Property p_spid must not exceed 999999999' })
@Min(0, { message: 'Property p_spid must be at least 0 or more' }) // @Min(0, { message: 'Property p_spid must be at least 0 or more' })
@IsInt() // @IsInt()
@IsNumber({}, { message: 'Property p_spid must be a number' }) // @IsNumber({}, { message: 'Property p_spid must be a number' })
@IsDefined({ message: 'Property p_spid is required' }) // @IsDefined({ message: 'Property p_spid is required' })
p_spid: number; // p_spid: number;
@ApiProperty({ required: true }) // @ApiProperty({ required: true })
@Length(0, 50, { // @Length(0, 50, {
message: 'Property p_userid must be between 0 to 50 characters', // message: 'Property p_userid must be between 0 to 50 characters',
}) // })
@IsString({ message: 'Property p_userid must be string' }) // @IsString({ message: 'Property p_userid must be 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 })
@Length(0, 20, { // @Length(0, 20, {
message: 'Property p_CarnetStatus must be between 0 to 20 characters', // message: 'Property p_CarnetStatus must be between 0 to 20 characters',
}) // })
@IsString() // @IsString()
@IsDefined({ message: 'Property p_CarnetStatus is required' }) // @IsDefined({ message: 'Property p_CarnetStatus is required' })
p_CarnetStatus: string; // p_CarnetStatus: string;
} // }

View File

@ -1,18 +1,16 @@
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 {
p_gltableDTO, import { SPID_DTO } from 'src/dto/sp/sp-property.dto';
SaveCarnetApplicationDTO, import { GetCarnetDetailsbyCarnetStatusDTO } from 'src/dto/carnet/carnet.dto';
TransmitApplicationtoProcessDTO, import { EMAIL_DTO } from 'src/dto/property.dto';
GetCarnetDetailsbyCarnetStatusDTO,
} from './home-page.dto';
@Injectable() @Injectable()
export class HomePageService { export class HomePageService {
constructor(private readonly oracleDBService: OracleDBService) { } constructor(private readonly oracleDBService: OracleDBService) { }
async GetHomePageData(P_spid: number) { async GetHomePageData(params: SPID_DTO) {
let connection; let connection;
let p_basic_details = []; let p_basic_details = [];
let p_contacts = []; let p_contacts = [];
@ -34,24 +32,24 @@ export class HomePageService {
const result = await connection.execute( const result = await connection.execute(
`BEGIN `BEGIN
USERLOGIN_PKG.GetHomePageData( USERLOGIN_PKG.GetHomePageData(
:P_spid, :P_SPID,
:p_basic_details_cur, :p_basic_details_cur,
:p_contacts_cur, :p_contacts_cur,
:p_sequence_cur, :p_sequence_cur,
:p_fees_comm_cur, :p_fees_comm_cur,
:p_bf_fee_cur, :p_bf_fee_cur,
:p_cf_Fee_cur, :p_cf_Fee_cur,
:p_cont_sheet_fee_cur, :p_cont_sheet_fee_cur,
:p_ef_fee_cur, :p_ef_fee_cur,
:p_security_deposit_cur, :p_security_deposit_cur,
:p_param_cur, :p_param_cur,
:p_region_cur :p_region_cur
); );
END;`, END;`,
{ {
P_spid: { P_SPID: {
val: P_spid, val: params.P_SPID,
type: oracledb.DB_TYPE_NUMBER, type: oracledb.DB_TYPE_NUMBER,
}, },
p_basic_details_cur: { p_basic_details_cur: {
@ -292,7 +290,7 @@ export class HomePageService {
} }
} }
async GetCarnetSummaryData(p_emailaddr: string) { async GetCarnetSummaryData(body: EMAIL_DTO) {
let connection; let connection;
let rows: any = []; let rows: any = [];
try { try {
@ -303,14 +301,14 @@ export class HomePageService {
const result = await connection.execute( const result = await connection.execute(
`BEGIN `BEGIN
USERLOGIN_PKG.GetCarnetSummaryData(:p_emailaddr,:p_cursor); USERLOGIN_PKG.GetCarnetSummaryData(:P_EMAILADDR,:P_CURSOR);
END;`, END;`,
{ {
p_emailaddr: { P_EMAILADDR: {
val: p_emailaddr, val: body.P_EMAILADDR,
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,
}, },
@ -320,8 +318,8 @@ export class HomePageService {
}, },
); );
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 {
@ -394,428 +392,428 @@ export class HomePageService {
// NOTE : this has been moved to carent-application module // NOTE : this has been moved to carent-application module
async SaveCarnetApplication(body: SaveCarnetApplicationDTO) { // async SaveCarnetApplication(body: SaveCarnetApplicationDTO) {
const newBody = { // const newBody = {
p_headerid: null, // p_headerid: null,
p_holderid: null, // p_holderid: null,
p_commercialsampleflag: null, // p_commercialsampleflag: null,
p_profequipmentflag: null, // p_profequipmentflag: null,
p_exhibitionsfairflag: null, // p_exhibitionsfairflag: null,
p_autoflag: null, // p_autoflag: null,
p_horseflag: null, // p_horseflag: null,
p_authrep: null, // p_authrep: null,
p_gltable: null, // p_gltable: null,
p_ussets: null, // p_ussets: null,
p_countrytable: null, // p_countrytable: null,
p_shiptotype: null, // p_shiptotype: null,
p_shipaddrid: null, // p_shipaddrid: null,
p_formofsecurity: null, // p_formofsecurity: null,
p_insprotection: null, // p_insprotection: null,
p_ldiprotection: null, // p_ldiprotection: null,
p_deliverytype: null, // p_deliverytype: null,
p_deliverymethod: null, // p_deliverymethod: null,
p_paymentmethod: null, // p_paymentmethod: null,
p_custcourierno: null, // p_custcourierno: null,
p_refno: null, // p_refno: null,
p_notes: null, // p_notes: null,
}; // };
const reqBody = JSON.parse(JSON.stringify(body)); // const reqBody = JSON.parse(JSON.stringify(body));
function setEmptyStringsToNull(obj) { // function setEmptyStringsToNull(obj) {
Object.keys(obj).forEach((key) => { // Object.keys(obj).forEach((key) => {
if (typeof obj[key] === 'object' && obj[key] !== null) { // if (typeof obj[key] === 'object' && obj[key] !== null) {
setEmptyStringsToNull(obj[key]); // setEmptyStringsToNull(obj[key]);
} else if (obj[key] === '') { // } else if (obj[key] === '') {
obj[key] = null; // obj[key] = null;
} // }
}); // });
} // }
setEmptyStringsToNull(reqBody); // setEmptyStringsToNull(reqBody);
const finalBody = { ...newBody, ...reqBody }; // const finalBody = { ...newBody, ...reqBody };
let connection; // let connection;
let rows = []; // let rows = [];
try { // try {
connection = await this.oracleDBService.getConnection(); // connection = await this.oracleDBService.getConnection();
if (!connection) { // if (!connection) {
throw new Error('No DB Connected'); // throw new Error('No DB Connected');
} // }
console.log('here ------------ 1'); // console.log('here ------------ 1');
// const res = await connection.execute(`SELECT CARNETSYS.GLARRAY(1, 'Description for itemno 1', 2500, 20, 12, 'LBS', 'US') FROM dual`); // // const res = await connection.execute(`SELECT CARNETSYS.GLARRAY(1, 'Description for itemno 1', 2500, 20, 12, 'LBS', 'US') FROM dual`);
async function createGLArrayInstance( // async function createGLArrayInstance(
connection, // connection,
itemNo, // itemNo,
itemDescription, // itemDescription,
itemValue, // itemValue,
noOfPieces, // noOfPieces,
itemWeight, // itemWeight,
itemWeightUOM, // itemWeightUOM,
goodsOriginCountry, // goodsOriginCountry,
) { // ) {
const result = await connection.execute( // const result = await connection.execute(
`SELECT CARNETSYS.GLARRAY(:itemNo, :itemDescription, :itemValue, :noOfPieces, :itemWeight, :itemWeightUOM, :goodsOriginCountry) FROM dual`, // `SELECT CARNETSYS.GLARRAY(:itemNo, :itemDescription, :itemValue, :noOfPieces, :itemWeight, :itemWeightUOM, :goodsOriginCountry) FROM dual`,
{ // {
itemNo, // itemNo,
itemDescription, // itemDescription,
itemValue, // itemValue,
noOfPieces, // noOfPieces,
itemWeight, // itemWeight,
itemWeightUOM, // itemWeightUOM,
goodsOriginCountry, // goodsOriginCountry,
}, // },
); // );
return result.rows[0][0]; // Access the first row and first column to get the GLARRAY instance // return result.rows[0][0]; // Access the first row and first column to get the GLARRAY instance
} // }
async function createCarnetCountryArrayInstance( // async function createCarnetCountryArrayInstance(
connection, // connection,
visitTransitInd, // visitTransitInd,
countryCode, // countryCode,
noOfTimesEntLeave, // noOfTimesEntLeave,
) { // ) {
const result = await connection.execute( // const result = await connection.execute(
`SELECT CARNETSYS.CARNETCOUNTRYARRAY(:visitTransitInd, :countryCode, :noOfTimesEntLeave) FROM dual`, // `SELECT CARNETSYS.CARNETCOUNTRYARRAY(:visitTransitInd, :countryCode, :noOfTimesEntLeave) FROM dual`,
{ // {
visitTransitInd, // visitTransitInd,
countryCode, // countryCode,
noOfTimesEntLeave, // noOfTimesEntLeave,
}, // },
); // );
return result.rows[0][0]; // Access the first row and first column to get the CARNETCOUNTRYARRAY instance // return result.rows[0][0]; // Access the first row and first column to get the CARNETCOUNTRYARRAY instance
} // }
// let res = await connection.execute(`SELECT owner, type_name FROM all_types WHERE type_name IN ('GLARRAY', 'GLTABLE')`) // // let res = await connection.execute(`SELECT owner, type_name FROM all_types WHERE type_name IN ('GLARRAY', 'GLTABLE')`)
// let GLARRAY = await connection.getDbObjectClass('CARNETSYS.GLARRAY'); // // let GLARRAY = await connection.getDbObjectClass('CARNETSYS.GLARRAY');
const GLTABLE = await connection.getDbObjectClass('CARNETSYS.GLTABLE'); // const GLTABLE = await connection.getDbObjectClass('CARNETSYS.GLTABLE');
// const CARNETCOUNTRYARRAY = await connection.getDbObjectClass('CARNETSYS.CARNETCOUNTRYARRAY'); // // const CARNETCOUNTRYARRAY = await connection.getDbObjectClass('CARNETSYS.CARNETCOUNTRYARRAY');
const CARNETCOUNTRYTABLE = await connection.getDbObjectClass( // const CARNETCOUNTRYTABLE = await connection.getDbObjectClass(
'CARNETSYS.CARNETCOUNTRYTABLE', // 'CARNETSYS.CARNETCOUNTRYTABLE',
); // );
// Check if GLTABLE is a constructor // // Check if GLTABLE is a constructor
if (typeof GLTABLE !== 'function') { // if (typeof GLTABLE !== 'function') {
throw new Error('GLTABLE is not a constructor'); // throw new Error('GLTABLE is not a constructor');
} // }
if (typeof CARNETCOUNTRYTABLE !== 'function') { // if (typeof CARNETCOUNTRYTABLE !== 'function') {
throw new Error('CARNETCOUNTRYTABLE is not a constructor'); // throw new Error('CARNETCOUNTRYTABLE is not a constructor');
} // }
const GLTABLE_ARRAY = finalBody.p_gltable // const GLTABLE_ARRAY = finalBody.p_gltable
? await Promise.all( // ? await Promise.all(
finalBody.p_gltable.map(async (x: p_gltableDTO) => { // finalBody.p_gltable.map(async (x: p_gltableDTO) => {
return await createGLArrayInstance( // return await createGLArrayInstance(
connection, // connection,
x.ItemNo, // x.ItemNo,
x.ItemDescription, // x.ItemDescription,
x.ItemValue, // x.ItemValue,
x.Noofpieces, // x.Noofpieces,
x.ItemWeight, // x.ItemWeight,
x.ItemWeightUOM, // x.ItemWeightUOM,
x.GoodsOriginCountry, // x.GoodsOriginCountry,
); // );
}), // }),
) // )
: []; // : [];
const CARNETCOUNTRYTABLE_ARRAY = finalBody.p_countrytable // const CARNETCOUNTRYTABLE_ARRAY = finalBody.p_countrytable
? await Promise.all( // ? await Promise.all(
finalBody.p_countrytable.map(async (x) => { // finalBody.p_countrytable.map(async (x) => {
return await createCarnetCountryArrayInstance( // return await createCarnetCountryArrayInstance(
connection, // connection,
x.VisitTransitInd, // x.VisitTransitInd,
x.CountryCode, // x.CountryCode,
x.NoOfTimesEntLeave, // x.NoOfTimesEntLeave,
); // );
}), // }),
) // )
: []; // : [];
const GLTABLE_INSTANCE = new GLTABLE(GLTABLE_ARRAY); // const GLTABLE_INSTANCE = new GLTABLE(GLTABLE_ARRAY);
const CARNETCOUNTRYTABLE_INSTANCE = new CARNETCOUNTRYTABLE( // const CARNETCOUNTRYTABLE_INSTANCE = new CARNETCOUNTRYTABLE(
CARNETCOUNTRYTABLE_ARRAY, // CARNETCOUNTRYTABLE_ARRAY,
); // );
const result = await connection.execute( // const result = await connection.execute(
`BEGIN // `BEGIN
CARNETAPPLICATION_PKG.SaveCarnetApplication( // CARNETAPPLICATION_PKG.SaveCarnetApplication(
:p_spid, // :P_SPID,
:p_clientid, // :p_clientid,
:p_locationid, // :p_locationid,
:p_userid, // :P_USERID,
:p_headerid, // :p_headerid,
:p_applicationname, // :p_applicationname,
:p_holderid, // :p_holderid,
:p_commercialsampleflag, // :p_commercialsampleflag,
:p_profequipmentflag, // :p_profequipmentflag,
:p_exhibitionsfairflag, // :p_exhibitionsfairflag,
:p_autoflag, // :p_autoflag,
:p_horseflag, // :p_horseflag,
:p_authrep, // :p_authrep,
:p_gltable, // :p_gltable,
:p_ussets, // :p_ussets,
:p_countrytable, // :p_countrytable,
:p_shiptotype, // :p_shiptotype,
:p_shipaddrid, // :p_shipaddrid,
:p_formofsecurity, // :p_formofsecurity,
:p_insprotection, // :p_insprotection,
:p_ldiprotection, // :p_ldiprotection,
:p_deliverytype, // :p_deliverytype,
:p_deliverymethod, // :p_deliverymethod,
:p_paymentmethod, // :p_paymentmethod,
:p_custcourierno, // :p_custcourierno,
:p_refno, // :p_refno,
:p_notes, // :p_notes,
:P_cursor // :P_CURSOR
); // );
END;`, // END;`,
{ // {
p_spid: { // P_SPID: {
val: finalBody.p_spid ? finalBody.p_spid : null, // val: finalBody.P_SPID ? finalBody.P_SPID : null,
type: oracledb.DB_TYPE_NUMBER, // type: oracledb.DB_TYPE_NUMBER,
}, // },
p_clientid: { // p_clientid: {
val: finalBody.p_clientid ? finalBody.p_clientid : null, // val: finalBody.p_clientid ? finalBody.p_clientid : null,
type: oracledb.DB_TYPE_NUMBER, // type: oracledb.DB_TYPE_NUMBER,
}, // },
p_locationid: { // p_locationid: {
val: finalBody.p_locationid ? finalBody.p_locationid : null, // val: finalBody.p_locationid ? finalBody.p_locationid : null,
type: oracledb.DB_TYPE_NUMBER, // type: oracledb.DB_TYPE_NUMBER,
}, // },
p_userid: { // P_USERID: {
val: finalBody.p_userid ? finalBody.p_userid : null, // val: finalBody.P_USERID ? finalBody.P_USERID : null,
type: oracledb.DB_TYPE_NVARCHAR, // type: oracledb.DB_TYPE_NVARCHAR,
}, // },
p_headerid: { // p_headerid: {
val: finalBody.p_headerid ? finalBody.p_headerid : null, // val: finalBody.p_headerid ? finalBody.p_headerid : null,
type: oracledb.DB_TYPE_NUMBER, // type: oracledb.DB_TYPE_NUMBER,
}, // },
p_applicationname: { // p_applicationname: {
val: finalBody.p_applicationname // val: finalBody.p_applicationname
? finalBody.p_applicationname // ? finalBody.p_applicationname
: null, // : null,
type: oracledb.DB_TYPE_NVARCHAR, // type: oracledb.DB_TYPE_NVARCHAR,
}, // },
p_holderid: { // p_holderid: {
val: finalBody.p_holderid ? finalBody.p_holderid : null, // val: finalBody.p_holderid ? finalBody.p_holderid : null,
type: oracledb.DB_TYPE_NUMBER, // type: oracledb.DB_TYPE_NUMBER,
}, // },
p_commercialsampleflag: { // p_commercialsampleflag: {
val: finalBody.p_commercialsampleflag // val: finalBody.p_commercialsampleflag
? finalBody.p_commercialsampleflag // ? finalBody.p_commercialsampleflag
: null, // : null,
type: oracledb.DB_TYPE_NVARCHAR, // type: oracledb.DB_TYPE_NVARCHAR,
}, // },
p_profequipmentflag: { // p_profequipmentflag: {
val: finalBody.p_profequipmentflag // val: finalBody.p_profequipmentflag
? finalBody.p_profequipmentflag // ? finalBody.p_profequipmentflag
: null, // : null,
type: oracledb.DB_TYPE_NVARCHAR, // type: oracledb.DB_TYPE_NVARCHAR,
}, // },
p_exhibitionsfairflag: { // p_exhibitionsfairflag: {
val: finalBody.p_exhibitionsfairflag // val: finalBody.p_exhibitionsfairflag
? finalBody.p_exhibitionsfairflag // ? finalBody.p_exhibitionsfairflag
: null, // : null,
type: oracledb.DB_TYPE_NVARCHAR, // type: oracledb.DB_TYPE_NVARCHAR,
}, // },
p_autoflag: { // p_autoflag: {
val: finalBody.p_autoflag ? finalBody.p_autoflag : null, // val: finalBody.p_autoflag ? finalBody.p_autoflag : null,
type: oracledb.DB_TYPE_NVARCHAR, // type: oracledb.DB_TYPE_NVARCHAR,
}, // },
p_horseflag: { // p_horseflag: {
val: finalBody.p_horseflag ? finalBody.p_horseflag : null, // val: finalBody.p_horseflag ? finalBody.p_horseflag : null,
type: oracledb.DB_TYPE_NVARCHAR, // type: oracledb.DB_TYPE_NVARCHAR,
}, // },
p_authrep: { // p_authrep: {
val: finalBody.p_authrep ? finalBody.p_authrep : null, // val: finalBody.p_authrep ? finalBody.p_authrep : null,
type: oracledb.DB_TYPE_NVARCHAR, // type: oracledb.DB_TYPE_NVARCHAR,
}, // },
p_gltable: { // p_gltable: {
val: GLTABLE_INSTANCE, // val: GLTABLE_INSTANCE,
type: oracledb.DB_TYPE_OBJECT, // type: oracledb.DB_TYPE_OBJECT,
}, // },
p_ussets: { // p_ussets: {
val: finalBody.p_ussets ? finalBody.p_ussets : null, // val: finalBody.p_ussets ? finalBody.p_ussets : null,
type: oracledb.DB_TYPE_NUMBER, // type: oracledb.DB_TYPE_NUMBER,
}, // },
p_countrytable: { // p_countrytable: {
val: CARNETCOUNTRYTABLE_INSTANCE, // val: CARNETCOUNTRYTABLE_INSTANCE,
type: oracledb.DB_TYPE_OBJECT, // type: oracledb.DB_TYPE_OBJECT,
}, // },
p_shiptotype: { // p_shiptotype: {
val: finalBody.p_shiptotype ? finalBody.p_shiptotype : null, // val: finalBody.p_shiptotype ? finalBody.p_shiptotype : null,
type: oracledb.DB_TYPE_NVARCHAR, // type: oracledb.DB_TYPE_NVARCHAR,
}, // },
p_shipaddrid: { // p_shipaddrid: {
val: finalBody.p_shipaddrid ? finalBody.p_shipaddrid : null, // val: finalBody.p_shipaddrid ? finalBody.p_shipaddrid : null,
type: oracledb.DB_TYPE_NUMBER, // type: oracledb.DB_TYPE_NUMBER,
}, // },
p_formofsecurity: { // p_formofsecurity: {
val: finalBody.p_formofsecurity ? finalBody.p_formofsecurity : null, // val: finalBody.p_formofsecurity ? finalBody.p_formofsecurity : null,
type: oracledb.DB_TYPE_NVARCHAR, // type: oracledb.DB_TYPE_NVARCHAR,
}, // },
p_insprotection: { // p_insprotection: {
val: finalBody.p_insprotection ? finalBody.p_insprotection : null, // val: finalBody.p_insprotection ? finalBody.p_insprotection : null,
type: oracledb.DB_TYPE_NVARCHAR, // type: oracledb.DB_TYPE_NVARCHAR,
}, // },
p_ldiprotection: { // p_ldiprotection: {
val: finalBody.p_ldiprotection ? finalBody.p_ldiprotection : null, // val: finalBody.p_ldiprotection ? finalBody.p_ldiprotection : null,
type: oracledb.DB_TYPE_NVARCHAR, // type: oracledb.DB_TYPE_NVARCHAR,
}, // },
p_deliverytype: { // p_deliverytype: {
val: finalBody.p_deliverytype ? finalBody.p_deliverytype : null, // val: finalBody.p_deliverytype ? finalBody.p_deliverytype : null,
type: oracledb.DB_TYPE_NVARCHAR, // type: oracledb.DB_TYPE_NVARCHAR,
}, // },
p_deliverymethod: { // p_deliverymethod: {
val: finalBody.p_deliverymethod ? finalBody.p_deliverymethod : null, // val: finalBody.p_deliverymethod ? finalBody.p_deliverymethod : null,
type: oracledb.DB_TYPE_NVARCHAR, // type: oracledb.DB_TYPE_NVARCHAR,
}, // },
p_paymentmethod: { // p_paymentmethod: {
val: finalBody.p_paymentmethod ? finalBody.p_paymentmethod : null, // val: finalBody.p_paymentmethod ? finalBody.p_paymentmethod : null,
type: oracledb.DB_TYPE_NVARCHAR, // type: oracledb.DB_TYPE_NVARCHAR,
}, // },
p_custcourierno: { // p_custcourierno: {
val: finalBody.p_custcourierno ? finalBody.p_custcourierno : null, // val: finalBody.p_custcourierno ? finalBody.p_custcourierno : null,
type: oracledb.DB_TYPE_NVARCHAR, // type: oracledb.DB_TYPE_NVARCHAR,
}, // },
p_refno: { // p_refno: {
val: finalBody.p_refno ? finalBody.p_refno : null, // val: finalBody.p_refno ? finalBody.p_refno : null,
type: oracledb.DB_TYPE_NVARCHAR, // type: oracledb.DB_TYPE_NVARCHAR,
}, // },
p_notes: { // p_notes: {
val: finalBody.p_notes ? finalBody.p_notes : null, // val: finalBody.p_notes ? finalBody.p_notes : null,
type: oracledb.DB_TYPE_NVARCHAR, // type: oracledb.DB_TYPE_NVARCHAR,
}, // },
P_cursor: { // P_CURSOR: {
type: oracledb.CURSOR, // type: oracledb.CURSOR,
dir: oracledb.BIND_OUT, // dir: oracledb.BIND_OUT,
}, // },
}, // },
{ // {
outFormat: oracledb.OUT_FORMAT_OBJECT, // outFormat: oracledb.OUT_FORMAT_OBJECT,
}, // },
); // );
await connection.commit(); // await connection.commit();
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) { // if (err instanceof Error) {
return { error: err.message }; // return { error: err.message };
} else { // } else {
return { error: 'An unknown error occurred' }; // return { error: 'An unknown error occurred' };
} // }
} // }
finally { // finally {
if (connection) { // if (connection) {
try { // try {
await connection.close(); // await connection.close();
} catch (closeErr) { // } catch (closeErr) {
console.error('Failed to close connection:', closeErr); // console.error('Failed to close connection:', closeErr);
} // }
} // }
} // }
} // }
// NOTE : this has been moved to carent-application module // NOTE : this has been moved to carent-application module
async TransmitApplicationtoProcess(body: TransmitApplicationtoProcessDTO) { // async TransmitApplicationtoProcess(body: TransmitApplicationtoProcessDTO) {
let connection; // let connection;
let rows = []; // let rows = [];
try { // try {
connection = await this.oracleDBService.getConnection(); // connection = await this.oracleDBService.getConnection();
if (!connection) { // if (!connection) {
throw new Error('No DB Connected'); // throw new Error('No DB Connected');
} // }
const result = await connection.execute( // const result = await connection.execute(
`BEGIN // `BEGIN
CARNETAPPLICATION_PKG.TransmitApplicationtoProcess( // CARNETAPPLICATION_PKG.TransmitApplicationtoProcess(
:p_spid, // :P_SPID,
:p_userid, // :P_USERID,
:p_headerid, // :p_headerid,
: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_userid: { // P_USERID: {
val: body.p_userid, // val: body.P_USERID,
type: oracledb.DB_TYPE_NVARCHAR, // type: oracledb.DB_TYPE_NVARCHAR,
}, // },
p_headerid: { // p_headerid: {
val: body.p_headerid, // val: body.p_headerid,
type: oracledb.DB_TYPE_NUMBER, // type: oracledb.DB_TYPE_NUMBER,
}, // },
P_cursor: { // P_CURSOR: {
type: oracledb.CURSOR, // type: oracledb.CURSOR,
dir: oracledb.BIND_OUT, // dir: oracledb.BIND_OUT,
}, // },
}, // },
{ // {
outFormat: oracledb.OUT_FORMAT_OBJECT, // outFormat: oracledb.OUT_FORMAT_OBJECT,
}, // },
); // );
await connection.commit(); // await connection.commit();
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;
// return fres // // return fres
} catch (err) { // } catch (err) {
if (err instanceof Error) { // if (err instanceof Error) {
return { error: err.message }; // return { error: err.message };
} else { // } else {
return { error: 'An unknown error occurred' }; // return { error: 'An unknown error occurred' };
} // }
} // }
finally { // finally {
if (connection) { // if (connection) {
try { // try {
await connection.close(); // await connection.close();
} catch (closeErr) { // } catch (closeErr) {
console.error('Failed to close connection:', closeErr); // console.error('Failed to close connection:', closeErr);
} // }
} // }
} // }
} // }
async GetCarnetDetailsbyCarnetStatus(body: GetCarnetDetailsbyCarnetStatusDTO) { async GetCarnetDetailsbyCarnetStatus(body: GetCarnetDetailsbyCarnetStatusDTO) {
let connection; let connection;
@ -828,22 +826,22 @@ export class HomePageService {
const result = await connection.execute( const result = await connection.execute(
`BEGIN `BEGIN
CARNETCONTROLCENTER_PKG.GetCarnetDetails(:p_spid,:p_userid,:p_CarnetStattus,:P_cursor); CARNETCONTROLCENTER_PKG.GetCarnetDetails(:P_SPID,:P_USERID,:P_CARNETSTATUS,: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_userid: { P_USERID: {
val: body.p_userid, val: body.P_USERID,
type: oracledb.DB_TYPE_NVARCHAR, type: oracledb.DB_TYPE_NVARCHAR,
}, },
p_CarnetStattus: { P_CARNETSTATUS: {
val: body.p_CarnetStatus, val: body.P_CARNETSTATUS,
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,
}, },
@ -853,8 +851,8 @@ export class HomePageService {
}, },
); );
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 {

View File

@ -1,20 +1,15 @@
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 { import {
CreateClientContactsDTO, CreateClientContactsDTO, CreateClientDataDTO,
CreateClientDataDTO, CreateClientLocationsDTO, GetPreparerByClientidContactsByClientidLocByClientidDTO,
CreateClientLocationsDTO, GetPreparersDTO, UpdateClientContactsDTO, UpdateClientDTO, UpdateClientLocationsDTO
GetPreparerByClientidContactsByClientidLocByClientidDTO, } from 'src/dto/client/client.dto';
GetPreparersDTO,
UpdateClientContactsDTO,
UpdateClientDTO,
UpdateClientLocationsDTO,
} from './manage-clients.dto';
import { ApiTags } from '@nestjs/swagger'; import { ApiTags } from '@nestjs/swagger';
@Controller('oracle') @Controller('oracle')
export class ManageClientsController { export class ManageClientsController {
constructor(private readonly manageClientsService: ManageClientsService) {} constructor(private readonly manageClientsService: ManageClientsService) { }
@ApiTags('Manage Clients - Oracle') @ApiTags('Manage Clients - Oracle')
@Post('CreateNewClients') @Post('CreateNewClients')

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,24 +1,8 @@
import { Body, Controller, Get, 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 {
CreateBasicFeeDTO, import { CreateBasicFeeDTO, CreateBondRateDTO, CreateCargoRateDTO, CreateCfFeeDTO, CreateCsFeeDTO, CreateEfFeeDTO, CreateFeeCommDTO, GetFeeGeneralDTO, UpdateBasicFeeDTO, UpdateBondRateDTO, UpdateCargoRateDTO, UpdateCfFeeDTO, UpdateCsFeeDTO, UpdateEfFeeDTO, UpdateFeeCommDTO } from 'src/dto/fee/fee.dto';
CreateBondRateDTO,
CreateCargoRateDTO,
CreateCfFeeDTO,
CreateCsFeeDTO,
CreateEfFeeDTO,
CreateFeeCommDTO,
UpdateBasicFeeDTO,
UpdateBondRateDTO,
UpdateCargoRateDTO,
UpdateCfFeeDTO,
UpdateCsFeeDTO,
UpdateEfFeeDTO,
UpdateFeeCommBodyDTO,
UpdateFeeCommDTO,
} from './manage-fee.dto';
import { GetFeeGeneralDTO } from 'src/dto/fee/fee.dto';
@Controller('oracle') @Controller('oracle')
export class ManageFeeController { export class ManageFeeController {

View File

@ -1,347 +0,0 @@
import { ApiProperty } from '@nestjs/swagger';
import { Transform } from 'class-transformer';
import { IsDefined, IsInt, IsNumber, IsString, Length, Matches, Min } from 'class-validator';
export class CreateBasicFeeDTO {
@ApiProperty({ required: true })
@IsNumber()
P_SPID: number;
@ApiProperty({ required: true })
@IsNumber()
P_STARTCARNETVALUE: number;
@ApiProperty({ required: true })
@IsNumber()
P_ENDCARNETVALUE: number;
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
@ApiProperty({ required: true })
@IsNumber()
P_FEES: number;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
}
export class CreateBondRateDTO {
@ApiProperty({ required: true })
@IsNumber()
P_SPID: number;
@ApiProperty({ required: true })
@Length(0, 3, {message:"Property P_HOLDERTYPE must be between 0 to 3 characters"})
@IsString({message:"Property P_USERID must be a string"})
@IsDefined({ message: 'Property P_USERID is required' })
P_HOLDERTYPE: string;
@ApiProperty({ required: true })
@IsString()
P_USCIBMEMBERFLAG: string;
@ApiProperty({ required: true })
@IsString()
P_SPCLCOMMODITY: string;
@ApiProperty({ required: true })
@IsString()
P_SPCLCOUNTRY: string;
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
@ApiProperty({ required: true })
@IsNumber()
P_RATE: number;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
}
export class CreateCargoRateDTO {
@ApiProperty({ required: true })
@IsNumber()
P_SPID: number;
@ApiProperty({ required: true })
@IsString()
P_CARNETTYPE: string;
@ApiProperty({ required: true })
@IsNumber()
P_STARTSETS: number;
@ApiProperty({ required: true })
@IsNumber()
P_ENDSETS: number;
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
@ApiProperty({ required: true })
@IsNumber()
P_RATE: number;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
}
export class CreateCfFeeDTO {
@ApiProperty({ required: true })
@IsNumber()
P_SPID: number;
@ApiProperty({ required: true })
@IsNumber()
P_STARTSETS: number;
@ApiProperty({ required: true })
@IsNumber()
P_ENDSETS: number;
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
@ApiProperty({ required: true })
@IsString()
P_CUSTOMERTYPE: string;
@ApiProperty({ required: true })
@IsString()
P_CARNETTYPE: string;
@ApiProperty({ required: true })
@IsNumber()
P_RATE: number;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
}
export class CreateCsFeeDTO {
@ApiProperty({ required: true })
@IsNumber()
P_SPID: number;
@ApiProperty({ required: true })
@IsString()
P_CUSTOMERTYPE: string;
@ApiProperty({ required: true })
@IsString()
P_CARNETTYPE: string;
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
@ApiProperty({ required: true })
@IsNumber()
P_RATE: number;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
}
export class CreateEfFeeDTO {
@ApiProperty({ required: true })
@IsNumber()
P_SPID: number;
@ApiProperty({ required: true })
@IsString()
P_CUSTOMERTYPE: string;
@ApiProperty({ required: true })
@IsString()
P_DELIVERYTYPE: string;
@ApiProperty({ required: true })
@IsNumber()
P_STARTTIME: number;
@ApiProperty({ required: true })
@IsNumber()
P_ENDTIME: number;
@ApiProperty({ required: true })
@IsString()
P_TIMEZONE: string;
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
@ApiProperty({ required: true })
@IsNumber()
P_FEES: number;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
}
export class CreateFeeCommDTO {
@ApiProperty({ required: true })
@IsNumber()
P_SPID: number;
@ApiProperty({ required: true })
@IsNumber()
P_PARAMID: number;
@ApiProperty({ required: true })
@IsNumber()
P_COMMRATE: number;
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
}
export class UpdateBasicFeeDTO {
@ApiProperty({ required: true })
@IsNumber()
P_BASICFEESETUPID: number;
@ApiProperty({ required: true })
@IsNumber()
P_FEES: number;
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
}
export class UpdateBondRateDTO {
@ApiProperty({ required: true })
@IsNumber()
P_BONDRATESETUPID: number;
@ApiProperty({ required: true })
@IsNumber()
P_RATE: number;
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
}
export class UpdateCargoRateDTO {
@ApiProperty({ required: true })
@IsNumber()
P_CARGORATESETUPID: number;
@ApiProperty({ required: true })
@IsNumber()
P_RATE: number;
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
}
export class UpdateCfFeeDTO {
@ApiProperty({ required: true })
@IsNumber()
P_CFFEESETUPID: number;
@ApiProperty({ required: true })
@IsNumber()
P_RATE: number;
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
}
export class UpdateCsFeeDTO {
@ApiProperty({ required: true })
@IsNumber()
P_CSFEESETUPID: number;
@ApiProperty({ required: true })
@IsNumber()
P_RATE: number;
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
}
export class UpdateEfFeeDTO {
@ApiProperty({ required: true })
@IsNumber()
P_EFFEESETUPID: number;
@ApiProperty({ required: true })
@IsNumber()
P_FEES: number;
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
}
export class UpdateFeeCommDTO {
@ApiProperty({ required: true })
@IsNumber()
P_FEECOMMID: number;
@ApiProperty({ required: true })
@IsNumber()
P_RATE: number;
@ApiProperty({ required: true })
@IsString()
P_EFFDATE: string;
@ApiProperty({ required: true })
@IsString()
P_USERID: string;
}
export class UpdateFeeCommBodyDTO {
@ApiProperty({ type: UpdateFeeCommDTO, required: true }) // Correctly reference UpdateFeeCommDTO
p_fees_comm: UpdateFeeCommDTO; // No need for @IsObject()
}

View File

@ -1,26 +1,15 @@
import { Injectable, Logger } from '@nestjs/common'; import { Injectable, Logger } 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 {
CreateBasicFeeDTO,
CreateBondRateDTO,
CreateCargoRateDTO,
CreateCfFeeDTO,
CreateCsFeeDTO,
CreateEfFeeDTO,
CreateFeeCommDTO,
UpdateBasicFeeDTO,
UpdateBondRateDTO,
UpdateCargoRateDTO,
UpdateCfFeeDTO,
UpdateCsFeeDTO,
UpdateEfFeeDTO,
UpdateFeeCommBodyDTO,
UpdateFeeCommDTO,
} from './manage-fee.dto';
import { BadRequestException } from 'src/exceptions/badRequest.exception'; import { BadRequestException } from 'src/exceptions/badRequest.exception';
import { InternalServerException } from 'src/exceptions/internalServerError.exception'; import { InternalServerException } from 'src/exceptions/internalServerError.exception';
import { GetFeeGeneralDTO } from 'src/dto/fee/fee.dto'; import {
CreateBasicFeeDTO, CreateBondRateDTO, CreateCargoRateDTO, CreateCfFeeDTO, CreateCsFeeDTO,
CreateEfFeeDTO, CreateFeeCommDTO, GetFeeGeneralDTO, UpdateBasicFeeDTO, UpdateBondRateDTO,
UpdateCargoRateDTO, UpdateCfFeeDTO, UpdateCsFeeDTO, UpdateEfFeeDTO, UpdateFeeCommDTO
} from 'src/dto/fee/fee.dto';
import { closeOracleDbConnection, handleError } from 'src/utils/helper';
@Injectable() @Injectable()
export class ManageFeeService { export class ManageFeeService {
@ -30,7 +19,7 @@ export class ManageFeeService {
// basic fee // basic fee
async GETBASICFEERATES(body: GetFeeGeneralDTO): Promise<any[]> { async GETBASICFEERATES(body: GetFeeGeneralDTO) {
let connection; let connection;
let rows: any[] = []; let rows: any[] = [];
@ -84,24 +73,9 @@ export class ManageFeeService {
return rows; return rows;
} catch (error) { } catch (error) {
if (error instanceof BadRequestException) { handleError(error, ManageFeeService.name)
this.logger.warn(error.message);
throw error;
}
else if (error.message === "NJS-107: invalid cursor") {
this.logger.warn(error.message);
throw new BadRequestException();
}
this.logger.error('GETBASICFEERATES failed', error.stack || error);
throw new InternalServerException();
} finally { } finally {
if (connection) { await closeOracleDbConnection(connection, ManageFeeService.name)
try {
await connection.close();
} catch (closeErr) {
this.logger.error('Failed to close DB connection', closeErr);
}
}
} }
} }
@ -131,11 +105,11 @@ export class ManageFeeService {
type: oracledb.DB_TYPE_NUMBER, type: oracledb.DB_TYPE_NUMBER,
}, },
P_STARTCARNETVALUE: { P_STARTCARNETVALUE: {
val: body.P_STARTCARNETVALUE, val: body.P_STARTNUMBER,
type: oracledb.DB_TYPE_NUMBER, type: oracledb.DB_TYPE_NUMBER,
}, },
P_ENDCARNETVALUE: { P_ENDCARNETVALUE: {
val: body.P_ENDCARNETVALUE, val: body.P_ENDNUMBER,
type: oracledb.DB_TYPE_NUMBER, type: oracledb.DB_TYPE_NUMBER,
}, },
P_EFFDATE: { P_EFFDATE: {
@ -171,20 +145,9 @@ export class ManageFeeService {
return { statusCode: 201, message: "Created Successfully" }; return { statusCode: 201, message: "Created Successfully" };
} catch (error) { } catch (error) {
if (error instanceof BadRequestException) { handleError(error, ManageFeeService.name)
this.logger.warn(error.message);
throw error;
}
this.logger.error('CREATEBASICFEE failed', error.stack || error);
throw new InternalServerException();
} finally { } finally {
if (connection) { await closeOracleDbConnection(connection, ManageFeeService.name)
try {
await connection.close();
} catch (closeErr) {
this.logger.error('Failed to close DB connection', closeErr);
}
}
} }
} }
@ -243,26 +206,15 @@ export class ManageFeeService {
return { statusCode: 200, message: "Updated Successfully" }; return { statusCode: 200, message: "Updated Successfully" };
} catch (error) { } catch (error) {
if (error instanceof BadRequestException) { handleError(error, ManageFeeService.name)
this.logger.warn(error.message);
throw error;
}
this.logger.error('UPDATEBASICFEE failed', error.stack || error);
throw new InternalServerException();
} finally { } finally {
if (connection) { await closeOracleDbConnection(connection, ManageFeeService.name)
try {
await connection.close();
} catch (closeErr) {
this.logger.error('Failed to close DB connection', closeErr);
}
}
} }
} }
// bond rate // bond rate
async GETBONDRATES(body: GetFeeGeneralDTO): Promise<any[]> { async GETBONDRATES(body: GetFeeGeneralDTO) {
let connection; let connection;
let rows: any = []; let rows: any = [];
try { try {
@ -319,24 +271,9 @@ export class ManageFeeService {
return rows; return rows;
} catch (error) { } catch (error) {
if (error instanceof BadRequestException) { handleError(error, ManageFeeService.name)
this.logger.warn(error.message);
throw error;
}
else if (error.message === "NJS-107: invalid cursor") {
this.logger.warn(error.message);
throw new BadRequestException();
}
this.logger.error('GETBONDRATES failed', error.stack || error);
throw new InternalServerException();
} finally { } finally {
if (connection) { await closeOracleDbConnection(connection, ManageFeeService.name)
try {
await connection.close();
} catch (closeErr) {
this.logger.error('Failed to close DB connection', closeErr);
}
}
} }
} }
@ -415,20 +352,9 @@ export class ManageFeeService {
return { statusCode: 201, message: "Created Successfully" }; return { statusCode: 201, message: "Created Successfully" };
} catch (error) { } catch (error) {
if (error instanceof BadRequestException) { handleError(error, ManageFeeService.name)
this.logger.warn(error.message);
throw error;
}
this.logger.error('CREATEBONDRATE failed', error.stack || error);
throw new InternalServerException();
} finally { } finally {
if (connection) { await closeOracleDbConnection(connection, ManageFeeService.name)
try {
await connection.close();
} catch (closeErr) {
this.logger.error('Failed to close DB connection', closeErr);
}
}
} }
} }
@ -487,20 +413,9 @@ export class ManageFeeService {
return { statusCode: 200, message: "Updated Successfully" }; return { statusCode: 200, message: "Updated Successfully" };
} catch (error) { } catch (error) {
if (error instanceof BadRequestException) { handleError(error, ManageFeeService.name)
this.logger.warn(error.message);
throw error;
}
this.logger.error('UPDATEBONDRATE failed', error.stack || error);
throw new InternalServerException();
} finally { } finally {
if (connection) { await closeOracleDbConnection(connection, ManageFeeService.name)
try {
await connection.close();
} catch (closeErr) {
this.logger.error('Failed to close DB connection', closeErr);
}
}
} }
} }
@ -653,20 +568,9 @@ export class ManageFeeService {
return { statusCode: 201, message: "Created Successfully" }; return { statusCode: 201, message: "Created Successfully" };
} catch (error) { } catch (error) {
if (error instanceof BadRequestException) { handleError(error, ManageFeeService.name)
this.logger.warn(error.message);
throw error;
}
this.logger.error('CREATECARGORATE failed', error.stack || error);
throw new InternalServerException();
} finally { } finally {
if (connection) { await closeOracleDbConnection(connection, ManageFeeService.name)
try {
await connection.close();
} catch (closeErr) {
this.logger.error('Failed to close DB connection', closeErr);
}
}
} }
} }
@ -725,26 +629,15 @@ export class ManageFeeService {
return { statusCode: 200, message: "Updated Successfully" }; return { statusCode: 200, message: "Updated Successfully" };
} catch (error) { } catch (error) {
if (error instanceof BadRequestException) { handleError(error, ManageFeeService.name)
this.logger.warn(error.message);
throw error;
}
this.logger.error('UPDATECARGORATE failed', error.stack || error);
throw new InternalServerException();
} finally { } finally {
if (connection) { await closeOracleDbConnection(connection, ManageFeeService.name)
try {
await connection.close();
} catch (closeErr) {
this.logger.error('Failed to close DB connection', closeErr);
}
}
} }
} }
// counter foil // counter foil
async GETCFFEERATES(body: GetFeeGeneralDTO): Promise<any[]> { async GETCFFEERATES(body: GetFeeGeneralDTO) {
let connection; let connection;
let rows: any = []; let rows: any = [];
try { try {
@ -798,24 +691,9 @@ export class ManageFeeService {
return rows; return rows;
} catch (error) { } catch (error) {
if (error instanceof BadRequestException) { handleError(error, ManageFeeService.name)
this.logger.warn(error.message);
throw error;
}
else if (error.message === "NJS-107: invalid cursor") {
this.logger.warn(error.message);
throw new BadRequestException();
}
this.logger.error('GETCFFEERATES failed', error.stack || error);
throw new InternalServerException();
} finally { } finally {
if (connection) { await closeOracleDbConnection(connection, ManageFeeService.name)
try {
await connection.close();
} catch (closeErr) {
this.logger.error('Failed to close DB connection', closeErr);
}
}
} }
} }
@ -894,20 +772,9 @@ export class ManageFeeService {
return { statusCode: 201, message: "Created Successfully" }; return { statusCode: 201, message: "Created Successfully" };
} catch (error) { } catch (error) {
if (error instanceof BadRequestException) { handleError(error, ManageFeeService.name)
this.logger.warn(error.message);
throw error;
}
this.logger.error('CREATECFFEE failed', error.stack || error);
throw new InternalServerException();
} finally { } finally {
if (connection) { await closeOracleDbConnection(connection, ManageFeeService.name)
try {
await connection.close();
} catch (closeErr) {
this.logger.error('Failed to close DB connection', closeErr);
}
}
} }
} }
@ -966,27 +833,16 @@ export class ManageFeeService {
return { statusCode: 200, message: "Updated Successfully" }; return { statusCode: 200, message: "Updated Successfully" };
} catch (error) { } catch (error) {
if (error instanceof BadRequestException) { handleError(error, ManageFeeService.name)
this.logger.warn(error.message);
throw error;
}
this.logger.error('UPDATECFFEE failed', error.stack || error);
throw new InternalServerException();
} finally { } finally {
if (connection) { await closeOracleDbConnection(connection, ManageFeeService.name)
try {
await connection.close();
} catch (closeErr) {
this.logger.error('Failed to close DB connection', closeErr);
}
}
} }
} }
// continuation sheet // continuation sheet
async GETCSFEERATES(body: GetFeeGeneralDTO): Promise<any[]> { async GETCSFEERATES(body: GetFeeGeneralDTO) {
let connection; let connection;
let rows: any = []; let rows: any = [];
try { try {
@ -1040,24 +896,9 @@ export class ManageFeeService {
return rows; return rows;
} catch (error) { } catch (error) {
if (error instanceof BadRequestException) { handleError(error, ManageFeeService.name)
this.logger.warn(error.message);
throw error;
}
else if (error.message === "NJS-107: invalid cursor") {
this.logger.warn(error.message);
throw new BadRequestException();
}
this.logger.error('GETCSFEERATES failed', error.stack || error);
throw new InternalServerException();
} finally { } finally {
if (connection) { await closeOracleDbConnection(connection, ManageFeeService.name)
try {
await connection.close();
} catch (closeErr) {
this.logger.error('Failed to close DB connection', closeErr);
}
}
} }
} }
@ -1126,20 +967,9 @@ export class ManageFeeService {
return { statusCode: 201, message: "Created Successfully" }; return { statusCode: 201, message: "Created Successfully" };
} catch (error) { } catch (error) {
if (error instanceof BadRequestException) { handleError(error, ManageFeeService.name)
this.logger.warn(error.message);
throw error;
}
this.logger.error('CREATECSFEE failed', error.stack || error);
throw new InternalServerException();
} finally { } finally {
if (connection) { await closeOracleDbConnection(connection, ManageFeeService.name)
try {
await connection.close();
} catch (closeErr) {
this.logger.error('Failed to close DB connection', closeErr);
}
}
} }
} }
@ -1198,26 +1028,15 @@ export class ManageFeeService {
return { statusCode: 200, message: "Updated Successfully" }; return { statusCode: 200, message: "Updated Successfully" };
} catch (error) { } catch (error) {
if (error instanceof BadRequestException) { handleError(error, ManageFeeService.name)
this.logger.warn(error.message);
throw error;
}
this.logger.error('UPDATECSFEE failed', error.stack || error);
throw new InternalServerException();
} finally { } finally {
if (connection) { await closeOracleDbConnection(connection, ManageFeeService.name)
try {
await connection.close();
} catch (closeErr) {
this.logger.error('Failed to close DB connection', closeErr);
}
}
} }
} }
// expedited fee // expedited fee
async GETEFFEERATES(body: GetFeeGeneralDTO): Promise<any[]> { async GETEFFEERATES(body: GetFeeGeneralDTO) {
let connection; let connection;
let rows: any = []; let rows: any = [];
try { try {
@ -1271,24 +1090,9 @@ export class ManageFeeService {
return rows; return rows;
} catch (error) { } catch (error) {
if (error instanceof BadRequestException) { handleError(error, ManageFeeService.name)
this.logger.warn(error.message);
throw error;
}
else if (error.message === "NJS-107: invalid cursor") {
this.logger.warn(error.message);
throw new BadRequestException();
}
this.logger.error('GETEFFEERATES failed', error.stack || error);
throw new InternalServerException();
} finally { } finally {
if (connection) { await closeOracleDbConnection(connection, ManageFeeService.name)
try {
await connection.close();
} catch (closeErr) {
this.logger.error('Failed to close DB connection', closeErr);
}
}
} }
} }
@ -1373,20 +1177,9 @@ export class ManageFeeService {
return { statusCode: 201, message: "Created Successfully" }; return { statusCode: 201, message: "Created Successfully" };
} catch (error) { } catch (error) {
if (error instanceof BadRequestException) { handleError(error, ManageFeeService.name)
this.logger.warn(error.message);
throw error;
}
this.logger.error('CREATEEFFEE failed', error.stack || error);
throw new InternalServerException();
} finally { } finally {
if (connection) { await closeOracleDbConnection(connection, ManageFeeService.name)
try {
await connection.close();
} catch (closeErr) {
this.logger.error('Failed to close DB connection', closeErr);
}
}
} }
} }
@ -1445,26 +1238,15 @@ export class ManageFeeService {
return { statusCode: 200, message: "Updated Successfully" }; return { statusCode: 200, message: "Updated Successfully" };
} catch (error) { } catch (error) {
if (error instanceof BadRequestException) { handleError(error, ManageFeeService.name)
this.logger.warn(error.message);
throw error;
}
this.logger.error('UPDATEEFFEE failed', error.stack || error);
throw new InternalServerException();
} finally { } finally {
if (connection) { await closeOracleDbConnection(connection, ManageFeeService.name)
try {
await connection.close();
} catch (closeErr) {
this.logger.error('Failed to close DB connection', closeErr);
}
}
} }
} }
// fee comm // fee comm
async GETFEECOMM(body: GetFeeGeneralDTO): Promise<any[]> { async GETFEECOMM(body: GetFeeGeneralDTO) {
let connection; let connection;
let rows: any = []; let rows: any = [];
try { try {
@ -1518,24 +1300,9 @@ export class ManageFeeService {
return rows; return rows;
} catch (error) { } catch (error) {
if (error instanceof BadRequestException) { handleError(error, ManageFeeService.name)
this.logger.warn(error.message);
throw error;
}
else if (error.message === "NJS-107: invalid cursor") {
this.logger.warn(error.message);
throw new BadRequestException();
}
this.logger.error('GETFEECOMM failed\n', error.stack || error);
throw new InternalServerException();
} finally { } finally {
if (connection) { await closeOracleDbConnection(connection, ManageFeeService.name)
try {
await connection.close();
} catch (closeErr) {
this.logger.error('Failed to close DB connection', closeErr);
}
}
} }
} }
@ -1599,20 +1366,9 @@ export class ManageFeeService {
return { statusCode: 201, message: "Created Successfully" }; return { statusCode: 201, message: "Created Successfully" };
} catch (error) { } catch (error) {
if (error instanceof BadRequestException) { handleError(error, ManageFeeService.name)
this.logger.warn(error.message);
throw error;
}
this.logger.error('CREATEFEECOMM failed', error.stack || error);
throw new InternalServerException();
} finally { } finally {
if (connection) { await closeOracleDbConnection(connection, ManageFeeService.name)
try {
await connection.close();
} catch (closeErr) {
this.logger.error('Failed to close DB connection', closeErr);
}
}
} }
} }
@ -1672,20 +1428,9 @@ export class ManageFeeService {
return { statusCode: 200, message: "Updated Successfully" }; return { statusCode: 200, message: "Updated Successfully" };
} catch (error) { } catch (error) {
if (error instanceof BadRequestException) { handleError(error, ManageFeeService.name)
this.logger.warn(error.message);
throw error;
}
this.logger.error('UPDATEFEECOMM failed', error.stack || error);
throw new InternalServerException();
} finally { } finally {
if (connection) { await closeOracleDbConnection(connection, ManageFeeService.name)
try {
await connection.close();
} catch (closeErr) {
this.logger.error('Failed to close DB connection', closeErr);
}
}
} }
} }
} }

View File

@ -696,20 +696,9 @@ export class ManageHoldersService {
// return fres // return fres
} catch (error) { } catch (error) {
if (error instanceof BadRequestException) { handleError(error, ManageHoldersService.name)
this.logger.warn(error.message);
throw error;
}
this.logger.error('CREATEFEECOMM failed', error.stack || error);
throw new InternalServerException();
} finally { } finally {
if (connection) { await closeOracleDbConnection(connection, ManageHoldersService.name)
try {
await connection.close();
} catch (closeErr) {
this.logger.error('Failed to close DB connection', closeErr);
}
}
} }
}; };
GetHolderRecord = async (body: GetHolderDTO) => { GetHolderRecord = async (body: GetHolderDTO) => {
@ -763,20 +752,9 @@ export class ManageHoldersService {
return { P_CURSOR: P_CURSOR_rows }; return { P_CURSOR: P_CURSOR_rows };
} catch (error) { } catch (error) {
if (error instanceof BadRequestException) { handleError(error, ManageHoldersService.name)
this.logger.warn(error.message);
throw error;
}
this.logger.error('CREATEFEECOMM failed', error.stack || error);
throw new InternalServerException();
} finally { } finally {
if (connection) { await closeOracleDbConnection(connection, ManageHoldersService.name)
try {
await connection.close();
} catch (closeErr) {
this.logger.error('Failed to close DB connection', closeErr);
}
}
} }
}; };
UpdateHolderContact = async (body: UpdateHolderContactDTO) => { UpdateHolderContact = async (body: UpdateHolderContactDTO) => {
@ -912,20 +890,9 @@ export class ManageHoldersService {
// return fres // return fres
} catch (error) { } catch (error) {
if (error instanceof BadRequestException) { handleError(error, ManageHoldersService.name)
this.logger.warn(error.message);
throw error;
}
this.logger.error('CREATEFEECOMM failed', error.stack || error);
throw new InternalServerException();
} finally { } finally {
if (connection) { await closeOracleDbConnection(connection, ManageHoldersService.name)
try {
await connection.close();
} catch (closeErr) {
this.logger.error('Failed to close DB connection', closeErr);
}
}
} }
}; };
GetHolderContacts = async (body: GetHolderDTO) => { GetHolderContacts = async (body: GetHolderDTO) => {
@ -979,20 +946,9 @@ export class ManageHoldersService {
return { P_CURSOR: P_CURSOR_rows }; return { P_CURSOR: P_CURSOR_rows };
} catch (error) { } catch (error) {
if (error instanceof BadRequestException) { handleError(error, ManageHoldersService.name)
this.logger.warn(error.message);
throw error;
}
this.logger.error('CREATEFEECOMM failed', error.stack || error);
throw new InternalServerException();
} finally { } finally {
if (connection) { await closeOracleDbConnection(connection, ManageHoldersService.name)
try {
await connection.close();
} catch (closeErr) {
this.logger.error('Failed to close DB connection', closeErr);
}
}
} }
}; };
InactivateHolder = async (body: HolderActivateOrInactivateDTO) => { InactivateHolder = async (body: HolderActivateOrInactivateDTO) => {
@ -1051,20 +1007,9 @@ export class ManageHoldersService {
return { P_CURSOR: P_CURSOR_rows }; return { P_CURSOR: P_CURSOR_rows };
} catch (error) { } catch (error) {
if (error instanceof BadRequestException) { handleError(error, ManageHoldersService.name)
this.logger.warn(error.message);
throw error;
}
this.logger.error('CREATEFEECOMM failed', error.stack || error);
throw new InternalServerException();
} finally { } finally {
if (connection) { await closeOracleDbConnection(connection, ManageHoldersService.name)
try {
await connection.close();
} catch (closeErr) {
this.logger.error('Failed to close DB connection', closeErr);
}
}
} }
}; };
ReactivateHolder = async (body: HolderActivateOrInactivateDTO) => { ReactivateHolder = async (body: HolderActivateOrInactivateDTO) => {
@ -1123,20 +1068,9 @@ export class ManageHoldersService {
return { P_CURSOR: P_CURSOR_rows }; return { P_CURSOR: P_CURSOR_rows };
} catch (error) { } catch (error) {
if (error instanceof BadRequestException) { handleError(error, ManageHoldersService.name)
this.logger.warn(error.message);
throw error;
}
this.logger.error('CREATEFEECOMM failed', error.stack || error);
throw new InternalServerException();
} finally { } finally {
if (connection) { await closeOracleDbConnection(connection, ManageHoldersService.name)
try {
await connection.close();
} catch (closeErr) {
this.logger.error('Failed to close DB connection', closeErr);
}
}
} }
}; };
InactivateHolderContact = async (body: HolderContactActivateOrInactivateDTO) => { InactivateHolderContact = async (body: HolderContactActivateOrInactivateDTO) => {
@ -1195,20 +1129,9 @@ export class ManageHoldersService {
return { P_CURSOR: P_CURSOR_rows }; return { P_CURSOR: P_CURSOR_rows };
} catch (error) { } catch (error) {
if (error instanceof BadRequestException) { handleError(error, ManageHoldersService.name)
this.logger.warn(error.message);
throw error;
}
this.logger.error('CREATEFEECOMM failed', error.stack || error);
throw new InternalServerException();
} finally { } finally {
if (connection) { await closeOracleDbConnection(connection, ManageHoldersService.name)
try {
await connection.close();
} catch (closeErr) {
this.logger.error('Failed to close DB connection', closeErr);
}
}
} }
}; };
ReactivateHolderContact = async (body: HolderContactActivateOrInactivateDTO) => { ReactivateHolderContact = async (body: HolderContactActivateOrInactivateDTO) => {
@ -1267,20 +1190,9 @@ export class ManageHoldersService {
return { P_CURSOR: P_CURSOR_rows }; return { P_CURSOR: P_CURSOR_rows };
} catch (error) { } catch (error) {
if (error instanceof BadRequestException) { handleError(error, ManageHoldersService.name)
this.logger.warn(error.message);
throw error;
}
this.logger.error('CREATEFEECOMM failed', error.stack || error);
throw new InternalServerException();
} finally { } finally {
if (connection) { await closeOracleDbConnection(connection, ManageHoldersService.name)
try {
await connection.close();
} catch (closeErr) {
this.logger.error('Failed to close DB connection', closeErr);
}
}
} }
}; };
} }

View File

@ -12,7 +12,7 @@ export class UserMaintenanceController {
// SP_USER_DETAILS // SP_USER_DETAILS
@Get('GetUserDetails/:p_userid') @Get('GetUserDetails/:P_USERID')
async GetPreparers(@Param() params: USERID_DTO) { async GetPreparers(@Param() params: USERID_DTO) {
return await this.userMaintenanceService.GetSPUserDetails(params); return await this.userMaintenanceService.GetSPUserDetails(params);
} }
@ -36,7 +36,7 @@ export class UserMaintenanceController {
// SP LOGINS // SP LOGINS
@Get('GetSPLogins/:p_spid') @Get('GetSPLogins/:P_SPID')
async GetSPLogins(@Param() params: SPID_DTO) { async GetSPLogins(@Param() params: SPID_DTO) {
return await this.userMaintenanceService.GetSPLogins(params); return await this.userMaintenanceService.GetSPLogins(params);
} }
@ -48,12 +48,12 @@ export class UserMaintenanceController {
// CLIENT LOGINS // CLIENT LOGINS
@Get('GetClientloginsBySPID/:p_spid') @Get('GetClientloginsBySPID/:P_SPID')
async GetClientloginsBySPID(@Param() params: SPID_DTO) { async GetClientloginsBySPID(@Param() params: SPID_DTO) {
return await this.userMaintenanceService.GetSPLogins(params); return await this.userMaintenanceService.GetSPLogins(params);
} }
@Get('GetClientloginsByClientID/:p_spid/:p_clientid') @Get('GetClientloginsByClientID/:P_SPID/:P_CLIENTID')
async GetClientloginsByClientID(@Param() params: SPID_CLIENTID_DTO) { async GetClientloginsByClientID(@Param() params: SPID_CLIENTID_DTO) {
return await this.userMaintenanceService.GetSPLogins(params); return await this.userMaintenanceService.GetSPLogins(params);
} }