diff --git a/src/app.module.ts b/src/app.module.ts index dcb27a8..5c383e8 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -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: [], }) diff --git a/src/dto/carnet/carnet-property.dto.ts b/src/dto/carnet/carnet-property.dto.ts index fe05f38..367679a 100644 --- a/src/dto/carnet/carnet-property.dto.ts +++ b/src/dto/carnet/carnet-property.dto.ts @@ -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 }) @@ -24,4 +24,15 @@ export class CARNET_TYPE_DTO { @IsString({ message: 'Property p_carnettype must be a string' }) @IsDefined({ message: 'Property p_carnettype is required' }) P_CARNETTYPE: string; -} \ No newline at end of file +} + +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; +} + diff --git a/src/dto/carnet/carnet.dto.ts b/src/dto/carnet/carnet.dto.ts new file mode 100644 index 0000000..88af58c --- /dev/null +++ b/src/dto/carnet/carnet.dto.ts @@ -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 +) { } \ No newline at end of file diff --git a/src/dto/client/client-property.dto.ts b/src/dto/client/client-property.dto.ts new file mode 100644 index 0000000..3ee2bc9 --- /dev/null +++ b/src/dto/client/client-property.dto.ts @@ -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[]; +} + diff --git a/src/dto/client/client.dto.ts b/src/dto/client/client.dto.ts new file mode 100644 index 0000000..bc81433 --- /dev/null +++ b/src/dto/client/client.dto.ts @@ -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 +) { } diff --git a/src/dto/fee/fee-property.dto.ts b/src/dto/fee/fee-property.dto.ts index 8b13789..4f5a5ed 100644 --- a/src/dto/fee/fee-property.dto.ts +++ b/src/dto/fee/fee-property.dto.ts @@ -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; +} \ No newline at end of file diff --git a/src/dto/fee/fee.dto.ts b/src/dto/fee/fee.dto.ts index e5880ab..bf41231 100644 --- a/src/dto/fee/fee.dto.ts +++ b/src/dto/fee/fee.dto.ts @@ -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 -) {} \ No newline at end of file +) { } + +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() +// } \ No newline at end of file diff --git a/src/dto/location/location-property.dto.ts b/src/dto/location/location-property.dto.ts index f6aec48..31178c1 100644 --- a/src/dto/location/location-property.dto.ts +++ b/src/dto/location/location-property.dto.ts @@ -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 }) @@ -11,4 +11,14 @@ export class CLIENTLOCATIONID_DTO { @IsNumber({}, { message: 'Property P_CLIENTLOCATIONID must be a number' }) @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; } \ No newline at end of file diff --git a/src/dto/property.dto.ts b/src/dto/property.dto.ts index 93a31da..74ddeba 100644 --- a/src/dto/property.dto.ts +++ b/src/dto/property.dto.ts @@ -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; +} diff --git a/src/mssql/manage-clients/manage-clients.controller.ts b/src/mssql/manage-clients/manage-clients.controller.ts index 80870b2..a72037f 100644 --- a/src/mssql/manage-clients/manage-clients.controller.ts +++ b/src/mssql/manage-clients/manage-clients.controller.ts @@ -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 { @@ -71,9 +76,5 @@ export class ManageClientsController { @Query() body: GetPreparerByClientidContactsByClientidLocByClientidDTO, ) { return this.manageClientsService.GetPreparerLocByClientid(body); - } - - - - + } } diff --git a/src/mssql/manage-clients/manage-clients.service.ts b/src/mssql/manage-clients/manage-clients.service.ts index 0a1677e..1afbbde 100644 --- a/src/mssql/manage-clients/manage-clients.service.ts +++ b/src/mssql/manage-clients/manage-clients.service.ts @@ -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 }; diff --git a/src/mssql/manage-fee/manage-fee.controller.ts b/src/mssql/manage-fee/manage-fee.controller.ts index ca51ae5..b69ec15 100644 --- a/src/mssql/manage-fee/manage-fee.controller.ts +++ b/src/mssql/manage-fee/manage-fee.controller.ts @@ -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 { @@ -18,7 +21,7 @@ export class ManageFeeController { @ApiTags('Manage Fee - Mssql') @Post('/CreateBasicFee') CreateBasicFee(@Body() body: CreateBasicFeeDTO) { - return this.manageFeeService.CREATEBASICFEE(body); + return this.manageFeeService.CREATEBASICFEE(body); } @ApiTags('Manage Fee - Mssql') diff --git a/src/mssql/manage-fee/manage-fee.service.ts b/src/mssql/manage-fee/manage-fee.service.ts index 2c9e31b..d549520 100644 --- a/src/mssql/manage-fee/manage-fee.service.ts +++ b/src/mssql/manage-fee/manage-fee.service.ts @@ -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); diff --git a/src/oracle/carnet-application/carnet-application.service.ts b/src/oracle/carnet-application/carnet-application.service.ts index 2af127d..b7f6ee3 100644 --- a/src/oracle/carnet-application/carnet-application.service.ts +++ b/src/oracle/carnet-application/carnet-application.service.ts @@ -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 } diff --git a/src/oracle/home-page/home-page.controller.ts b/src/oracle/home-page/home-page.controller.ts index 01d81ae..db2127a 100644 --- a/src/oracle/home-page/home-page.controller.ts +++ b/src/oracle/home-page/home-page.controller.ts @@ -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); + // } } diff --git a/src/oracle/home-page/home-page.dto.ts b/src/oracle/home-page/home-page.dto.ts index c86bf5e..0268761 100644 --- a/src/oracle/home-page/home-page.dto.ts +++ b/src/oracle/home-page/home-page.dto.ts @@ -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; +// } diff --git a/src/oracle/home-page/home-page.service.ts b/src/oracle/home-page/home-page.service.ts index 47b8541..71df3be 100644 --- a/src/oracle/home-page/home-page.service.ts +++ b/src/oracle/home-page/home-page.service.ts @@ -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 = []; @@ -34,24 +32,24 @@ export class HomePageService { const result = await connection.execute( `BEGIN - USERLOGIN_PKG.GetHomePageData( - :P_spid, - :p_basic_details_cur, - :p_contacts_cur, - :p_sequence_cur, - :p_fees_comm_cur, - :p_bf_fee_cur, - :p_cf_Fee_cur, - :p_cont_sheet_fee_cur, - :p_ef_fee_cur, - :p_security_deposit_cur, - :p_param_cur, - :p_region_cur - ); - END;`, + USERLOGIN_PKG.GetHomePageData( + :P_SPID, + :p_basic_details_cur, + :p_contacts_cur, + :p_sequence_cur, + :p_fees_comm_cur, + :p_bf_fee_cur, + :p_cf_Fee_cur, + :p_cont_sheet_fee_cur, + :p_ef_fee_cur, + :p_security_deposit_cur, + :p_param_cur, + :p_region_cur + ); + 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); - END;`, + 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); - END;`, + 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 { diff --git a/src/oracle/manage-clients/manage-clients.controller.ts b/src/oracle/manage-clients/manage-clients.controller.ts index a54b5e2..500e835 100644 --- a/src/oracle/manage-clients/manage-clients.controller.ts +++ b/src/oracle/manage-clients/manage-clients.controller.ts @@ -1,20 +1,15 @@ 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') export class ManageClientsController { - constructor(private readonly manageClientsService: ManageClientsService) {} + constructor(private readonly manageClientsService: ManageClientsService) { } @ApiTags('Manage Clients - Oracle') @Post('CreateNewClients') diff --git a/src/oracle/manage-clients/manage-clients.dto.ts b/src/oracle/manage-clients/manage-clients.dto.ts index 07c9669..10a45ba 100644 --- a/src/oracle/manage-clients/manage-clients.dto.ts +++ b/src/oracle/manage-clients/manage-clients.dto.ts @@ -1,613 +1,613 @@ -import { ApiProperty } from '@nestjs/swagger'; -import { - IsDefined, - IsInt, - IsNumber, - IsOptional, - IsString, - Length, - Max, - Min, - ValidateNested, - IsArray, - IsEmail, -} from 'class-validator'; -import { Transform, Type } from 'class-transformer'; -import { CONTACTSTABLE_ROW_DTO } from 'src/dto/holder/holder.dto'; - -export class p_clientlocaddresstableDTO { - @ApiProperty({ required: true }) - @Length(0, 50, { - message: 'Property Nameof must be between 0 to 50 characters', - }) - @IsString({ message: 'Property Nameof must be a string' }) - @IsDefined({ message: 'Property Nameof is required' }) - Nameof: string; - - @ApiProperty({ required: true }) - @Length(0, 50, { - message: 'Property Address1 must be between 0 to 50 characters', - }) - @IsString({ message: 'Property Address1 must be a string' }) - @IsDefined({ message: 'Property Address1 is required' }) - Address1: string; - - @ApiProperty({ required: false }) - @Length(0, 50, { - message: 'Property Address2 must be between 0 to 50 characters', - }) - @IsString({ message: 'Property Address2 must be a string' }) - @IsOptional() - Address2?: string; - - @ApiProperty({ required: true }) - @Length(0, 30, { - message: 'Property City must be between 0 to 30 characters', - }) - @IsString({ message: 'Property City must be a string' }) - @IsDefined({ message: 'Property City is required' }) - City: string; - - @ApiProperty({ required: true }) - @Length(0, 2, { message: 'Property State must be between 0 to 2 characters' }) - @IsString({ message: 'Property State must be a string' }) - @IsDefined({ message: 'Property State is required' }) - State: string; - - @ApiProperty({ required: true }) - @Length(0, 10, { message: 'Property Zip must be between 0 to 10 characters' }) - @IsString({ message: 'Property Zip must be a string' }) - @IsDefined({ message: 'Property Zip is required' }) - Zip: string; - - @ApiProperty({ required: true }) - @Length(0, 2, { - message: 'Property Country must be between 0 to 2 characters', - }) - @IsString({ message: 'Property Country must be a string' }) - @IsDefined({ message: 'Property Country is required' }) - Country: string; -} - -export class CreateClientDataDTO { - @ApiProperty({ required: true }) - @Max(999999999, { message: 'Property p_spid must not exceed 999999999' }) - @Min(0, { message: 'Property p_spid must be at least 0 or more' }) - @IsInt({ message: 'Property p_spid allows only whole numbers' }) - @IsNumber({}, { message: 'Property p_spid must be a number' }) - @IsDefined({ message: 'Property p_spid is required' }) - p_spid: number; - - @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; - - @ApiProperty({ required: true }) - @Length(0, 20, { - message: 'Property p_lookupcode must be between 0 to 20 characters', - }) - @IsString({ message: 'Property p_lookupcode must be a string' }) - @IsDefined({ message: 'Property p_lookupcode is required' }) - p_lookupcode: string; - - @ApiProperty({ required: true }) - @Length(0, 50, { - message: 'Property p_address1 must be between 0 to 50 characters', - }) - @IsString({ message: 'Property p_address1 must be a string' }) - @IsDefined({ message: 'Property p_address1 is required' }) - p_address1: string; - - @ApiProperty({ required: false }) - @Length(0, 50, { - message: 'Property p_address2 must be between 0 to 50 characters', - }) - @IsString({ message: 'Property p_address2 must be a string' }) - @IsOptional() - p_address2?: string; - - @ApiProperty({ required: true }) - @Length(0, 30, { - message: 'Property p_city must be between 0 to 30 characters', - }) - @IsString({ message: 'Property p_city must be a string' }) - @IsDefined({ message: 'Property p_city is required' }) - p_city: string; - - @ApiProperty({ required: true }) - @Length(0, 2, { - message: 'Property p_state must be between 0 to 2 characters', - }) - @IsString({ message: 'Property p_state must be a string' }) - @IsDefined({ message: 'Property p_state is required' }) - p_state: string; - - @ApiProperty({ required: false }) - @Length(0, 10, { - message: 'Property p_zip must be between 0 to 10 characters', - }) - @IsString({ message: 'Property p_zip must be a string' }) - @IsOptional() - p_zip?: string; - - @ApiProperty({ required: false }) - @Length(0, 2, { - message: 'Property p_country must be between 0 to 2 characters', - }) - @IsString({ message: 'Property p_country must be a string' }) - @IsOptional() - p_country?: string; - - @ApiProperty({ required: true }) - @Length(0, 2, { - message: 'Property p_issuingregion must be between 0 to 2 characters', - }) - @IsString({ message: 'Property p_issuingregion must be a string' }) - @IsDefined({ message: 'Property p_issuingregion is required' }) - p_issuingregion: string; - - @ApiProperty({ required: true }) - @Length(0, 2, { - message: 'Property p_revenuelocation must be between 0 to 2 characters', - }) - @IsString({ message: 'Property p_revenuelocation must be a string' }) - @IsDefined({ message: 'Property p_revenuelocation is required' }) - p_revenuelocation: string; - - @ApiProperty({ required: true }) - @Length(0, 100, { - message: 'Property p_userid must be between 0 to 100 characters', - }) - @IsString({ message: 'Property p_userid must be a string' }) - @IsDefined({ message: 'Property p_userid is required' }) - p_userid: string; - - // @ApiProperty({ required: true, type: () => [p_contactstableDTO] }) - // @Type(() => p_contactstableDTO) - // @ValidateNested({ each: true }) - // @IsArray({ message: 'Property p_contactstable allows only array type' }) - // @IsDefined({ message: 'Property p_contactstable is required' }) - // p_contactstable: p_contactstableDTO[]; - - // @ApiProperty({ required: true, type: () => [p_clientlocaddresstableDTO] }) - // @Type(() => p_clientlocaddresstableDTO) - // @ValidateNested({ each: true }) - // @IsArray({ - // message: 'Property p_clientlocaddresstable allows only array type', - // }) - // @IsDefined({ message: 'Property p_clientlocaddresstable is required' }) - // p_clientlocaddresstable: p_clientlocaddresstableDTO[]; -} - -export class UpdateClientDTO { - @ApiProperty({ required: true }) - @Max(999999999, { message: 'Property p_spid must not exceed 999999999' }) - @Min(0, { message: 'Property p_spid must be at least 0 or more' }) - @IsInt({ message: 'Property p_spid allows only whole numbers' }) - @IsNumber({}, { message: 'Property p_spid must be a number' }) - @IsDefined({ message: 'Property p_spid is required' }) - p_spid: number; - - @ApiProperty({ required: true }) - @Max(999999999, { message: 'Property p_clientid must not exceed 999999999' }) - @Min(0, { message: 'Property p_clientid must be at least 0 or more' }) - @IsInt({ message: 'Property p_clientid allows only whole numbers' }) - @IsNumber({}, { message: 'Property p_clientid must be a number' }) - @IsDefined({ message: 'Property p_clientid is required' }) - p_clientid: number; - - @ApiProperty({ required: true }) - @Length(0, 50, { - message: 'Property p_preparername must be between 0 to 50 characters', - }) - @IsString({ message: 'Property p_preparername must be a string' }) - @IsDefined({ message: 'Property p_preparername is required' }) - p_preparername: string; - - @ApiProperty({ required: true }) - @Length(0, 50, { - message: 'Property p_address1 must be between 0 to 50 characters', - }) - @IsString({ message: 'Property p_address1 must be a string' }) - @IsDefined({ message: 'Property p_address1 is required' }) - p_address1: string; - - @ApiProperty({ required: false }) - @Length(0, 50, { - message: 'Property p_address2 must be between 0 to 50 characters', - }) - @IsString({ message: 'Property p_address2 must be a string' }) - @IsOptional() - p_address2?: string; - - @ApiProperty({ required: true }) - @Length(0, 30, { - message: 'Property p_city must be between 0 to 30 characters', - }) - @IsString({ message: 'Property p_city must be a string' }) - @IsDefined({ message: 'Property p_city is required' }) - p_city: string; - - @ApiProperty({ required: true }) - @Length(0, 2, { - message: 'Property p_state must be between 0 to 2 characters', - }) - @IsString({ message: 'Property p_state must be a string' }) - @IsDefined({ message: 'Property p_state is required' }) - p_state: string; - - @ApiProperty({ required: true }) - @Length(0, 10, { - message: 'Property p_zip must be between 0 to 10 characters', - }) - @IsString({ message: 'Property p_zip must be a string' }) - @IsDefined({ message: 'Property p_zip is required' }) - p_zip: string; - - @ApiProperty({ required: true }) - @Length(0, 2, { - message: 'Property p_country must be between 0 to 2 characters', - }) - @IsString({ message: 'Property p_country must be a string' }) - @IsDefined({ message: 'Property p_country is required' }) - p_country: string; - - @ApiProperty({ required: true }) - @Length(0, 2, { - message: 'Property p_revenuelocation must be between 0 to 2 characters', - }) - @IsString({ message: 'Property p_revenuelocation must be a string' }) - @IsDefined({ message: 'Property p_revenuelocation is required' }) - p_revenuelocation: string; - - @ApiProperty({ required: true }) - @Length(0, 100, { - message: 'Property p_userid must be between 0 to 100 characters', - }) - @IsString({ message: 'Property p_userid must be a string' }) - @IsDefined({ message: 'Property p_userid is required' }) - p_userid: string; -} - -export class UpdateClientContactsDTO { - @ApiProperty({ required: true }) - @Max(999999999, { message: 'Property p_spid must not exceed 999999999' }) - @Min(0, { message: 'Property p_spid must be at least 0 or more' }) - @IsInt({ message: 'Property p_spid allows only whole numbers' }) - @IsNumber({}, { message: 'Property p_spid must be a number' }) - @IsDefined({ message: 'Property p_spid is required' }) - p_spid: number; - - @ApiProperty({ required: true }) - @Max(999999999, { - message: 'Property p_clientcontactid must not exceed 999999999', - }) - @Min(0, { message: 'Property p_clientcontactid must be at least 0 or more' }) - @IsInt({ message: 'Property p_clientcontactid allows only whole numbers' }) - @IsNumber({}, { message: 'Property p_clientcontactid must be a number' }) - @IsDefined({ message: 'Property p_clientcontactid is required' }) - p_clientcontactid: number; - - @ApiProperty({ required: true }) - @Length(0, 50, { - message: 'Property p_firstname must be between 0 to 50 characters', - }) - @IsString({ message: 'Property p_firstname must be a string' }) - @IsDefined({ message: 'Property p_firstname is required' }) - p_firstname: string; - - @ApiProperty({ required: true }) - @Length(0, 50, { - message: 'Property p_lastname must be between 0 to 50 characters', - }) - @IsString({ message: 'Property p_lastname must be a string' }) - @IsDefined({ message: 'Property p_lastname is required' }) - p_lastname: string; - - @ApiProperty({ required: false }) - @Length(0, 3, { - message: 'Property p_middleinitial must be between 0 to 3 characters', - }) - @IsString({ message: 'Property p_middleinitial must be a string' }) - @IsOptional() - p_middleinitial?: string; - - @ApiProperty({ required: false }) - @Length(0, 50, { - message: 'Property p_title must be between 0 to 50 characters', - }) - @IsString({ message: 'Property p_title must be a string' }) - @IsOptional() - p_title?: string; - - @ApiProperty({ required: true }) - @Length(0, 20, { - message: 'Property p_phone must be between 0 to 20 characters', - }) - @IsString({ message: 'Property p_phone must be a string' }) - @IsDefined({ message: 'Property p_phone is required' }) - p_phone: string; - - @ApiProperty({ required: true }) - @Length(0, 20, { - message: 'Property p_fax must be between 0 to 20 characters', - }) - @IsString({ message: 'Property p_fax must be a string' }) - @IsDefined({ message: 'Property p_fax is required' }) - p_fax: string; - - @ApiProperty({ required: false }) - @Length(0, 20, { - message: 'Property p_mobileno must be between 0 to 20 characters', - }) - @IsString({ message: 'Property p_mobileno must be a string' }) - @IsOptional() - p_mobileno?: string; - - @ApiProperty({ required: true }) - @Length(0, 100, { - message: 'Property p_emailaddress must be between 0 to 100 characters', - }) - @IsEmail( - {}, - { message: 'Property p_emailaddress must be a valid email address' }, - ) - @IsDefined({ message: 'Property p_emailaddress is required' }) - p_emailaddress: string; - - @ApiProperty({ required: true }) - @Length(0, 100, { - message: 'Property p_userid must be between 0 to 100 characters', - }) - @IsString({ message: 'Property p_userid must be a string' }) - @IsDefined({ message: 'Property p_userid is required' }) - p_userid: string; -} - -export class GetPreparersDTO { - @ApiProperty({ required: true }) - @Transform(({ value }) => Number(value)) - @Max(999999999, { message: 'Property p_spid must not exceed 999999999' }) - @Min(0, { message: 'Property p_spid must be at least 0 or more' }) - @IsInt({ message: 'Property p_spid allows only whole numbers' }) - @IsNumber({}, { message: 'Property p_spid must be a number' }) - @IsDefined({ message: 'Property p_spid is required' }) - p_spid: number; - - @ApiProperty({ required: false }) - @Length(0, 50, { - message: 'Property p_name must be between 0 to 50 characters', - }) - @IsString({ message: 'Property p_name must be a string' }) - @IsOptional() - p_name?: string; - - @ApiProperty({ required: false }) - @Length(0, 30, { - message: 'Property p_lookupcode must be between 0 to 30 characters', - }) - @IsString({ message: 'Property p_lookupcode must be a string' }) - @IsOptional() - p_lookupcode?: string; - - @ApiProperty({ required: false }) - @Length(0, 20, { - message: 'Property p_city must be between 0 to 20 characters', - }) - @IsString({ message: 'Property p_city must be a string' }) - @IsOptional() - p_city?: string; - - @ApiProperty({ required: false }) - @Length(0, 2, { - message: 'Property p_state must be between 0 to 2 characters', - }) - @IsString({ message: 'Property p_state must be a string' }) - @IsOptional() - p_state?: string; - - @ApiProperty({ required: true }) - @Length(0, 10, { - message: 'Property p_status must be between 0 to 10 characters', - }) - @IsString({ message: 'Property p_status must be a string' }) - @IsDefined({ message: 'Property p_status is required' }) - p_status: string; -} - -export class UpdateClientLocationsDTO { - @ApiProperty({ required: true }) - @Max(999999999, { message: 'Property p_spid must not exceed 999999999' }) - @Min(0, { message: 'Property p_spid must be at least 0 or more' }) - @IsInt({ message: 'Property p_spid allows only whole numbers' }) - @IsNumber({}, { message: 'Property p_spid must be a number' }) - @IsDefined({ message: 'Property p_spid is required' }) - p_spid: number; - - @ApiProperty({ required: true }) - @Max(999999999, { - message: 'Property p_clientlocationid must not exceed 999999999', - }) - @Min(0, { message: 'Property p_clientlocationid must be at least 0 or more' }) - @IsInt({ message: 'Property p_clientlocationid allows only whole numbers' }) - @IsNumber({}, { message: 'Property p_clientlocationid must be a number' }) - @IsDefined({ message: 'Property p_clientlocationid is required' }) - p_clientlocationid: number; - - @ApiProperty({ required: true }) - @Length(0, 50, { - message: 'Property p_lcoationname must be between 0 to 50 characters', - }) - @IsString({ message: 'Property p_lcoationname must be a string' }) - @IsDefined({ message: 'Property p_lcoationname is required' }) - p_lcoationname: string; - - @ApiProperty({ required: true }) - @Length(0, 50, { - message: 'Property p_address1 must be between 0 to 50 characters', - }) - @IsString({ message: 'Property p_address1 must be a string' }) - @IsDefined({ message: 'Property p_address1 is required' }) - p_address1: string; - - @ApiProperty({ required: false }) - @Length(0, 50, { - message: 'Property p_address2 must be between 0 to 50 characters', - }) - @IsString({ message: 'Property p_address2 must be a string' }) - @IsOptional() - p_address2?: string; - - @ApiProperty({ required: false }) - @Length(0, 30, { - message: 'Property p_city must be between 0 to 30 characters', - }) - @IsString({ message: 'Property p_city must be a string' }) - @IsOptional() - p_city?: string; - - @ApiProperty({ required: true }) - @Length(0, 2, { - message: 'Property p_state must be between 0 to 2 characters', - }) - @IsString({ message: 'Property p_state must be a string' }) - @IsDefined({ message: 'Property p_state is required' }) - p_state: string; - - @ApiProperty({ required: true }) - @Length(0, 10, { - message: 'Property p_zip must be between 0 to 10 characters', - }) - @IsString({ message: 'Property p_zip must be a string' }) - @IsDefined({ message: 'Property p_zip is required' }) - p_zip: string; - - @ApiProperty({ required: true }) - @Length(0, 2, { - message: 'Property p_country must be between 0 to 2 characters', - }) - @IsString({ message: 'Property p_country must be a string' }) - @IsDefined({ message: 'Property p_country is required' }) - p_country: string; - - @ApiProperty({ required: true }) - @Length(0, 100, { - message: 'Property p_userid must be between 0 to 100 characters', - }) - @IsString({ message: 'Property p_userid must be a string' }) - @IsDefined({ message: 'Property p_userid is required' }) - p_userid: string; -} - -export class CreateClientContactsDTO { - @ApiProperty({ required: true }) - @Max(999999999, { message: 'Property p_spid must not exceed 999999999' }) - @Min(0, { message: 'Property p_spid must be at least 0 or more' }) - @IsInt({ message: 'Property p_spid allows only whole numbers' }) - @IsNumber({}, { message: 'Property p_spid must be a number' }) - @IsDefined({ message: 'Property p_spid is required' }) - p_spid: number; - - @ApiProperty({ required: true }) - @Max(999999999, { message: 'Property p_clientid must not exceed 999999999' }) - @Min(0, { message: 'Property p_clientid must be at least 0 or more' }) - @IsInt({ message: 'Property p_clientid allows only whole numbers' }) - @IsNumber({}, { message: 'Property p_clientid must be a number' }) - @IsDefined({ message: 'Property p_clientid is required' }) - p_clientid: number; - - @ApiProperty({ required: true, type: () => [CONTACTSTABLE_ROW_DTO] }) - @Type(() => CONTACTSTABLE_ROW_DTO) - @ValidateNested({ each: true }) - @IsArray({ message: 'Property p_contactstable allows only array type' }) - @IsDefined({ message: 'Property p_contactstable is required' }) - p_contactstable: CONTACTSTABLE_ROW_DTO[]; - - @ApiProperty({ required: true }) - @Length(0, 1, { - message: 'Property p_defcontactflag must be exactly 1 character', - }) - @IsString({ message: 'Property p_defcontactflag must be a string' }) - @IsDefined({ message: 'Property p_defcontactflag is required' }) - p_defcontactflag: string; - - @ApiProperty({ required: true }) - @Length(0, 100, { - message: 'Property p_userid must be between 0 to 100 characters', - }) - @IsString({ message: 'Property p_userid must be a string' }) - @IsDefined({ message: 'Property p_userid is required' }) - p_userid: string; -} - -export class CreateClientLocationsDTO { - @ApiProperty({ required: true }) - @Max(999999999, { message: 'Property p_spid must not exceed 999999999' }) - @Min(0, { message: 'Property p_spid must be at least 0 or more' }) - @IsInt({ message: 'Property p_spid allows only whole numbers' }) - @IsNumber({}, { message: 'Property p_spid must be a number' }) - @IsDefined({ message: 'Property p_spid is required' }) - p_spid: number; - - @ApiProperty({ required: true }) - @Max(999999999, { message: 'Property p_clientid must not exceed 999999999' }) - @Min(0, { message: 'Property p_clientid must be at least 0 or more' }) - @IsInt({ message: 'Property p_clientid allows only whole numbers' }) - @IsNumber({}, { message: 'Property p_clientid must be a number' }) - @IsDefined({ message: 'Property p_clientid is required' }) - p_clientid: number; - - @ApiProperty({ required: true, type: () => [p_clientlocaddresstableDTO] }) - @Type(() => p_clientlocaddresstableDTO) - @ValidateNested({ each: true }) - @IsArray({ - message: 'Property p_clientlocaddresstable allows only array type', - }) - @IsDefined({ message: 'Property p_clientlocaddresstable is required' }) - p_clientlocaddresstable: p_clientlocaddresstableDTO[]; - - // @ApiProperty({ required: true }) - // @Length(0, 1, { - // message: 'Property p_defcontactflag must be exactly 1 character', - // }) - // @IsString({ message: 'Property p_defcontactflag must be a string' }) - // @IsDefined({ message: 'Property p_defcontactflag is required' }) - // p_defcontactflag: string; - - @ApiProperty({ required: true }) - @Length(0, 100, { - message: 'Property p_userid must be between 0 to 100 characters', - }) - @IsString({ message: 'Property p_userid must be a string' }) - @IsDefined({ message: 'Property p_userid is required' }) - p_userid: string; -} - -export class GetPreparerByClientidContactsByClientidLocByClientidDTO { - @ApiProperty({ required: true }) - @Transform(({ value }) => Number(value)) - @Max(999999999, { message: 'Property p_spid must not exceed 999999999' }) - @Min(0, { message: 'Property p_spid must be at least 0 or more' }) - @IsInt({ message: 'Property p_spid allows only whole numbers' }) - @IsNumber({}, { message: 'Property p_spid must be a number' }) - @IsDefined({ message: 'Property p_spid is required' }) - p_spid: number; - - @ApiProperty({ required: true }) - @Transform(({ value }) => Number(value)) - @Max(999999999, { message: 'Property p_clientid must not exceed 999999999' }) - @Min(0, { message: 'Property p_clientid must be at least 0 or more' }) - @IsInt({ message: 'Property p_clientid allows only whole numbers' }) - @IsNumber({}, { message: 'Property p_clientid must be a number' }) - @IsDefined({ message: 'Property p_clientid is required' }) - p_clientid: number; -} +// import { ApiProperty } from '@nestjs/swagger'; +// import { +// IsDefined, +// IsInt, +// IsNumber, +// IsOptional, +// IsString, +// Length, +// Max, +// Min, +// ValidateNested, +// IsArray, +// IsEmail, +// } from 'class-validator'; +// import { Transform, Type } from 'class-transformer'; +// import { CONTACTSTABLE_ROW_DTO } from 'src/dto/holder/holder.dto'; + +// export class p_clientlocaddresstableDTO { +// @ApiProperty({ required: true }) +// @Length(0, 50, { +// message: 'Property Nameof must be between 0 to 50 characters', +// }) +// @IsString({ message: 'Property Nameof must be a string' }) +// @IsDefined({ message: 'Property Nameof is required' }) +// Nameof: string; + +// @ApiProperty({ required: true }) +// @Length(0, 50, { +// message: 'Property Address1 must be between 0 to 50 characters', +// }) +// @IsString({ message: 'Property Address1 must be a string' }) +// @IsDefined({ message: 'Property Address1 is required' }) +// Address1: string; + +// @ApiProperty({ required: false }) +// @Length(0, 50, { +// message: 'Property Address2 must be between 0 to 50 characters', +// }) +// @IsString({ message: 'Property Address2 must be a string' }) +// @IsOptional() +// Address2?: string; + +// @ApiProperty({ required: true }) +// @Length(0, 30, { +// message: 'Property City must be between 0 to 30 characters', +// }) +// @IsString({ message: 'Property City must be a string' }) +// @IsDefined({ message: 'Property City is required' }) +// City: string; + +// @ApiProperty({ required: true }) +// @Length(0, 2, { message: 'Property State must be between 0 to 2 characters' }) +// @IsString({ message: 'Property State must be a string' }) +// @IsDefined({ message: 'Property State is required' }) +// State: string; + +// @ApiProperty({ required: true }) +// @Length(0, 10, { message: 'Property Zip must be between 0 to 10 characters' }) +// @IsString({ message: 'Property Zip must be a string' }) +// @IsDefined({ message: 'Property Zip is required' }) +// Zip: string; + +// @ApiProperty({ required: true }) +// @Length(0, 2, { +// message: 'Property Country must be between 0 to 2 characters', +// }) +// @IsString({ message: 'Property Country must be a string' }) +// @IsDefined({ message: 'Property Country is required' }) +// Country: string; +// } + +// export class CreateClientDataDTO { +// @ApiProperty({ required: true }) +// @Max(999999999, { message: 'Property p_spid must not exceed 999999999' }) +// @Min(0, { message: 'Property p_spid must be at least 0 or more' }) +// @IsInt({ message: 'Property p_spid allows only whole numbers' }) +// @IsNumber({}, { message: 'Property p_spid must be a number' }) +// @IsDefined({ message: 'Property p_spid is required' }) +// p_spid: number; + +// @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; + +// @ApiProperty({ required: true }) +// @Length(0, 20, { +// message: 'Property p_lookupcode must be between 0 to 20 characters', +// }) +// @IsString({ message: 'Property p_lookupcode must be a string' }) +// @IsDefined({ message: 'Property p_lookupcode is required' }) +// p_lookupcode: string; + +// @ApiProperty({ required: true }) +// @Length(0, 50, { +// message: 'Property p_address1 must be between 0 to 50 characters', +// }) +// @IsString({ message: 'Property p_address1 must be a string' }) +// @IsDefined({ message: 'Property p_address1 is required' }) +// p_address1: string; + +// @ApiProperty({ required: false }) +// @Length(0, 50, { +// message: 'Property p_address2 must be between 0 to 50 characters', +// }) +// @IsString({ message: 'Property p_address2 must be a string' }) +// @IsOptional() +// p_address2?: string; + +// @ApiProperty({ required: true }) +// @Length(0, 30, { +// message: 'Property p_city must be between 0 to 30 characters', +// }) +// @IsString({ message: 'Property p_city must be a string' }) +// @IsDefined({ message: 'Property p_city is required' }) +// p_city: string; + +// @ApiProperty({ required: true }) +// @Length(0, 2, { +// message: 'Property p_state must be between 0 to 2 characters', +// }) +// @IsString({ message: 'Property p_state must be a string' }) +// @IsDefined({ message: 'Property p_state is required' }) +// p_state: string; + +// @ApiProperty({ required: false }) +// @Length(0, 10, { +// message: 'Property p_zip must be between 0 to 10 characters', +// }) +// @IsString({ message: 'Property p_zip must be a string' }) +// @IsOptional() +// p_zip?: string; + +// @ApiProperty({ required: false }) +// @Length(0, 2, { +// message: 'Property p_country must be between 0 to 2 characters', +// }) +// @IsString({ message: 'Property p_country must be a string' }) +// @IsOptional() +// p_country?: string; + +// @ApiProperty({ required: true }) +// @Length(0, 2, { +// message: 'Property p_issuingregion must be between 0 to 2 characters', +// }) +// @IsString({ message: 'Property p_issuingregion must be a string' }) +// @IsDefined({ message: 'Property p_issuingregion is required' }) +// p_issuingregion: string; + +// @ApiProperty({ required: true }) +// @Length(0, 2, { +// message: 'Property p_revenuelocation must be between 0 to 2 characters', +// }) +// @IsString({ message: 'Property p_revenuelocation must be a string' }) +// @IsDefined({ message: 'Property p_revenuelocation is required' }) +// p_revenuelocation: string; + +// @ApiProperty({ required: true }) +// @Length(0, 100, { +// message: 'Property p_userid must be between 0 to 100 characters', +// }) +// @IsString({ message: 'Property p_userid must be a string' }) +// @IsDefined({ message: 'Property p_userid is required' }) +// p_userid: string; + +// // @ApiProperty({ required: true, type: () => [p_contactstableDTO] }) +// // @Type(() => p_contactstableDTO) +// // @ValidateNested({ each: true }) +// // @IsArray({ message: 'Property p_contactstable allows only array type' }) +// // @IsDefined({ message: 'Property p_contactstable is required' }) +// // p_contactstable: p_contactstableDTO[]; + +// // @ApiProperty({ required: true, type: () => [p_clientlocaddresstableDTO] }) +// // @Type(() => p_clientlocaddresstableDTO) +// // @ValidateNested({ each: true }) +// // @IsArray({ +// // message: 'Property p_clientlocaddresstable allows only array type', +// // }) +// // @IsDefined({ message: 'Property p_clientlocaddresstable is required' }) +// // p_clientlocaddresstable: p_clientlocaddresstableDTO[]; +// } + +// export class UpdateClientDTO { +// @ApiProperty({ required: true }) +// @Max(999999999, { message: 'Property p_spid must not exceed 999999999' }) +// @Min(0, { message: 'Property p_spid must be at least 0 or more' }) +// @IsInt({ message: 'Property p_spid allows only whole numbers' }) +// @IsNumber({}, { message: 'Property p_spid must be a number' }) +// @IsDefined({ message: 'Property p_spid is required' }) +// p_spid: number; + +// @ApiProperty({ required: true }) +// @Max(999999999, { message: 'Property p_clientid must not exceed 999999999' }) +// @Min(0, { message: 'Property p_clientid must be at least 0 or more' }) +// @IsInt({ message: 'Property p_clientid allows only whole numbers' }) +// @IsNumber({}, { message: 'Property p_clientid must be a number' }) +// @IsDefined({ message: 'Property p_clientid is required' }) +// p_clientid: number; + +// @ApiProperty({ required: true }) +// @Length(0, 50, { +// message: 'Property p_preparername must be between 0 to 50 characters', +// }) +// @IsString({ message: 'Property p_preparername must be a string' }) +// @IsDefined({ message: 'Property p_preparername is required' }) +// p_preparername: string; + +// @ApiProperty({ required: true }) +// @Length(0, 50, { +// message: 'Property p_address1 must be between 0 to 50 characters', +// }) +// @IsString({ message: 'Property p_address1 must be a string' }) +// @IsDefined({ message: 'Property p_address1 is required' }) +// p_address1: string; + +// @ApiProperty({ required: false }) +// @Length(0, 50, { +// message: 'Property p_address2 must be between 0 to 50 characters', +// }) +// @IsString({ message: 'Property p_address2 must be a string' }) +// @IsOptional() +// p_address2?: string; + +// @ApiProperty({ required: true }) +// @Length(0, 30, { +// message: 'Property p_city must be between 0 to 30 characters', +// }) +// @IsString({ message: 'Property p_city must be a string' }) +// @IsDefined({ message: 'Property p_city is required' }) +// p_city: string; + +// @ApiProperty({ required: true }) +// @Length(0, 2, { +// message: 'Property p_state must be between 0 to 2 characters', +// }) +// @IsString({ message: 'Property p_state must be a string' }) +// @IsDefined({ message: 'Property p_state is required' }) +// p_state: string; + +// @ApiProperty({ required: true }) +// @Length(0, 10, { +// message: 'Property p_zip must be between 0 to 10 characters', +// }) +// @IsString({ message: 'Property p_zip must be a string' }) +// @IsDefined({ message: 'Property p_zip is required' }) +// p_zip: string; + +// @ApiProperty({ required: true }) +// @Length(0, 2, { +// message: 'Property p_country must be between 0 to 2 characters', +// }) +// @IsString({ message: 'Property p_country must be a string' }) +// @IsDefined({ message: 'Property p_country is required' }) +// p_country: string; + +// @ApiProperty({ required: true }) +// @Length(0, 2, { +// message: 'Property p_revenuelocation must be between 0 to 2 characters', +// }) +// @IsString({ message: 'Property p_revenuelocation must be a string' }) +// @IsDefined({ message: 'Property p_revenuelocation is required' }) +// p_revenuelocation: string; + +// @ApiProperty({ required: true }) +// @Length(0, 100, { +// message: 'Property p_userid must be between 0 to 100 characters', +// }) +// @IsString({ message: 'Property p_userid must be a string' }) +// @IsDefined({ message: 'Property p_userid is required' }) +// p_userid: string; +// } + +// export class UpdateClientContactsDTO { +// @ApiProperty({ required: true }) +// @Max(999999999, { message: 'Property p_spid must not exceed 999999999' }) +// @Min(0, { message: 'Property p_spid must be at least 0 or more' }) +// @IsInt({ message: 'Property p_spid allows only whole numbers' }) +// @IsNumber({}, { message: 'Property p_spid must be a number' }) +// @IsDefined({ message: 'Property p_spid is required' }) +// p_spid: number; + +// @ApiProperty({ required: true }) +// @Max(999999999, { +// message: 'Property p_clientcontactid must not exceed 999999999', +// }) +// @Min(0, { message: 'Property p_clientcontactid must be at least 0 or more' }) +// @IsInt({ message: 'Property p_clientcontactid allows only whole numbers' }) +// @IsNumber({}, { message: 'Property p_clientcontactid must be a number' }) +// @IsDefined({ message: 'Property p_clientcontactid is required' }) +// p_clientcontactid: number; + +// @ApiProperty({ required: true }) +// @Length(0, 50, { +// message: 'Property p_firstname must be between 0 to 50 characters', +// }) +// @IsString({ message: 'Property p_firstname must be a string' }) +// @IsDefined({ message: 'Property p_firstname is required' }) +// p_firstname: string; + +// @ApiProperty({ required: true }) +// @Length(0, 50, { +// message: 'Property p_lastname must be between 0 to 50 characters', +// }) +// @IsString({ message: 'Property p_lastname must be a string' }) +// @IsDefined({ message: 'Property p_lastname is required' }) +// p_lastname: string; + +// @ApiProperty({ required: false }) +// @Length(0, 3, { +// message: 'Property p_middleinitial must be between 0 to 3 characters', +// }) +// @IsString({ message: 'Property p_middleinitial must be a string' }) +// @IsOptional() +// p_middleinitial?: string; + +// @ApiProperty({ required: false }) +// @Length(0, 50, { +// message: 'Property p_title must be between 0 to 50 characters', +// }) +// @IsString({ message: 'Property p_title must be a string' }) +// @IsOptional() +// p_title?: string; + +// @ApiProperty({ required: true }) +// @Length(0, 20, { +// message: 'Property p_phone must be between 0 to 20 characters', +// }) +// @IsString({ message: 'Property p_phone must be a string' }) +// @IsDefined({ message: 'Property p_phone is required' }) +// p_phone: string; + +// @ApiProperty({ required: true }) +// @Length(0, 20, { +// message: 'Property p_fax must be between 0 to 20 characters', +// }) +// @IsString({ message: 'Property p_fax must be a string' }) +// @IsDefined({ message: 'Property p_fax is required' }) +// p_fax: string; + +// @ApiProperty({ required: false }) +// @Length(0, 20, { +// message: 'Property p_mobileno must be between 0 to 20 characters', +// }) +// @IsString({ message: 'Property p_mobileno must be a string' }) +// @IsOptional() +// p_mobileno?: string; + +// @ApiProperty({ required: true }) +// @Length(0, 100, { +// message: 'Property p_emailaddress must be between 0 to 100 characters', +// }) +// @IsEmail( +// {}, +// { message: 'Property p_emailaddress must be a valid email address' }, +// ) +// @IsDefined({ message: 'Property p_emailaddress is required' }) +// p_emailaddress: string; + +// @ApiProperty({ required: true }) +// @Length(0, 100, { +// message: 'Property p_userid must be between 0 to 100 characters', +// }) +// @IsString({ message: 'Property p_userid must be a string' }) +// @IsDefined({ message: 'Property p_userid is required' }) +// p_userid: string; +// } + +// export class GetPreparersDTO { +// @ApiProperty({ required: true }) +// @Transform(({ value }) => Number(value)) +// @Max(999999999, { message: 'Property p_spid must not exceed 999999999' }) +// @Min(0, { message: 'Property p_spid must be at least 0 or more' }) +// @IsInt({ message: 'Property p_spid allows only whole numbers' }) +// @IsNumber({}, { message: 'Property p_spid must be a number' }) +// @IsDefined({ message: 'Property p_spid is required' }) +// p_spid: number; + +// @ApiProperty({ required: false }) +// @Length(0, 50, { +// message: 'Property p_name must be between 0 to 50 characters', +// }) +// @IsString({ message: 'Property p_name must be a string' }) +// @IsOptional() +// p_name?: string; + +// @ApiProperty({ required: false }) +// @Length(0, 30, { +// message: 'Property p_lookupcode must be between 0 to 30 characters', +// }) +// @IsString({ message: 'Property p_lookupcode must be a string' }) +// @IsOptional() +// p_lookupcode?: string; + +// @ApiProperty({ required: false }) +// @Length(0, 20, { +// message: 'Property p_city must be between 0 to 20 characters', +// }) +// @IsString({ message: 'Property p_city must be a string' }) +// @IsOptional() +// p_city?: string; + +// @ApiProperty({ required: false }) +// @Length(0, 2, { +// message: 'Property p_state must be between 0 to 2 characters', +// }) +// @IsString({ message: 'Property p_state must be a string' }) +// @IsOptional() +// p_state?: string; + +// @ApiProperty({ required: true }) +// @Length(0, 10, { +// message: 'Property p_status must be between 0 to 10 characters', +// }) +// @IsString({ message: 'Property p_status must be a string' }) +// @IsDefined({ message: 'Property p_status is required' }) +// p_status: string; +// } + +// export class UpdateClientLocationsDTO { +// @ApiProperty({ required: true }) +// @Max(999999999, { message: 'Property p_spid must not exceed 999999999' }) +// @Min(0, { message: 'Property p_spid must be at least 0 or more' }) +// @IsInt({ message: 'Property p_spid allows only whole numbers' }) +// @IsNumber({}, { message: 'Property p_spid must be a number' }) +// @IsDefined({ message: 'Property p_spid is required' }) +// p_spid: number; + +// @ApiProperty({ required: true }) +// @Max(999999999, { +// message: 'Property p_clientlocationid must not exceed 999999999', +// }) +// @Min(0, { message: 'Property p_clientlocationid must be at least 0 or more' }) +// @IsInt({ message: 'Property p_clientlocationid allows only whole numbers' }) +// @IsNumber({}, { message: 'Property p_clientlocationid must be a number' }) +// @IsDefined({ message: 'Property p_clientlocationid is required' }) +// p_clientlocationid: number; + +// @ApiProperty({ required: true }) +// @Length(0, 50, { +// message: 'Property p_lcoationname must be between 0 to 50 characters', +// }) +// @IsString({ message: 'Property p_lcoationname must be a string' }) +// @IsDefined({ message: 'Property p_lcoationname is required' }) +// p_lcoationname: string; + +// @ApiProperty({ required: true }) +// @Length(0, 50, { +// message: 'Property p_address1 must be between 0 to 50 characters', +// }) +// @IsString({ message: 'Property p_address1 must be a string' }) +// @IsDefined({ message: 'Property p_address1 is required' }) +// p_address1: string; + +// @ApiProperty({ required: false }) +// @Length(0, 50, { +// message: 'Property p_address2 must be between 0 to 50 characters', +// }) +// @IsString({ message: 'Property p_address2 must be a string' }) +// @IsOptional() +// p_address2?: string; + +// @ApiProperty({ required: false }) +// @Length(0, 30, { +// message: 'Property p_city must be between 0 to 30 characters', +// }) +// @IsString({ message: 'Property p_city must be a string' }) +// @IsOptional() +// p_city?: string; + +// @ApiProperty({ required: true }) +// @Length(0, 2, { +// message: 'Property p_state must be between 0 to 2 characters', +// }) +// @IsString({ message: 'Property p_state must be a string' }) +// @IsDefined({ message: 'Property p_state is required' }) +// p_state: string; + +// @ApiProperty({ required: true }) +// @Length(0, 10, { +// message: 'Property p_zip must be between 0 to 10 characters', +// }) +// @IsString({ message: 'Property p_zip must be a string' }) +// @IsDefined({ message: 'Property p_zip is required' }) +// p_zip: string; + +// @ApiProperty({ required: true }) +// @Length(0, 2, { +// message: 'Property p_country must be between 0 to 2 characters', +// }) +// @IsString({ message: 'Property p_country must be a string' }) +// @IsDefined({ message: 'Property p_country is required' }) +// p_country: string; + +// @ApiProperty({ required: true }) +// @Length(0, 100, { +// message: 'Property p_userid must be between 0 to 100 characters', +// }) +// @IsString({ message: 'Property p_userid must be a string' }) +// @IsDefined({ message: 'Property p_userid is required' }) +// p_userid: string; +// } + +// export class CreateClientContactsDTO { +// @ApiProperty({ required: true }) +// @Max(999999999, { message: 'Property p_spid must not exceed 999999999' }) +// @Min(0, { message: 'Property p_spid must be at least 0 or more' }) +// @IsInt({ message: 'Property p_spid allows only whole numbers' }) +// @IsNumber({}, { message: 'Property p_spid must be a number' }) +// @IsDefined({ message: 'Property p_spid is required' }) +// p_spid: number; + +// @ApiProperty({ required: true }) +// @Max(999999999, { message: 'Property p_clientid must not exceed 999999999' }) +// @Min(0, { message: 'Property p_clientid must be at least 0 or more' }) +// @IsInt({ message: 'Property p_clientid allows only whole numbers' }) +// @IsNumber({}, { message: 'Property p_clientid must be a number' }) +// @IsDefined({ message: 'Property p_clientid is required' }) +// p_clientid: number; + +// @ApiProperty({ required: true, type: () => [CONTACTSTABLE_ROW_DTO] }) +// @Type(() => CONTACTSTABLE_ROW_DTO) +// @ValidateNested({ each: true }) +// @IsArray({ message: 'Property p_contactstable allows only array type' }) +// @IsDefined({ message: 'Property p_contactstable is required' }) +// p_contactstable: CONTACTSTABLE_ROW_DTO[]; + +// @ApiProperty({ required: true }) +// @Length(0, 1, { +// message: 'Property p_defcontactflag must be exactly 1 character', +// }) +// @IsString({ message: 'Property p_defcontactflag must be a string' }) +// @IsDefined({ message: 'Property p_defcontactflag is required' }) +// p_defcontactflag: string; + +// @ApiProperty({ required: true }) +// @Length(0, 100, { +// message: 'Property p_userid must be between 0 to 100 characters', +// }) +// @IsString({ message: 'Property p_userid must be a string' }) +// @IsDefined({ message: 'Property p_userid is required' }) +// p_userid: string; +// } + +// export class CreateClientLocationsDTO { +// @ApiProperty({ required: true }) +// @Max(999999999, { message: 'Property p_spid must not exceed 999999999' }) +// @Min(0, { message: 'Property p_spid must be at least 0 or more' }) +// @IsInt({ message: 'Property p_spid allows only whole numbers' }) +// @IsNumber({}, { message: 'Property p_spid must be a number' }) +// @IsDefined({ message: 'Property p_spid is required' }) +// p_spid: number; + +// @ApiProperty({ required: true }) +// @Max(999999999, { message: 'Property p_clientid must not exceed 999999999' }) +// @Min(0, { message: 'Property p_clientid must be at least 0 or more' }) +// @IsInt({ message: 'Property p_clientid allows only whole numbers' }) +// @IsNumber({}, { message: 'Property p_clientid must be a number' }) +// @IsDefined({ message: 'Property p_clientid is required' }) +// p_clientid: number; + +// @ApiProperty({ required: true, type: () => [p_clientlocaddresstableDTO] }) +// @Type(() => p_clientlocaddresstableDTO) +// @ValidateNested({ each: true }) +// @IsArray({ +// message: 'Property p_clientlocaddresstable allows only array type', +// }) +// @IsDefined({ message: 'Property p_clientlocaddresstable is required' }) +// p_clientlocaddresstable: p_clientlocaddresstableDTO[]; + +// // @ApiProperty({ required: true }) +// // @Length(0, 1, { +// // message: 'Property p_defcontactflag must be exactly 1 character', +// // }) +// // @IsString({ message: 'Property p_defcontactflag must be a string' }) +// // @IsDefined({ message: 'Property p_defcontactflag is required' }) +// // p_defcontactflag: string; + +// @ApiProperty({ required: true }) +// @Length(0, 100, { +// message: 'Property p_userid must be between 0 to 100 characters', +// }) +// @IsString({ message: 'Property p_userid must be a string' }) +// @IsDefined({ message: 'Property p_userid is required' }) +// p_userid: string; +// } + +// export class GetPreparerByClientidContactsByClientidLocByClientidDTO { +// @ApiProperty({ required: true }) +// @Transform(({ value }) => Number(value)) +// @Max(999999999, { message: 'Property p_spid must not exceed 999999999' }) +// @Min(0, { message: 'Property p_spid must be at least 0 or more' }) +// @IsInt({ message: 'Property p_spid allows only whole numbers' }) +// @IsNumber({}, { message: 'Property p_spid must be a number' }) +// @IsDefined({ message: 'Property p_spid is required' }) +// p_spid: number; + +// @ApiProperty({ required: true }) +// @Transform(({ value }) => Number(value)) +// @Max(999999999, { message: 'Property p_clientid must not exceed 999999999' }) +// @Min(0, { message: 'Property p_clientid must be at least 0 or more' }) +// @IsInt({ message: 'Property p_clientid allows only whole numbers' }) +// @IsNumber({}, { message: 'Property p_clientid must be a number' }) +// @IsDefined({ message: 'Property p_clientid is required' }) +// p_clientid: number; +// } diff --git a/src/oracle/manage-clients/manage-clients.service.ts b/src/oracle/manage-clients/manage-clients.service.ts index dc8938c..1380f9c 100644 --- a/src/oracle/manage-clients/manage-clients.service.ts +++ b/src/oracle/manage-clients/manage-clients.service.ts @@ -1,21 +1,16 @@ import { Injectable, Logger } from '@nestjs/common'; import { OracleDBService } from 'src/db/db.service'; -import { - CreateClientContactsDTO, - CreateClientDataDTO, - CreateClientLocationsDTO, - GetPreparerByClientidContactsByClientidLocByClientidDTO, - GetPreparersDTO, - p_clientlocaddresstableDTO, - UpdateClientContactsDTO, - UpdateClientDTO, - UpdateClientLocationsDTO, -} from './manage-clients.dto'; + import * as oracledb from 'oracledb'; import { BadRequestException } from 'src/exceptions/badRequest.exception'; import { InternalServerException } from 'src/exceptions/internalServerError.exception'; import { CONTACTSTABLE_ROW_DTO } from 'src/dto/holder/holder.dto'; import { closeOracleDbConnection, fetchCursor, handleError } from 'src/utils/helper'; +import { + CLIENTLOCADDRESSTABLE_ROW_DTO, CreateClientContactsDTO, CreateClientDataDTO, + CreateClientLocationsDTO, GetPreparerByClientidContactsByClientidLocByClientidDTO, + GetPreparersDTO, UpdateClientContactsDTO, UpdateClientDTO, UpdateClientLocationsDTO +} from 'src/dto/client/client.dto'; @Injectable() export class ManageClientsService { @@ -25,18 +20,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, }; const reqBody = JSON.parse(JSON.stringify(body)); @@ -56,9 +51,7 @@ export class ManageClientsService { const finalBody: CreateClientDataDTO = { ...newBody, ...reqBody }; let connection; - let p_clientcursor_rows: any = []; - // let p_clientcontactcursor_rows = []; - // let p_clientloccursor_rows = []; + let P_CLIENTCURSOR_ROWS: any = []; try { connection = await this.oracleDBService.getConnection(); @@ -66,215 +59,79 @@ export class ManageClientsService { throw new Error('No DB Connected'); } - // let res = await connection.execute(`SELECT owner, type_name FROM all_types WHERE type_name LIKE '%CLIENT%'`); - - // return { res:res.rows }; - - // const CONTACTSARRAY = await connection.getDbObjectClass('CARNETSYS.CONTACTSARRAY'); - // const CONTACTSTABLE = await connection.getDbObjectClass( - // 'CARNETSYS.CONTACTSTABLE', - // ); - // const CLIENTLOCADDRESSARRAY = await connection.getDbObjectClass('CARNETSYS.CLIENTLOCADDRESSARRAY'); - // const CLIENTLOCADDRESSTABLE = await connection.getDbObjectClass( - // 'CARNETSYS.CLIENTLOCADDRESSTABLE', - // ); - - // Check if CONTACTSTABLE is a constructor - // if (typeof CONTACTSTABLE !== 'function') { - // throw new Error('CONTACTSTABLE is not a constructor'); - // } - - // // Check if CLIENTLOCADDRESSTABLE is a constructor - // if (typeof CLIENTLOCADDRESSTABLE !== 'function') { - // throw new Error('CLIENTLOCADDRESSTABLE is not a constructor'); - // } - - // async function CREATECONTACTSTABLE_INSTANCE( - // connection, - // FirstName, - // LastName, - // MiddleInitial, - // Title, - // EmailAddress, - // PhoneNo, - // MobileNo, - // FaxNo, - // ) { - // const result = await connection.execute( - // `SELECT CARNETSYS.CONTACTSARRAY(:FirstName, :LastName, :MiddleInitial, :Title, :EmailAddress, :PhoneNo, :MobileNo, :FaxNo) FROM dual`, - // { - // FirstName, - // LastName, - // MiddleInitial, - // Title, - // EmailAddress, - // PhoneNo, - // MobileNo, - // FaxNo, - // }, - // ); - // return result.rows[0][0]; - // } - - // async function CREATECLIENTLOCADDRESSTABLE_INSTANCE( - // connection, - // Nameof, - // Address1, - // Address2, - // City, - // State, - // Zip, - // Country, - // ) { - // const result = await connection.execute( - // `SELECT CARNETSYS.CLIENTLOCADDRESSARRAY(:Nameof, :Address1, :Address2, :City, :State, :Zip, :Country) FROM dual`, - // { - // Nameof, - // Address1, - // Address2, - // City, - // State, - // Zip, - // Country, - // }, - // ); - // return result.rows[0][0]; - // } - - // const CONTACTSARRAY = finalBody.p_contactstable - // ? await Promise.all( - // finalBody.p_contactstable.map(async (x: p_contactstableDTO) => { - // return await CREATECONTACTSTABLE_INSTANCE( - // connection, - // x.FirstName, - // x.LastName, - // x.MiddleInitial, - // x.Title, - // x.EmailAddress, - // x.PhoneNo, - // x.MobileNo, - // x.FaxNo, - // ); - // }), - // ) - // : []; - - // const CLIENTLOCADDRESSARRAY = finalBody.p_clientlocaddresstable - // ? await Promise.all( - // finalBody.p_clientlocaddresstable.map( - // async (x: p_clientlocaddresstableDTO) => { - // return await CREATECLIENTLOCADDRESSTABLE_INSTANCE( - // connection, - // x.Nameof, - // x.Address1, - // x.Address2, - // x.City, - // x.State, - // x.Zip, - // x.Country, - // ); - // }, - // ), - // ) - // : []; - - // Create an instance of GLTABLE - // const CONTACTSTABLE_INSTANCE = new CONTACTSTABLE(CONTACTSARRAY); - // const CLIENTLOCADDRESSTABLE_INSTANCE = new CLIENTLOCADDRESSTABLE( - // CLIENTLOCADDRESSARRAY, - // ); - - // return {CONTACTSTABLE_INSTANCE, CLIENTLOCADDRESSTABLE_INSTANCE} - const result = await connection.execute( `BEGIN MANAGEPREPARER_PKG.CreateClientData( - :p_spid, - :p_clientname, - :p_lookupcode, - :p_address1, - :p_address2, - :p_city, - :p_state, - :p_zip, - :p_country, - :p_issuingregion, - :p_revenuelocation, - :p_userid, - :p_clientcursor + :P_SPID, + :P_CLIENTNAME, + :P_LOOKUPCODE, + :P_ADDRESS1, + :P_ADDRESS2, + :P_CITY, + :P_STATE, + :P_ZIP, + :P_COUNTRY, + :P_ISSUINGREGION, + :P_REVENUELOCATION, + :P_USERID, + :P_CLIENTCURSOR ); END;`, { - p_spid: { - val: finalBody.p_spid ? finalBody.p_spid : null, + P_SPID: { + val: finalBody.P_SPID ? finalBody.P_SPID : null, type: oracledb.DB_TYPE_NUMBER, }, - p_clientname: { - val: finalBody.p_clientname ? finalBody.p_clientname : null, + P_CLIENTNAME: { + val: finalBody.P_CLIENTNAME ? finalBody.P_CLIENTNAME : null, type: oracledb.DB_TYPE_NVARCHAR, }, - p_lookupcode: { - val: finalBody.p_lookupcode ? finalBody.p_lookupcode : null, + P_LOOKUPCODE: { + val: finalBody.P_LOOKUPCODE ? finalBody.P_LOOKUPCODE : null, type: oracledb.DB_TYPE_NVARCHAR, }, - p_address1: { - val: finalBody.p_address1 ? finalBody.p_address1 : null, + P_ADDRESS1: { + val: finalBody.P_ADDRESS1 ? finalBody.P_ADDRESS1 : null, type: oracledb.DB_TYPE_NVARCHAR, }, - p_address2: { - val: finalBody.p_address2 ? finalBody.p_address2 : null, + P_ADDRESS2: { + val: finalBody.P_ADDRESS2 ? finalBody.P_ADDRESS2 : null, type: oracledb.DB_TYPE_NVARCHAR, }, - p_city: { - val: finalBody.p_city ? finalBody.p_city : null, + P_CITY: { + val: finalBody.P_CITY ? finalBody.P_CITY : null, type: oracledb.DB_TYPE_NVARCHAR, }, - p_state: { - val: finalBody.p_state ? finalBody.p_state : null, + P_STATE: { + val: finalBody.P_STATE ? finalBody.P_STATE : null, type: oracledb.DB_TYPE_NVARCHAR, }, - p_zip: { - val: finalBody.p_zip ? finalBody.p_zip : null, + P_ZIP: { + val: finalBody.P_ZIP ? finalBody.P_ZIP : null, type: oracledb.DB_TYPE_NVARCHAR, }, - p_country: { - val: finalBody.p_country ? finalBody.p_country : null, + P_COUNTRY: { + val: finalBody.P_COUNTRY ? finalBody.P_COUNTRY : null, type: oracledb.DB_TYPE_NVARCHAR, }, - p_issuingregion: { - val: finalBody.p_issuingregion ? finalBody.p_issuingregion : null, + P_ISSUINGREGION: { + val: finalBody.P_ISSUINGREGION ? finalBody.P_ISSUINGREGION : null, type: oracledb.DB_TYPE_NVARCHAR, }, - p_revenuelocation: { - val: finalBody.p_revenuelocation - ? finalBody.p_revenuelocation + P_REVENUELOCATION: { + val: finalBody.P_REVENUELOCATION + ? finalBody.P_REVENUELOCATION : null, type: oracledb.DB_TYPE_NVARCHAR, }, - p_userid: { - val: finalBody.p_userid ? finalBody.p_userid : null, + P_USERID: { + val: finalBody.P_USERID ? finalBody.P_USERID : null, type: oracledb.DB_TYPE_NVARCHAR, }, - // p_contactstable: { - // val: CONTACTSTABLE_INSTANCE, - // type: oracledb.DB_TYPE_OBJECT, - // }, - // p_clientlocaddresstable: { - // val: CLIENTLOCADDRESSTABLE_INSTANCE, - // type: oracledb.DB_TYPE_OBJECT, - // }, - p_clientcursor: { + P_CLIENTCURSOR: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT, - }, - // p_clientcontactcursor: { - // type: oracledb.CURSOR, - // dir: oracledb.BIND_OUT, - // }, - // p_clientloccursor: { - // type: oracledb.CURSOR, - // dir: oracledb.BIND_OUT, - // }, + } }, { outFormat: oracledb.OUT_FORMAT_OBJECT, @@ -283,13 +140,13 @@ export class ManageClientsService { await connection.commit(); - if (result.outBinds && result.outBinds.p_clientcursor) { - const cursor = result.outBinds.p_clientcursor; + if (result.outBinds && result.outBinds.P_CLIENTCURSOR) { + const cursor = result.outBinds.P_CLIENTCURSOR; let rowsBatch; do { rowsBatch = await cursor.getRows(100); - p_clientcursor_rows = p_clientcursor_rows.concat(rowsBatch); + P_CLIENTCURSOR_ROWS = P_CLIENTCURSOR_ROWS.concat(rowsBatch); } while (rowsBatch.length > 0); await cursor.close(); @@ -297,37 +154,8 @@ export class ManageClientsService { throw new Error('No cursor returned from the stored procedure'); } - // if (result.outBinds && result.outBinds.p_clientcontactcursor) { - // const cursor = result.outBinds.p_clientcontactcursor; - // let rowsBatch; - - // do { - // rowsBatch = await cursor.getRows(100); - // p_clientcontactcursor_rows = - // p_clientcontactcursor_rows.concat(rowsBatch); - // } while (rowsBatch.length > 0); - - // await cursor.close(); - // } else { - // throw new Error('No cursor returned from the stored procedure'); - // } - - // if (result.outBinds && result.outBinds.p_clientloccursor) { - // const cursor = result.outBinds.p_clientloccursor; - // let rowsBatch; - - // do { - // rowsBatch = await cursor.getRows(100); - // p_clientloccursor_rows = p_clientloccursor_rows.concat(rowsBatch); - // } while (rowsBatch.length > 0); - - // await cursor.close(); - // } else { - // throw new Error('No cursor returned from the stored procedure'); - // } - - if (p_clientcursor_rows.length > 0 && p_clientcursor_rows[0].ERRORMESG) { - throw new BadRequestException(p_clientcursor_rows[0].ERRORMESG); + if (P_CLIENTCURSOR_ROWS.length > 0 && P_CLIENTCURSOR_ROWS[0].ERRORMESG) { + throw new BadRequestException(P_CLIENTCURSOR_ROWS[0].ERRORMESG); } return { statusCode: 201, message: "Created Successfully" }; @@ -352,17 +180,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)); @@ -392,65 +220,65 @@ export class ManageClientsService { const result = await connection.execute( `BEGIN MANAGEPREPARER_PKG.UpdateClient( - :p_spid, - :p_clientid, - :p_preparername, - :p_address1, - :p_address2, - :p_city, - :p_state, - :p_zip, - :p_country, - :p_revenuelocation, - :p_userid, + :P_SPID, + :P_CLIENTID, + :P_PREPARERNAME, + :P_ADDRESS1, + :P_ADDRESS2, + :P_CITY, + :P_STATE, + :P_ZIP, + :P_COUNTRY, + :P_REVENUELOCATION, + :P_USERID, :P_CURSOR ); END;`, { - p_spid: { - val: finalBody.p_spid ? finalBody.p_spid : null, + 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, + P_CLIENTID: { + val: finalBody.P_CLIENTID ? finalBody.P_CLIENTID : null, type: oracledb.DB_TYPE_NUMBER, }, - p_preparername: { - val: finalBody.p_preparername ? finalBody.p_preparername : null, + P_PREPARERNAME: { + val: finalBody.P_PREPARERNAME ? finalBody.P_PREPARERNAME : null, type: oracledb.DB_TYPE_NVARCHAR, }, - p_address1: { - val: finalBody.p_address1 ? finalBody.p_address1 : null, + P_ADDRESS1: { + val: finalBody.P_ADDRESS1 ? finalBody.P_ADDRESS1 : null, type: oracledb.DB_TYPE_NVARCHAR, }, - p_address2: { - val: finalBody.p_address2 ? finalBody.p_address2 : null, + P_ADDRESS2: { + val: finalBody.P_ADDRESS2 ? finalBody.P_ADDRESS2 : null, type: oracledb.DB_TYPE_NVARCHAR, }, - p_city: { - val: finalBody.p_city ? finalBody.p_city : null, + P_CITY: { + val: finalBody.P_CITY ? finalBody.P_CITY : null, type: oracledb.DB_TYPE_NVARCHAR, }, - p_state: { - val: finalBody.p_state ? finalBody.p_state : null, + P_STATE: { + val: finalBody.P_STATE ? finalBody.P_STATE : null, type: oracledb.DB_TYPE_NVARCHAR, }, - p_zip: { - val: finalBody.p_zip ? finalBody.p_zip : null, + P_ZIP: { + val: finalBody.P_ZIP ? finalBody.P_ZIP : null, type: oracledb.DB_TYPE_NVARCHAR, }, - p_country: { - val: finalBody.p_country ? finalBody.p_country : null, + P_COUNTRY: { + val: finalBody.P_COUNTRY ? finalBody.P_COUNTRY : null, type: oracledb.DB_TYPE_NVARCHAR, }, - p_revenuelocation: { - val: finalBody.p_revenuelocation - ? finalBody.p_revenuelocation + P_REVENUELOCATION: { + val: finalBody.P_REVENUELOCATION + ? finalBody.P_REVENUELOCATION : null, type: oracledb.DB_TYPE_NVARCHAR, }, - p_userid: { - val: finalBody.p_userid ? finalBody.p_userid : null, + P_USERID: { + val: finalBody.P_USERID ? finalBody.P_USERID : null, type: oracledb.DB_TYPE_NVARCHAR, }, P_CURSOR: { @@ -504,17 +332,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)); @@ -544,65 +372,65 @@ export class ManageClientsService { const result = await connection.execute( `BEGIN MANAGEPREPARER_PKG.UpdateClientContacts( - :p_spid, - :p_clientcontactid, - :p_firstname, - :p_lastname, - :p_middleinitial, - :p_title, - :p_phone, - :p_fax, - :p_mobileno, - :p_emailaddress, - :p_userid, + :P_SPID, + :P_CLIENTCONTACTID, + :P_FIRSTNAME, + :P_LASTNAME, + :P_MIDDLEINITIAL, + :P_TITLE, + :P_PHONENO, + :P_FAXNO, + :P_MOBILENO, + :P_EMAILADDRESS, + :P_USERID, :P_cursor ); END;`, { - p_spid: { - val: finalBody.p_spid ? finalBody.p_spid : null, + P_SPID: { + val: finalBody.P_SPID ? finalBody.P_SPID : null, type: oracledb.DB_TYPE_NUMBER, }, - p_clientcontactid: { - val: finalBody.p_clientcontactid - ? finalBody.p_clientcontactid + P_CLIENTCONTACTID: { + val: finalBody.P_CLIENTCONTACTID + ? finalBody.P_CLIENTCONTACTID : null, type: oracledb.DB_TYPE_NUMBER, }, - p_firstname: { - val: finalBody.p_firstname ? finalBody.p_firstname : null, + P_FIRSTNAME: { + val: finalBody.P_FIRSTNAME ? finalBody.P_FIRSTNAME : null, type: oracledb.DB_TYPE_NVARCHAR, }, - p_lastname: { - val: finalBody.p_lastname ? finalBody.p_lastname : null, + P_LASTNAME: { + val: finalBody.P_LASTNAME ? finalBody.P_LASTNAME : null, type: oracledb.DB_TYPE_NVARCHAR, }, - p_middleinitial: { - val: finalBody.p_middleinitial ? finalBody.p_middleinitial : null, + P_MIDDLEINITIAL: { + val: finalBody.P_MIDDLEINITIAL ? finalBody.P_MIDDLEINITIAL : null, type: oracledb.DB_TYPE_NVARCHAR, }, - p_title: { - val: finalBody.p_title ? finalBody.p_title : null, + P_TITLE: { + val: finalBody.P_TITLE ? finalBody.P_TITLE : null, type: oracledb.DB_TYPE_NVARCHAR, }, - p_phone: { - val: finalBody.p_phone ? finalBody.p_phone : null, + P_PHONENO: { + val: finalBody.P_PHONENO ? finalBody.P_PHONENO : null, type: oracledb.DB_TYPE_NVARCHAR, }, - p_fax: { - val: finalBody.p_fax ? finalBody.p_fax : null, + P_FAXNO: { + val: finalBody.P_FAXNO ? finalBody.P_FAXNO : null, type: oracledb.DB_TYPE_NVARCHAR, }, - p_mobileno: { - val: finalBody.p_mobileno ? finalBody.p_mobileno : null, + P_MOBILENO: { + val: finalBody.P_MOBILENO ? finalBody.P_MOBILENO : null, type: oracledb.DB_TYPE_NVARCHAR, }, - p_emailaddress: { - val: finalBody.p_emailaddress ? finalBody.p_emailaddress : null, + P_EMAILADDRESS: { + val: finalBody.P_EMAILADDRESS ? finalBody.P_EMAILADDRESS : null, type: oracledb.DB_TYPE_NVARCHAR, }, - p_userid: { - val: finalBody.p_userid ? finalBody.p_userid : null, + P_USERID: { + val: finalBody.P_USERID ? finalBody.P_USERID : null, type: oracledb.DB_TYPE_NVARCHAR, }, P_cursor: { @@ -655,16 +483,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)); @@ -694,60 +522,60 @@ export class ManageClientsService { const result = await connection.execute( `BEGIN MANAGEPREPARER_PKG.UpdateClientLocations( - :p_spid, - :p_clientlocationid, - :p_lcoationname, - :p_address1, - :p_address2, - :p_city, - :p_state, - :p_zip, - :p_country, - :p_userid, + :P_SPID, + :P_CLIENTLOCATIONID, + :P_LOCATIONNAME, + :P_ADDRESS1, + :P_ADDRESS2, + :P_CITY, + :P_STATE, + :P_ZIP, + :P_COUNTRY, + :P_USERID, :P_CURSOR ); END;`, { - p_spid: { - val: finalBody.p_spid ? finalBody.p_spid : null, + P_SPID: { + val: finalBody.P_SPID ? finalBody.P_SPID : null, type: oracledb.DB_TYPE_NUMBER, }, - p_clientlocationid: { - val: finalBody.p_clientlocationid - ? finalBody.p_clientlocationid + P_CLIENTLOCATIONID: { + val: finalBody.P_CLIENTLOCATIONID + ? finalBody.P_CLIENTLOCATIONID : null, type: oracledb.DB_TYPE_NUMBER, }, - p_lcoationname: { - val: finalBody.p_lcoationname ? finalBody.p_lcoationname : null, + P_LOCATIONNAME: { + val: finalBody.P_LOCATIONNAME ? finalBody.P_LOCATIONNAME : null, type: oracledb.DB_TYPE_NVARCHAR, }, - p_address1: { - val: finalBody.p_address1 ? finalBody.p_address1 : null, + P_ADDRESS1: { + val: finalBody.P_ADDRESS1 ? finalBody.P_ADDRESS1 : null, type: oracledb.DB_TYPE_NVARCHAR, }, - p_address2: { - val: finalBody.p_address2 ? finalBody.p_address2 : null, + P_ADDRESS2: { + val: finalBody.P_ADDRESS2 ? finalBody.P_ADDRESS2 : null, type: oracledb.DB_TYPE_NVARCHAR, }, - p_city: { - val: finalBody.p_city ? finalBody.p_city : null, + P_CITY: { + val: finalBody.P_CITY ? finalBody.P_CITY : null, type: oracledb.DB_TYPE_NVARCHAR, }, - p_state: { - val: finalBody.p_state ? finalBody.p_state : null, + P_STATE: { + val: finalBody.P_STATE ? finalBody.P_STATE : null, type: oracledb.DB_TYPE_NVARCHAR, }, - p_zip: { - val: finalBody.p_zip ? finalBody.p_zip : null, + P_ZIP: { + val: finalBody.P_ZIP ? finalBody.P_ZIP : null, type: oracledb.DB_TYPE_NVARCHAR, }, - p_country: { - val: finalBody.p_country ? finalBody.p_country : null, + P_COUNTRY: { + val: finalBody.P_COUNTRY ? finalBody.P_COUNTRY : null, type: oracledb.DB_TYPE_NVARCHAR, }, - p_userid: { - val: finalBody.p_userid ? finalBody.p_userid : null, + P_USERID: { + val: finalBody.P_USERID ? finalBody.P_USERID : null, type: oracledb.DB_TYPE_NVARCHAR, }, P_CURSOR: { @@ -801,11 +629,11 @@ export class ManageClientsService { // CreateClientContactX = 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_USERID: null, // }; // const reqBody = JSON.parse(JSON.stringify(body)); @@ -896,21 +724,21 @@ export class ManageClientsService { // const result = await connection.execute( // `BEGIN // MANAGEPREPARER_PKG.CreateClientContact( - // :p_spid, - // :p_clientid, + // :P_SPID, + // :P_CLIENTID, // :p_contactstable, // :p_defcontactflag, - // :p_userid, + // :P_USERID, // :P_CURSOR // ); // END;`, // { - // p_spid: { - // val: finalBody.p_spid, + // P_SPID: { + // val: finalBody.P_SPID, // type: oracledb.DB_TYPE_NUMBER, // }, - // p_clientid: { - // val: finalBody.p_clientid, + // P_CLIENTID: { + // val: finalBody.P_CLIENTID, // type: oracledb.DB_TYPE_NUMBER, // }, // p_contactstable: { @@ -921,8 +749,8 @@ export class ManageClientsService { // val: finalBody.p_defcontactflag, // type: oracledb.DB_TYPE_NVARCHAR, // }, - // p_userid: { - // val: finalBody.p_userid, + // P_USERID: { + // val: finalBody.P_USERID, // type: oracledb.DB_TYPE_NVARCHAR, // }, // P_CURSOR: { @@ -1040,9 +868,9 @@ export class ManageClientsService { return result.rows[0][0]; } - const CONTACTSARRAY = finalBody.p_contactstable + const CONTACTSARRAY = finalBody.P_CONTACTSTABLE ? await Promise.all( - finalBody.p_contactstable.map(async (x: CONTACTSTABLE_ROW_DTO) => { + finalBody.P_CONTACTSTABLE.map(async (x: CONTACTSTABLE_ROW_DTO) => { return await CREATECONTACTSTABLE_INSTANCE( connection, x.P_FIRSTNAME, @@ -1068,11 +896,11 @@ export class ManageClientsService { ); END;`, { - P_SPID: { val: finalBody.p_spid, type: oracledb.DB_TYPE_NUMBER }, - P_CLIENTID: { val: finalBody.p_clientid, type: oracledb.DB_TYPE_NUMBER }, + P_SPID: { val: finalBody.P_SPID, type: oracledb.DB_TYPE_NUMBER }, + P_CLIENTID: { val: finalBody.P_CLIENTID, type: oracledb.DB_TYPE_NUMBER }, P_CONTACTSTABLE: { val: CONTACTSTABLE_INSTANCE, type: oracledb.DB_TYPE_OBJECT }, - P_DEFCONTACTFLAG: { val: finalBody.p_defcontactflag, type: oracledb.DB_TYPE_NVARCHAR }, - P_USERID: { val: finalBody.p_userid, type: oracledb.DB_TYPE_NVARCHAR }, + P_DEFCONTACTFLAG: { val: finalBody.P_DEFCONTACTFLAG, type: oracledb.DB_TYPE_NVARCHAR }, + P_USERID: { val: finalBody.P_USERID, type: oracledb.DB_TYPE_NVARCHAR }, P_CURSOR: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT } }, { outFormat: oracledb.OUT_FORMAT_OBJECT } @@ -1096,10 +924,10 @@ 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_userid: null, + P_USERID: null, }; const reqBody = JSON.parse(JSON.stringify(body)); @@ -1163,19 +991,19 @@ export class ManageClientsService { return result.rows[0][0]; } - const CLIENTLOCADDRESSARRAY = finalBody.p_clientlocaddresstable + const CLIENTLOCADDRESSARRAY = finalBody.P_CLIENTLOCADDRESSTABLE ? await Promise.all( - finalBody.p_clientlocaddresstable.map( - async (x: p_clientlocaddresstableDTO) => { + finalBody.P_CLIENTLOCADDRESSTABLE.map( + async (x: CLIENTLOCADDRESSTABLE_ROW_DTO) => { return await CREATECLIENTLOCADDRESSTABLE_INSTANCE( connection, - x.Nameof, - x.Address1, - x.Address2, - x.City, - x.State, - x.Zip, - x.Country, + x.P_NAMEOF, + x.P_ADDRESS1, + x.P_ADDRESS2, + x.P_CITY, + x.P_CITY, + x.P_ZIP, + x.P_COUNTRY, ); }, ), @@ -1189,28 +1017,28 @@ export class ManageClientsService { const result = await connection.execute( `BEGIN MANAGEPREPARER_PKG.CreateClientLocation( - :p_spid, - :p_clientid, + :P_SPID, + :P_CLIENTID, :p_ClientLocAddressTable, - :p_userid, + :P_USERID, :P_CURSOR ); END;`, { - p_spid: { - val: finalBody.p_spid, + P_SPID: { + val: finalBody.P_SPID, type: oracledb.DB_TYPE_NUMBER, }, - p_clientid: { - val: finalBody.p_clientid, + P_CLIENTID: { + val: finalBody.P_CLIENTID, type: oracledb.DB_TYPE_NUMBER, }, p_clientlocaddresstable: { val: CLIENTLOCADDRESSTABLE_INSTANCE, type: oracledb.DB_TYPE_OBJECT, }, - p_userid: { - val: finalBody.p_userid, + P_USERID: { + val: finalBody.P_USERID, type: oracledb.DB_TYPE_NVARCHAR, }, P_CURSOR: { @@ -1277,52 +1105,44 @@ export class ManageClientsService { const result = await connection.execute( `BEGIN MANAGEPREPARER_PKG.GetPreparers( - :p_spid, - :p_name, - :p_lookupcode, - :p_city, - :p_state, - :p_status, + :P_SPID, + :P_NAME, + :P_LOOKUPCODE, + :P_CITY, + :P_STATE, + :P_STATUS, :p_maincursor ); END;`, { - p_spid: { - val: body.p_spid, + P_SPID: { + val: body.P_SPID, type: oracledb.DB_TYPE_NUMBER, }, - p_name: { - val: body.p_name, + P_NAME: { + val: body.P_NAME, type: oracledb.DB_TYPE_NVARCHAR, }, - p_lookupcode: { - val: body.p_lookupcode, + P_LOOKUPCODE: { + val: body.P_LOOKUPCODE, type: oracledb.DB_TYPE_NVARCHAR, }, - p_city: { - val: body.p_city, + P_CITY: { + val: body.P_CITY, type: oracledb.DB_TYPE_NVARCHAR, }, - p_state: { - val: body.p_state, + P_STATE: { + val: body.P_STATE, type: oracledb.DB_TYPE_NVARCHAR, }, - p_status: { - val: body.p_status, + P_STATUS: { + val: body.P_STATUS, type: oracledb.DB_TYPE_NVARCHAR, }, p_maincursor: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT, } - // p_contactscursor: { - // type: oracledb.CURSOR, - // dir: oracledb.BIND_OUT, - // }, - // p_locationcursor: { - // type: oracledb.CURSOR, - // dir: oracledb.BIND_OUT, - // }, }, { outFormat: oracledb.OUT_FORMAT_OBJECT, @@ -1341,30 +1161,6 @@ export class ManageClientsService { await cursor.close(); } - // if (result.outBinds && result.outBinds.p_contactscursor) { - // const cursor = result.outBinds.p_contactscursor; - // let rowsBatch; - - // do { - // rowsBatch = await cursor.getRows(100); - // p_contactscursor_rows = p_contactscursor_rows.concat(rowsBatch); - // } while (rowsBatch.length > 0); - - // await cursor.close(); - // } - - // if (result.outBinds && result.outBinds.p_locationcursor) { - // const cursor = result.outBinds.p_locationcursor; - // let rowsBatch; - - // do { - // rowsBatch = await cursor.getRows(100); - // p_locationcursor_rows = p_locationcursor_rows.concat(rowsBatch); - // } while (rowsBatch.length > 0); - - // await cursor.close(); - // } - return p_maincursor_rows; } catch (error) { @@ -1400,18 +1196,18 @@ export class ManageClientsService { const result = await connection.execute( `BEGIN MANAGEPREPARER_PKG.GetPreparerByClientid( - :p_spid, - :p_clientid, + :P_SPID, + :P_CLIENTID, :P_CURSOR ); END;`, { - p_spid: { - val: body.p_spid, + P_SPID: { + val: body.P_SPID, type: oracledb.DB_TYPE_NUMBER, }, - p_clientid: { - val: body.p_clientid, + P_CLIENTID: { + val: body.P_CLIENTID, type: oracledb.DB_TYPE_NUMBER, }, P_CURSOR: { @@ -1471,18 +1267,18 @@ export class ManageClientsService { const result = await connection.execute( `BEGIN MANAGEPREPARER_PKG.GetPreparerContactsByClientid( - :p_spid, - :p_clientid, + :P_SPID, + :P_CLIENTID, :P_CURSOR ); END;`, { - p_spid: { - val: body.p_spid, + P_SPID: { + val: body.P_SPID, type: oracledb.DB_TYPE_NUMBER, }, - p_clientid: { - val: body.p_clientid, + P_CLIENTID: { + val: body.P_CLIENTID, type: oracledb.DB_TYPE_NUMBER, }, P_CURSOR: { @@ -1541,18 +1337,18 @@ export class ManageClientsService { const result = await connection.execute( `BEGIN MANAGEPREPARER_PKG.GetPreparerLocByClientid( - :p_spid, - :p_clientid, + :P_SPID, + :P_CLIENTID, :P_CURSOR ); END;`, { - p_spid: { - val: body.p_spid, + P_SPID: { + val: body.P_SPID, type: oracledb.DB_TYPE_NUMBER, }, - p_clientid: { - val: body.p_clientid, + P_CLIENTID: { + val: body.P_CLIENTID, type: oracledb.DB_TYPE_NUMBER, }, P_CURSOR: { diff --git a/src/oracle/manage-fee/manage-fee.controller.ts b/src/oracle/manage-fee/manage-fee.controller.ts index 802c635..d37a998 100644 --- a/src/oracle/manage-fee/manage-fee.controller.ts +++ b/src/oracle/manage-fee/manage-fee.controller.ts @@ -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 { diff --git a/src/oracle/manage-fee/manage-fee.dto.ts b/src/oracle/manage-fee/manage-fee.dto.ts deleted file mode 100644 index 7bbb6ef..0000000 --- a/src/oracle/manage-fee/manage-fee.dto.ts +++ /dev/null @@ -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() -} diff --git a/src/oracle/manage-fee/manage-fee.service.ts b/src/oracle/manage-fee/manage-fee.service.ts index 02f234c..921c0cc 100644 --- a/src/oracle/manage-fee/manage-fee.service.ts +++ b/src/oracle/manage-fee/manage-fee.service.ts @@ -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 { + 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 { + 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 { + 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 { + 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 { + 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 { + 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) } } } diff --git a/src/oracle/manage-holders/manage-holders.service.ts b/src/oracle/manage-holders/manage-holders.service.ts index 8005f67..e7f1708 100644 --- a/src/oracle/manage-holders/manage-holders.service.ts +++ b/src/oracle/manage-holders/manage-holders.service.ts @@ -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) } }; } diff --git a/src/oracle/user-maintenance/user-maintenance.controller.ts b/src/oracle/user-maintenance/user-maintenance.controller.ts index b2ea84a..abb16f5 100644 --- a/src/oracle/user-maintenance/user-maintenance.controller.ts +++ b/src/oracle/user-maintenance/user-maintenance.controller.ts @@ -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); }