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';
@Module({
imports: [MssqlModule, AuthModule, DbModule, OracleModule],
imports: [ AuthModule, DbModule, OracleModule],
controllers: [],
providers: [],
})

View File

@ -3,7 +3,7 @@
// carnet
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 {
@ApiProperty({ required: true })
@ -25,3 +25,14 @@ export class CARNET_TYPE_DTO {
@IsDefined({ message: 'Property p_carnettype is required' })
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 { 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(
SPID_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 { IsDefined, IsInt, IsNumber, Max, Min } from "class-validator";
import { IsDefined, IsInt, IsNumber, IsString, Length, Max, Min } from "class-validator";
export class CLIENTLOCATIONID_DTO {
@ApiProperty({ required: true })
@ -12,3 +12,13 @@ export class CLIENTLOCATIONID_DTO {
@IsDefined({ message: 'Property P_CLIENTLOCATIONID is required' })
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 { ManageClientsService } from './manage-clients.service';
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')
export class ManageClientsController {
@ -72,8 +77,4 @@ export class ManageClientsController {
) {
return this.manageClientsService.GetPreparerLocByClientid(body);
}
}

View File

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

View File

@ -1,8 +1,11 @@
import { Body, Controller, Get, Patch, Post, Query } from '@nestjs/common';
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 { 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')
export class ManageFeeController {

View File

@ -1,11 +1,14 @@
import { Injectable, Logger } from '@nestjs/common';
import { MssqlDBService } from 'src/db/db.service';
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 { Connection, Request } 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()
export class ManageFeeService {
@ -43,8 +46,8 @@ export class ManageFeeService {
connection = await this.mssqlDBService.getConnection();
const request = new Request(connection);
request.input('P_SPID', mssql.Int, body.P_SPID);
request.input('P_STARTCARNETVALUE', mssql.Int, body.P_STARTCARNETVALUE);
request.input('P_ENDCARNETVALUE', mssql.Int, body.P_ENDCARNETVALUE);
request.input('P_STARTCARNETVALUE', mssql.Int, body.P_STARTNUMBER);
request.input('P_ENDCARNETVALUE', mssql.Int, body.P_ENDNUMBER);
request.input('P_EFFDATE', mssql.VarChar(100), body.P_EFFDATE);
request.input('P_FEES', mssql.Int, body.P_FEES);
request.input('P_USERID', mssql.VarChar(100), body.P_USERID);

View File

@ -270,7 +270,7 @@ export class CarnetApplicationService {
);
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_CURSOR: { dir: oracledb.BIND_OUT, type: oracledb.CURSOR },
// P_CURSOR: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT }
@ -305,7 +305,7 @@ export class CarnetApplicationService {
);
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_CURSOR: { dir: oracledb.BIND_OUT, type: oracledb.CURSOR },
// P_CURSOR: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT }
@ -340,7 +340,7 @@ export class CarnetApplicationService {
);
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_CURSOR: { dir: oracledb.BIND_OUT, type: oracledb.CURSOR },
// P_CURSOR: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT }
@ -375,7 +375,7 @@ export class CarnetApplicationService {
);
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_CURSOR: { dir: oracledb.BIND_OUT, type: oracledb.CURSOR },
// P_CURSOR: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT }
@ -410,7 +410,7 @@ export class CarnetApplicationService {
);
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_CURSOR: { dir: oracledb.BIND_OUT, type: oracledb.CURSOR },
// P_CURSOR: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT }

View File

@ -11,11 +11,9 @@ import {
import { HomePageService } from './home-page.service';
import { ApiTags } from '@nestjs/swagger';
import {
SaveCarnetApplicationDTO,
TransmitApplicationtoProcessDTO,
GetCarnetDetailsbyCarnetStatusDTO,
} from './home-page.dto';
import { SPID_DTO } from 'src/dto/sp/sp-property.dto';
import { GetCarnetDetailsbyCarnetStatusDTO } from 'src/dto/carnet/carnet.dto';
import { EMAIL_DTO, USERID_DTO } from 'src/dto/property.dto';
@ApiTags('HomePage - Oracle')
@Controller('oracle')
@ -23,58 +21,32 @@ export class HomePageController {
constructor(private readonly homePageService: HomePageService) { }
@Get('GetHomePageData/:id')
GetHomePageData(@Param('id', ParseIntPipe) id: number) {
return this.homePageService.GetHomePageData(id);
@Get('GetHomePageData/:P_SPID')
GetHomePageData(@Param() params: SPID_DTO) {
return this.homePageService.GetHomePageData(params);
}
@Get('GetCarnetSummaryData/:userid')
GetCarnetSummaryData(@Param('userid') id: string) {
return this.homePageService.GetCarnetSummaryData(id);
@Get('GetCarnetSummaryData/:P_EMAILADDR')
GetCarnetSummaryData(@Param() params: EMAIL_DTO) {
return this.homePageService.GetCarnetSummaryData(params);
}
@Get('GetCarnetDetailsbyCarnetStatus/:p_spid/:p_userid/:p_CarnetStatus')
GetCarnetDetailsbyCarnetStatus(
@Param('p_spid', ParseIntPipe) p_spid: number,
@Param('p_userid') p_userid: string,
@Param('p_CarnetStatus') p_CarnetStatus: string,
) {
if (!p_spid || !p_userid || !p_CarnetStatus) {
throw new BadRequestException(
'spid, userid and Carnet Status are required',
);
} else if (Number(p_userid) || Number(p_CarnetStatus)) {
throw new BadRequestException(
'Param p_userid and p_CarnetStatus should be string',
);
}
try {
const body: GetCarnetDetailsbyCarnetStatusDTO = {
p_spid: p_spid,
p_userid: p_userid,
p_CarnetStatus: p_CarnetStatus,
};
return this.homePageService.GetCarnetDetailsbyCarnetStatus(body);
} catch (err) {
return new BadRequestException({
message: 'Validation faileda',
error: err.message,
});
}
@Get('GetCarnetDetailsbyCarnetStatus/:P_SPID/:P_USERID/:P_CARNETSTATUS')
GetCarnetDetailsbyCarnetStatus(@Param() params: GetCarnetDetailsbyCarnetStatusDTO) {
return this.homePageService.GetCarnetDetailsbyCarnetStatus(params);
}
// NOTE : this has been moved to carent-application module
// @Post('/oracle/SaveCarnetApplication')
SaveCarnetApplication(@Body() body: SaveCarnetApplicationDTO) {
return this.homePageService.SaveCarnetApplication(body);
}
// SaveCarnetApplication(@Body() body: SaveCarnetApplicationDTO) {
// return this.homePageService.SaveCarnetApplication(body);
// }
// NOTE : this has been moved to carent-application module
// @Post('/oracle/TransmitApplicationtoProcess')
TransmitApplicationtoProcess(@Body() body: TransmitApplicationtoProcessDTO) {
return this.homePageService.TransmitApplicationtoProcess(body);
}
// TransmitApplicationtoProcess(@Body() body: TransmitApplicationtoProcessDTO) {
// return this.homePageService.TransmitApplicationtoProcess(body);
// }
}

View File

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

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

View File

@ -1,15 +1,10 @@
import { Body, Controller, Get, Post, Put, Query } from '@nestjs/common';
import { ManageClientsService } from './manage-clients.service';
import {
CreateClientContactsDTO,
CreateClientDataDTO,
CreateClientLocationsDTO,
GetPreparerByClientidContactsByClientidLocByClientidDTO,
GetPreparersDTO,
UpdateClientContactsDTO,
UpdateClientDTO,
UpdateClientLocationsDTO,
} from './manage-clients.dto';
CreateClientContactsDTO, CreateClientDataDTO,
CreateClientLocationsDTO, GetPreparerByClientidContactsByClientidLocByClientidDTO,
GetPreparersDTO, UpdateClientContactsDTO, UpdateClientDTO, UpdateClientLocationsDTO
} from 'src/dto/client/client.dto';
import { ApiTags } from '@nestjs/swagger';
@Controller('oracle')

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

View File

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

View File

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