diff --git a/src/dto/carnet-application/carnet-application.dto.ts b/src/dto/carnet-application/carnet-application.dto.ts new file mode 100644 index 0000000..04ac4e8 --- /dev/null +++ b/src/dto/carnet-application/carnet-application.dto.ts @@ -0,0 +1,38 @@ +import { IntersectionType, PartialType } from "@nestjs/swagger"; +import { APPLICATIONNAME_DTO, AUTHREP_DTO, AUTO_FLAG_DTO, CLIENTID_DTO, COMMERCIAL_SAMPLE_FLAG_DTO, COUNTRYTABLE_DTO, CUSTCOURIERNO_DTO, DELIVERYMETHOD_DTO, DELIVERYTYPE_DTO, EXIBITIONS_FAIR_FLAG_DTO, FORMOFSECURITY_DTO, GLTABLE_DTO, HEADERID_DTO, HOLDERID_DTO, HORSE_FLAG_DTO, INSPROTECTION_DTO, LDIPROTECTION_DTO, LOCATIONID_DTO, NOTES_DTO, PAYMENTMETHOD_DTO, PROF_EQUIPMENT_FLAG_DTO, REFNO_DTO, SHIPADDRID_DTO, SHIPTOTYPE_DTO, SPID_DTO, USERID_DTO, USSETS_DTO } from "../property.dto"; + + +export class SaveCarnetApplicationDTO extends IntersectionType( + PartialType(SPID_DTO), + PartialType(CLIENTID_DTO), + PartialType(LOCATIONID_DTO), + PartialType(USERID_DTO), + PartialType(HEADERID_DTO), + (APPLICATIONNAME_DTO), + PartialType(HOLDERID_DTO), + PartialType(COMMERCIAL_SAMPLE_FLAG_DTO), + PartialType(PROF_EQUIPMENT_FLAG_DTO), + PartialType(EXIBITIONS_FAIR_FLAG_DTO), + PartialType(AUTO_FLAG_DTO), + PartialType(HORSE_FLAG_DTO), + PartialType(AUTHREP_DTO), + PartialType(GLTABLE_DTO), + PartialType(USSETS_DTO), + PartialType(COUNTRYTABLE_DTO), + PartialType(SHIPTOTYPE_DTO), + PartialType(SHIPADDRID_DTO), + PartialType(FORMOFSECURITY_DTO), + PartialType(INSPROTECTION_DTO), + PartialType(LDIPROTECTION_DTO), + PartialType(DELIVERYTYPE_DTO), + PartialType(DELIVERYMETHOD_DTO), + PartialType(PAYMENTMETHOD_DTO), + PartialType(CUSTCOURIERNO_DTO), + PartialType(REFNO_DTO), + PartialType(NOTES_DTO) +) { } + +export class TransmitApplicationtoProcessDTO extends IntersectionType( + SPID_DTO, USERID_DTO, HEADERID_DTO +) { } + diff --git a/src/dto/carnet-sequence.dto.ts b/src/dto/carnet-sequence/carnet-sequence.dto.ts similarity index 100% rename from src/dto/carnet-sequence.dto.ts rename to src/dto/carnet-sequence/carnet-sequence.dto.ts diff --git a/src/dto/property.dto.ts b/src/dto/property.dto.ts index 65db78d..5cdce4d 100644 --- a/src/dto/property.dto.ts +++ b/src/dto/property.dto.ts @@ -1,6 +1,6 @@ import { ApiProperty } from "@nestjs/swagger"; import { Transform, Type } from "class-transformer"; -import { IsDefined, IsEmail, IsEnum, IsInt, IsNumber, IsOptional, IsString, Length, Max, Min } from "class-validator"; +import { IsArray, IsDefined, IsEmail, IsEnum, IsInt, IsNumber, IsOptional, IsString, Length, Max, MaxLength, Min, ValidateNested } from "class-validator"; // General @@ -143,13 +143,11 @@ export class CARGO_SURETY_DTO { } export class NOTES_DTO { - @ApiProperty({ required: false }) + @ApiProperty({ required: true }) @IsString({ message: 'Property P_NOTES must be a string' }) - @IsOptional() - P_NOTES?: string; - - + P_NOTES: string; } + export class FILE_ID_DTO { @ApiProperty({ required: false }) @IsString({ message: 'Property P_FILEIDS must be a string' }) @@ -205,11 +203,14 @@ export class SP_ID_DTO { export class CLIENTID_DTO { @ApiProperty({ required: true }) - @Min(0, { message: 'p_clientid must be greater than or equal to 0' }) - @IsInt({ message: "p_clientid must be whole number" }) - @IsDefined({ message: 'Invalid Request' }) - @Type(() => Number) - p_clientid: number; + @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; } export class CLIENT_CONTACTID_DTO { @@ -323,4 +324,300 @@ 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 +} + +//Location + +export class LOCATIONID_DTO { + @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({ message: 'Property p_locationid allows only whole numbers' }) + @IsNumber({}, { message: 'Property p_locationid must be a number' }) + @IsDefined({ message: 'Property p_locationid is required' }) + P_LOCATIONID: number; +} + +// carnet-application + +export class HEADERID_DTO { + @ApiProperty({ required: true }) + @Max(999999999, { + message: 'Property P_HEADERID must not exceed 999999999', + }) + @Min(0, { message: 'Property P_HEADERID must be at least 0 or more' }) + @IsInt({ message: 'Property P_HEADERID allows only whole numbers' }) + @IsNumber({}, { message: 'Property P_HEADERID must be a number' }) + @IsDefined({ message: 'Property P_HEADERID is required' }) + P_HEADERID: number; +} + +export class APPLICATIONNAME_DTO { + @ApiProperty({ required: true }) + @IsString({ message: 'Property P_APPLICATIONNAME must be a string' }) + @IsDefined({ message: 'Property P_APPLICATIONNAME is required' }) + P_APPLICATIONNAME: string; +} + +export class COMMERCIAL_SAMPLE_FLAG_DTO { + @ApiProperty({ required: true, enum: YON }) + @Transform(({ value }) => typeof value === 'string' ? value.trim().toUpperCase() : value) + @IsEnum(YON, { message: 'P_COMMERCIALSAMPLEFLAG must be either "Y" or "N"' }) + @Length(1, 1, { message: 'P_COMMERCIALSAMPLEFLAG must be 1 character' }) + @IsString() + @IsDefined({ message: "Invalid Request" }) + P_COMMERCIALSAMPLEFLAG: YON; +} + +export class PROF_EQUIPMENT_FLAG_DTO { + @ApiProperty({ required: true, enum: YON }) + @Transform(({ value }) => typeof value === 'string' ? value.trim().toUpperCase() : value) + @IsEnum(YON, { message: 'P_PROFEQUIMENTFLAG must be either "Y" or "N"' }) + @Length(1, 1, { message: 'P_PROFEQUIMENTFLAG must be 1 character' }) + @IsString() + @IsDefined({ message: "Invalid Request" }) + P_PROFEQUIPMENTFLAG: YON; +} + +export class EXIBITIONS_FAIR_FLAG_DTO { + @ApiProperty({ required: true, enum: YON }) + @Transform(({ value }) => typeof value === 'string' ? value.trim().toUpperCase() : value) + @IsEnum(YON, { message: 'P_EXIBITIONSFAIRFLAG must be either "Y" or "N"' }) + @Length(1, 1, { message: 'P_EXIBITIONSFAIRFLAG must be 1 character' }) + @IsString() + @IsDefined({ message: "Invalid Request" }) + P_EXHIBITIONSFAIRFLAG: YON; +} + +export class AUTO_FLAG_DTO { + @ApiProperty({ required: true, enum: YON }) + @Transform(({ value }) => typeof value === 'string' ? value.trim().toUpperCase() : value) + @IsEnum(YON, { message: 'P_AUTOFLAG must be either "Y" or "N"' }) + @Length(1, 1, { message: 'P_AUTOFLAG must be 1 character' }) + @IsString() + @IsDefined({ message: "Invalid Request" }) + P_AUTOFLAG: YON; +} + +export class HORSE_FLAG_DTO { + @ApiProperty({ required: true, enum: YON }) + @Transform(({ value }) => typeof value === 'string' ? value.trim().toUpperCase() : value) + @IsEnum(YON, { message: 'P_HORSEFLAG must be either "Y" or "N"' }) + @Length(1, 1, { message: 'P_HORSEFLAG must be 1 character' }) + @IsString() + @IsDefined({ message: "Invalid Request" }) + P_HORSEFLAG: YON; +} + +export class AUTHREP_DTO { + @ApiProperty({ required: true }) + @IsString({ message: 'Property P_AUTHREP must be a string' }) + @IsDefined({ message: 'Property P_AUTHREP is required' }) + P_AUTHREP: string; +} + +export class GLTABLE_ROW_DTO { + @ApiProperty({ required: true }) + @Max(99999, { message: 'Property ITEMNO must not exceed 99999' }) + @Min(0, { message: 'Property ITEMNO must be at least 0 or more' }) + @IsInt({ message: 'Property ITEMNO allows only whole numbers' }) + @Transform(({ value }) => Number(value)) + @IsNumber({}, { message: 'Property ITEMNO must be a number' }) + @IsDefined({ message: 'Property ITEMNO is required' }) + ITEMNO: number; + + @ApiProperty({ required: true }) + @MaxLength(200, { message: 'Property ITEMDESCRIPTION must not exceed 200 characters' }) + @IsString({ message: 'Property ITEMDESCRIPTION must be a string' }) + @IsDefined({ message: 'Property ITEMDESCRIPTION is required' }) + ITEMDESCRIPTION: string; + + @ApiProperty({ required: true }) + @Max(999999999.99, { message: 'Property ITEMVALUE must not exceed 999999999.99' }) + @Min(0, { message: 'Property ITEMVALUE must be at least 0 or more' }) + @Transform(({ value }) => Number(value)) + @IsNumber({ maxDecimalPlaces: 2 }, { message: 'Property ITEMVALUE must be a number' }) + @IsDefined({ message: 'Property ITEMVALUE is required' }) + ITEMVALUE: number; + + @ApiProperty({ required: true }) + @Max(99999, { message: 'Property NOOFPIECES must not exceed 99999' }) + @Min(0, { message: 'Property NOOFPIECES must be at least 0 or more' }) + @IsInt({ message: 'Property NOOFPIECES allows only whole numbers' }) + @Transform(({ value }) => Number(value)) + @IsNumber({}, { message: 'Property NOOFPIECES must be a number' }) + @IsDefined({ message: 'Property NOOFPIECES is required' }) + NOOFPIECES: number; + + @ApiProperty({ required: true }) + @Max(99999.9999, { message: 'Property ITEMVALUE must not exceed 999999999.99' }) + @Min(0, { message: 'Property ITEMVALUE must be at least 0 or more' }) + @Transform(({ value }) => Number(value)) + @IsNumber({ maxDecimalPlaces: 2 }, { message: 'Property ITEMVALUE must be a number' }) + @IsDefined({ message: 'Property ITEMVALUE is required' }) + ITEMWEIGHT: number; + + @ApiProperty({ required: true }) + @MaxLength(10, { message: 'Property ITEMWEIGHTUOM must not exceed 10 characters' }) + @IsString({ message: 'Property ITEMWEIGHTUOM must be a string' }) + @IsDefined({ message: 'Property ITEMWEIGHTUOM is required' }) + ITEMWEIGHTUOM: string; + + @ApiProperty({ required: true }) + @MaxLength(2, { message: 'Property GOODSORIGINCOUNTRY must not exceed 2 characters' }) + @IsString({ message: 'Property GOODSORIGINCOUNTRY must be a string' }) + @IsDefined({ message: 'Property GOODSORIGINCOUNTRY is required' }) + GOODSORIGINCOUNTRY: string; +} + +export class GLTABLE_DTO { + @ApiProperty({ required: true, type: () => [GLTABLE_ROW_DTO] }) + @Type(() => GLTABLE_ROW_DTO) + @ValidateNested({ each: true }) + @IsArray({ message: 'Property P_GLTABLE allows only array type' }) + @IsDefined({ message: 'Property P_GLTABLE is required' }) + P_GLTABLE: GLTABLE_ROW_DTO[]; +} + +export class USSETS_DTO { + @ApiProperty({ required: true }) + // @Max(99999, { message: 'Property P_USSETS must not exceed 99999' }) + @Min(0, { message: 'Property P_USSETS must be at least 0 or more' }) + @IsInt({ message: 'Property P_USSETS allows only whole numbers' }) + @Transform(({ value }) => Number(value)) + @IsNumber({}, { message: 'Property P_USSETS must be a number' }) + @IsDefined({ message: 'Property P_USSETS is required' }) + P_USSETS: number; +} + +export enum VOT { + V = "V", + T = "T", +} + +export class COUNTRYTABLE_ROW_DTO { + @ApiProperty({ required: true, enum: VOT }) + @Transform(({ value }) => typeof value === 'string' ? value.trim().toUpperCase() : value) + @IsEnum(VOT, { message: 'P_VISISTTRANSITIND must be either "V" or "T"' }) + @Length(1, 1, { message: 'P_VISISTTRANSITIND must be 1 character' }) + @IsString() + @IsDefined({ message: "Invalid Request" }) + P_VISISTTRANSITIND: VOT; + + + @ApiProperty({ required: true }) + @MaxLength(2, { message: 'Property COUNTRYCODE must not exceed 2 characters' }) + @IsString({ message: 'Property COUNTRYCODE must be a string' }) + @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({ message: 'Property NOOFTIMESENTLEAVE allows only whole numbers' }) + @Transform(({ value }) => Number(value)) + @IsNumber({}, { message: 'Property NOOFTIMESENTLEAVE must be a number' }) + @IsDefined({ message: 'Property NOOFTIMESENTLEAVE is required' }) + NOOFTIMESENTLEAVE: number; +} + +export class COUNTRYTABLE_DTO { + @ApiProperty({ required: true, type: () => [COUNTRYTABLE_ROW_DTO] }) + @Type(() => COUNTRYTABLE_ROW_DTO) + @ValidateNested({ each: true }) + @IsArray({ message: 'Property P_COUNTRYTABLE allows only array type' }) + @IsDefined({ message: 'Property P_COUNTRYTABLE is required' }) + P_COUNTRYTABLE: COUNTRYTABLE_ROW_DTO[]; +} + +export class SHIPTOTYPE_DTO { + @ApiProperty({ required: true }) + @IsString({ message: 'Property P_SHIPTOTYPE must be a string' }) + @IsDefined({ message: 'Property P_SHIPTOTYPE is required' }) + P_SHIPTOTYPE: string; +} + +export class SHIPADDRID_DTO { + @ApiProperty({ required: true }) + // @Max(99999, { message: 'Property P_USSETS must not exceed 99999' }) + @Min(0, { message: 'Property P_SHIPADDRID must be at least 0 or more' }) + @IsInt({ message: 'Property P_SHIPADDRID allows only whole numbers' }) + @Transform(({ value }) => Number(value)) + @IsNumber({}, { message: 'Property P_SHIPADDRID must be a number' }) + @IsDefined({ message: 'Property P_SHIPADDRID is required' }) + P_SHIPADDRID: number; +} + +export class FORMOFSECURITY_DTO { + @ApiProperty({ required: true }) + @IsString({ message: 'Property P_FORMOFSECURITY must be a string' }) + @IsDefined({ message: 'Property P_FORMOFSECURITY is required' }) + P_FORMOFSECURITY: string; +} + +export class INSPROTECTION_DTO { + @ApiProperty({ required: true }) + @IsString({ message: 'Property P_INSPROTECTION must be a string' }) + @IsDefined({ message: 'Property P_INSPROTECTION is required' }) + P_INSPROTECTION: string; +} + +export class LDIPROTECTION_DTO { + @ApiProperty({ required: true }) + @IsString({ message: 'Property P_LDIPROTECTION must be a string' }) + @IsDefined({ message: 'Property P_LDIPROTECTION is required' }) + P_LDIPROTECTION: string; +} + +export class DELIVERYTYPE_DTO { + @ApiProperty({ required: true }) + @IsString({ message: 'Property P_DELIVERYTYPE must be a string' }) + @IsDefined({ message: 'Property P_DELIVERYTYPE is required' }) + P_DELIVERYTYPE: string; +} + +export class DELIVERYMETHOD_DTO { + @ApiProperty({ required: true }) + @IsString({ message: 'Property P_DELIVERYTYPE must be a string' }) + @IsDefined({ message: 'Property P_DELIVERYTYPE is required' }) + P_DELIVERYMETHOD: string; +} + +export class PAYMENTMETHOD_DTO { + @ApiProperty({ required: true }) + @IsString({ message: 'Property P_PAYMENTMETHOD must be a string' }) + @IsDefined({ message: 'Property P_PAYMENTMETHOD is required' }) + P_PAYMENTMETHOD: string; +} + +export class CUSTCOURIERNO_DTO { + @ApiProperty({ required: true }) + @IsString({ message: 'Property P_CUSTCOURIERNO must be a string' }) + @IsDefined({ message: 'Property P_CUSTCOURIERNO is required' }) + P_CUSTCOURIERNO: string; +} + +export class REFNO_DTO { + @ApiProperty({ required: true }) + @IsString({ message: 'Property P_REFNO must be a string' }) + @IsDefined({ message: 'Property P_REFNO is required' }) + P_REFNO: string; +} + + +// Holder + +export class HOLDERID_DTO { + @ApiProperty({ required: true }) + @Max(999999999, { + message: 'Property P_HOLDERID must not exceed 999999999', + }) + @Min(0, { message: 'Property P_HOLDERID must be at least 0 or more' }) + @IsInt({ message: 'Property P_HOLDERID allows only whole numbers' }) + @IsNumber({}, { message: 'Property P_HOLDERID must be a number' }) + @IsDefined({ message: 'Property P_HOLDERID is required' }) + P_HOLDERID: number; +} + diff --git a/src/dto/region.dto.ts b/src/dto/region/region.dto.ts similarity index 100% rename from src/dto/region.dto.ts rename to src/dto/region/region.dto.ts diff --git a/src/dto/sp-contacts.dto.ts b/src/dto/sp-contacts/sp-contacts.dto.ts similarity index 100% rename from src/dto/sp-contacts.dto.ts rename to src/dto/sp-contacts/sp-contacts.dto.ts diff --git a/src/dto/sp.dto.ts b/src/dto/sp/sp.dto.ts similarity index 82% rename from src/dto/sp.dto.ts rename to src/dto/sp/sp.dto.ts index c6b056f..544de57 100644 --- a/src/dto/sp.dto.ts +++ b/src/dto/sp/sp.dto.ts @@ -1,15 +1,15 @@ -import { IntersectionType } from '@nestjs/swagger'; +import { IntersectionType, PartialType } from '@nestjs/swagger'; import { ADDRESS1_DTO, ADDRESS2_DTO, BOND_SURETY_DTO, CARGO_POLICY_NO_DTO, CARGO_SURETY_DTO, CITY_DTO, COUNTRY_DTO, FILE_ID_DTO, ISSUING_REGION_DTO, LOOKUP_CODE_DTO, Name_DTO, NOTES_DTO, REPLACEMENT_REGION_DTO, SPID_DTO, STATE_DTO, USER_ID_DTO, ZIP_DTO } from 'src/dto/property.dto'; export class InsertNewServiceProviderDTO extends IntersectionType( Name_DTO, LOOKUP_CODE_DTO, ADDRESS1_DTO, ADDRESS2_DTO, CITY_DTO, STATE_DTO, COUNTRY_DTO, ZIP_DTO, ISSUING_REGION_DTO, REPLACEMENT_REGION_DTO, BOND_SURETY_DTO, CARGO_POLICY_NO_DTO, CARGO_SURETY_DTO, - USER_ID_DTO, NOTES_DTO, FILE_ID_DTO + USER_ID_DTO, PartialType(NOTES_DTO), FILE_ID_DTO ) { } export class UpdateServiceProviderDTO extends IntersectionType( SPID_DTO, Name_DTO, LOOKUP_CODE_DTO, ADDRESS1_DTO, ADDRESS2_DTO, CITY_DTO, STATE_DTO, COUNTRY_DTO, ISSUING_REGION_DTO, REPLACEMENT_REGION_DTO, BOND_SURETY_DTO, CARGO_POLICY_NO_DTO, CARGO_SURETY_DTO, - ZIP_DTO, USER_ID_DTO, NOTES_DTO, FILE_ID_DTO + ZIP_DTO, USER_ID_DTO, PartialType(NOTES_DTO), FILE_ID_DTO ) { } diff --git a/src/dto/user-maintenance.dto.ts b/src/dto/user-maintenance/user-maintenance.dto.ts similarity index 100% rename from src/dto/user-maintenance.dto.ts rename to src/dto/user-maintenance/user-maintenance.dto.ts diff --git a/src/mssql/uscib-managed-sp/carnet-sequence/carnet-sequence.controller.ts b/src/mssql/uscib-managed-sp/carnet-sequence/carnet-sequence.controller.ts index bb9fec2..cc20a26 100644 --- a/src/mssql/uscib-managed-sp/carnet-sequence/carnet-sequence.controller.ts +++ b/src/mssql/uscib-managed-sp/carnet-sequence/carnet-sequence.controller.ts @@ -1,7 +1,7 @@ import { Body, Controller, Get, Post, Query } from '@nestjs/common'; import { CarnetSequenceService } from './carnet-sequence.service'; import { ApiTags } from '@nestjs/swagger'; -import { CreateCarnetSequenceDTO } from 'src/dto/carnet-sequence.dto'; +import { CreateCarnetSequenceDTO } from 'src/dto/carnet-sequence/carnet-sequence.dto'; import { SPID_DTO } from 'src/dto/property.dto'; @Controller('mssql') diff --git a/src/mssql/uscib-managed-sp/carnet-sequence/carnet-sequence.service.ts b/src/mssql/uscib-managed-sp/carnet-sequence/carnet-sequence.service.ts index 001b3bb..c210c87 100644 --- a/src/mssql/uscib-managed-sp/carnet-sequence/carnet-sequence.service.ts +++ b/src/mssql/uscib-managed-sp/carnet-sequence/carnet-sequence.service.ts @@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common'; import { Connection, Request } from 'mssql'; import { MssqlDBService } from 'src/db/db.service'; import * as mssql from 'mssql' -import { CreateCarnetSequenceDTO } from 'src/dto/carnet-sequence.dto'; +import { CreateCarnetSequenceDTO } from 'src/dto/carnet-sequence/carnet-sequence.dto'; import { SPID_DTO } from 'src/dto/property.dto'; @Injectable() diff --git a/src/mssql/uscib-managed-sp/region/region.controller.ts b/src/mssql/uscib-managed-sp/region/region.controller.ts index 66f9a49..412a3b4 100644 --- a/src/mssql/uscib-managed-sp/region/region.controller.ts +++ b/src/mssql/uscib-managed-sp/region/region.controller.ts @@ -1,7 +1,7 @@ import { Body, Controller, Get, Patch, Post } from '@nestjs/common'; import { ApiInternalServerErrorResponse, ApiOkResponse, ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger'; import { RegionService } from './region.service'; -import { InsertRegionsDto, UpdateRegionDto } from 'src/dto/region.dto'; +import { InsertRegionsDto, UpdateRegionDto } from 'src/dto/region/region.dto'; @Controller('mssql') export class RegionController { diff --git a/src/mssql/uscib-managed-sp/region/region.service.ts b/src/mssql/uscib-managed-sp/region/region.service.ts index ec0b829..b1ab34f 100644 --- a/src/mssql/uscib-managed-sp/region/region.service.ts +++ b/src/mssql/uscib-managed-sp/region/region.service.ts @@ -1,7 +1,7 @@ import { Injectable, InternalServerErrorException } from '@nestjs/common'; import { Connection, Request } from 'mssql'; import { MssqlDBService } from 'src/db/db.service'; -import { InsertRegionsDto, UpdateRegionDto } from 'src/dto/region.dto'; +import { InsertRegionsDto, UpdateRegionDto } from 'src/dto/region/region.dto'; import * as mssql from 'mssql'; import { InternalServerException } from 'src/exceptions/internalServerError.exception'; diff --git a/src/mssql/uscib-managed-sp/sp-contacts/sp-contacts.controller.ts b/src/mssql/uscib-managed-sp/sp-contacts/sp-contacts.controller.ts index e7bfb46..b247c7a 100644 --- a/src/mssql/uscib-managed-sp/sp-contacts/sp-contacts.controller.ts +++ b/src/mssql/uscib-managed-sp/sp-contacts/sp-contacts.controller.ts @@ -1,7 +1,7 @@ import { Body, Controller, Get, Post, Put, Query } from '@nestjs/common'; import { SpContactsService } from './sp-contacts.service'; import { ApiTags } from '@nestjs/swagger'; -import { InsertSPContactsDTO, UpdateSPContactsDTO } from 'src/dto/sp-contacts.dto'; +import { InsertSPContactsDTO, UpdateSPContactsDTO } from 'src/dto/sp-contacts/sp-contacts.dto'; import { SP_CONTACTID_DTO, SP_ID_DTO } from 'src/dto/property.dto'; @Controller('mssql') diff --git a/src/mssql/uscib-managed-sp/sp-contacts/sp-contacts.service.ts b/src/mssql/uscib-managed-sp/sp-contacts/sp-contacts.service.ts index b24ff23..64eb0e6 100644 --- a/src/mssql/uscib-managed-sp/sp-contacts/sp-contacts.service.ts +++ b/src/mssql/uscib-managed-sp/sp-contacts/sp-contacts.service.ts @@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common'; import { MssqlDBService } from 'src/db/db.service'; import * as mssql from 'mssql' import { Connection, Request } from 'mssql'; -import { InsertSPContactsDTO, UpdateSPContactsDTO } from 'src/dto/sp-contacts.dto'; +import { InsertSPContactsDTO, UpdateSPContactsDTO } from 'src/dto/sp-contacts/sp-contacts.dto'; import { SP_CONTACTID_DTO, SP_ID_DTO } from 'src/dto/property.dto'; @Injectable() diff --git a/src/mssql/uscib-managed-sp/sp/sp.controller.ts b/src/mssql/uscib-managed-sp/sp/sp.controller.ts index 284e095..fac0b58 100644 --- a/src/mssql/uscib-managed-sp/sp/sp.controller.ts +++ b/src/mssql/uscib-managed-sp/sp/sp.controller.ts @@ -1,7 +1,7 @@ import { Body, Controller, Get, Post, Put, Query } from '@nestjs/common'; import { ApiTags } from '@nestjs/swagger'; import { SpService } from './sp.service'; -import { InsertNewServiceProviderDTO, UpdateServiceProviderDTO } from 'src/dto/sp.dto'; +import { InsertNewServiceProviderDTO, UpdateServiceProviderDTO } from 'src/dto/sp/sp.dto'; import { SPID_DTO } from 'src/dto/property.dto'; @Controller('mssql') diff --git a/src/mssql/uscib-managed-sp/sp/sp.service.ts b/src/mssql/uscib-managed-sp/sp/sp.service.ts index fdb7f07..2d1ae01 100644 --- a/src/mssql/uscib-managed-sp/sp/sp.service.ts +++ b/src/mssql/uscib-managed-sp/sp/sp.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@nestjs/common'; import { Connection, Request } from 'mssql'; import { MssqlDBService } from 'src/db/db.service'; -import { InsertNewServiceProviderDTO, UpdateServiceProviderDTO } from 'src/dto/sp.dto'; +import { InsertNewServiceProviderDTO, UpdateServiceProviderDTO } from 'src/dto/sp/sp.dto'; import * as mssql from 'mssql' import { SPID_DTO } from 'src/dto/property.dto'; diff --git a/src/oracle/carnet-application/carnet-application.controller.ts b/src/oracle/carnet-application/carnet-application.controller.ts new file mode 100644 index 0000000..4466c5e --- /dev/null +++ b/src/oracle/carnet-application/carnet-application.controller.ts @@ -0,0 +1,21 @@ +import { Body, Controller, Post } from '@nestjs/common'; +import { CarnetApplicationService } from './carnet-application.service'; +import { ApiTags } from '@nestjs/swagger'; +import { SaveCarnetApplicationDTO, TransmitApplicationtoProcessDTO } from 'src/dto/carnet-application/carnet-application.dto'; + +@ApiTags('Carnet Application - Oracle') +@Controller('oracle') +export class CarnetApplicationController { + + constructor(private readonly carnetApplicationService: CarnetApplicationService) { } + + @Post('SaveCarnetApplication') + async CreateClientData(@Body() body: SaveCarnetApplicationDTO) { + return this.carnetApplicationService.SaveCarnetApplication(body); + } + + @Post('TransmitApplicationtoProcess') + TransmitApplicationtoProcess(@Body() body: TransmitApplicationtoProcessDTO) { + return this.carnetApplicationService.TransmitApplicationtoProcess(body); + } +} diff --git a/src/oracle/carnet-application/carnet-application.module.ts b/src/oracle/carnet-application/carnet-application.module.ts new file mode 100644 index 0000000..a96f46d --- /dev/null +++ b/src/oracle/carnet-application/carnet-application.module.ts @@ -0,0 +1,9 @@ +import { Module } from '@nestjs/common'; +import { CarnetApplicationController } from './carnet-application.controller'; +import { CarnetApplicationService } from './carnet-application.service'; + +@Module({ + controllers: [CarnetApplicationController], + providers: [CarnetApplicationService] +}) +export class CarnetApplicationModule {} diff --git a/src/oracle/carnet-application/carnet-application.service.ts b/src/oracle/carnet-application/carnet-application.service.ts new file mode 100644 index 0000000..50a3e7c --- /dev/null +++ b/src/oracle/carnet-application/carnet-application.service.ts @@ -0,0 +1,259 @@ +import { Injectable, Logger } from '@nestjs/common'; +import { OracleDBService } from 'src/db/db.service'; +import { SaveCarnetApplicationDTO, TransmitApplicationtoProcessDTO } from 'src/dto/carnet-application/carnet-application.dto'; +import * as oracledb from 'oracledb' +import { InternalServerException } from 'src/exceptions/internalServerError.exception'; +import { closeOracleDbConnection, fetchCursor, handleError } from 'src/utils/helper'; +import { COUNTRYTABLE_DTO, COUNTRYTABLE_ROW_DTO, GLTABLE_DTO, GLTABLE_ROW_DTO } from 'src/dto/property.dto'; + +@Injectable() +export class CarnetApplicationService { + + private readonly logger = new Logger(CarnetApplicationService.name); + + constructor(private readonly oracleDBService: OracleDBService) { } + + async SaveCarnetApplication(body: SaveCarnetApplicationDTO) { + + const newBody = { + p_spid: null, // + P_CLIENTID: null, + P_LOCATIONID: null, + p_userid: null, // + P_HEADERID: null, + P_APPLICATIONNAME: 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)); + + 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); + + const finalBody = { ...newBody, ...reqBody }; + + let connection; + try { + connection = await this.oracleDBService.getConnection(); + + // const res = await connection.execute(`SELECT CARNETSYS.GLARRAY(1, 'Description for itemno 1', 2500, 20, 12, 'LBS', 'US') FROM dual`); + + // return res; + + const GLTABLE = await connection.getDbObjectClass('CARNETSYS.GLTABLE'); + + if (typeof GLTABLE !== 'function') { + throw new InternalServerException('GLTABLE is not a constructor'); + } + + async function createGLArrayInstance( + 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, + }, + ); + console.log(result.rows); + + return result.rows[0][0]; + } + + const GLTABLE_ARRAY: GLTABLE_DTO = { + P_GLTABLE: await Promise.all( + (finalBody.P_GLTABLE ?? []).map(async (x: GLTABLE_ROW_DTO) => { + return await createGLArrayInstance( + x.ITEMNO, + x.ITEMDESCRIPTION, + x.ITEMVALUE, + x.NOOFPIECES, + x.ITEMWEIGHT, + x.ITEMWEIGHTUOM, + x.GOODSORIGINCOUNTRY, + ); + }) + ) + }; + + + const GLTABLE_INSTANCE = new GLTABLE(GLTABLE_ARRAY.P_GLTABLE ?? []); + + const COUNTRYTABLE = await connection.getDbObjectClass('CARNETSYS.CARNETCOUNTRYTABLE'); + + if (typeof COUNTRYTABLE !== 'function') { + throw new Error('COUNTRYTABLE is not a constructor'); + } + + async function createCarnetCountryArrayInstance( + P_VISISTTRANSITIND, + COUNTRYCODE, + NOOFTIMESENTLEAVE, + ) { + const result = await connection.execute( + `SELECT CARNETSYS.CARNETCOUNTRYARRAY(:P_VISISTTRANSITIND, :COUNTRYCODE, :NOOFTIMESENTLEAVE) FROM dual`, + { + P_VISISTTRANSITIND, + COUNTRYCODE, + NOOFTIMESENTLEAVE, + }, + ); + console.log(result.rows); + return result.rows[0][0]; + } + + const COUNTRYTABLE_ARRAY: COUNTRYTABLE_DTO = { + P_COUNTRYTABLE: await Promise.all( + (finalBody.P_COUNTRYTABLE ?? []).map(async (x: COUNTRYTABLE_ROW_DTO) => { + return await createCarnetCountryArrayInstance( + x.P_VISISTTRANSITIND, + x.COUNTRYCODE, + x.NOOFTIMESENTLEAVE, + ); + }) + ) + }; + + + const COUNTRYTABLE_INSTANCE = new COUNTRYTABLE(COUNTRYTABLE_ARRAY.P_COUNTRYTABLE ?? []); + + + // return { aa:GLTABLE_ARRAY, ab:COUNTRYTABLE_ARRAY, a: GLTABLE_INSTANCE, b: COUNTRYTABLE_INSTANCE } + + const result = await connection.execute( + `BEGIN + CARNETAPPLICATION_PKG.SaveCarnetApplication( + :P_SPID, :P_CLIENTID, :P_LOCATIONID, :P_USERID, :P_HEADERID, :P_APPLICATIONNAME, :P_HOLDERID, :P_COMMERCIALSAMPLEFLAG, :P_PROFEQUIPMENTFLAG, :P_EXHIBITIONSFAIRFLAG, :P_AUTOFLAG, :P_HORSEFLAG, :P_AUTHREP, :P_GLTABLE, :P_USSETS, :P_COUNTRYTABLE, :P_SHIPTOTYPE, :P_SHIPADDRID, :P_FORMOFSECURITY, :P_INSPROTECTION, :P_LDIPROTECTION, :P_DELIVERYTYPE, :P_DELIVERYMETHOD, :P_PAYMENTMETHOD, :P_CUSTCOURIERNO, :P_REFNO, :P_NOTES, :P_CURSOR + ); + END;`, + { + P_SPID: { val: body.p_spid, type: oracledb.DB_TYPE_NUMBER }, + P_CLIENTID: { val: body.P_CLIENTID, type: oracledb.DB_TYPE_NUMBER }, + P_LOCATIONID: { val: body.P_LOCATIONID, type: oracledb.DB_TYPE_NUMBER }, + P_USERID: { val: body.p_userid, type: oracledb.DB_TYPE_VARCHAR }, + P_HEADERID: { val: body.P_HEADERID, type: oracledb.DB_TYPE_NUMBER }, + P_APPLICATIONNAME: { val: body.P_APPLICATIONNAME, type: oracledb.DB_TYPE_VARCHAR }, + P_HOLDERID: { val: body.P_HOLDERID, type: oracledb.DB_TYPE_NUMBER }, + P_COMMERCIALSAMPLEFLAG: { val: body.P_COMMERCIALSAMPLEFLAG, type: oracledb.DB_TYPE_VARCHAR }, + P_PROFEQUIPMENTFLAG: { val: body.P_PROFEQUIPMENTFLAG, type: oracledb.DB_TYPE_VARCHAR }, + P_EXHIBITIONSFAIRFLAG: { val: body.P_EXHIBITIONSFAIRFLAG, type: oracledb.DB_TYPE_VARCHAR }, + P_AUTOFLAG: { val: body.P_AUTOFLAG, type: oracledb.DB_TYPE_VARCHAR }, + P_HORSEFLAG: { val: body.P_HORSEFLAG, type: oracledb.DB_TYPE_VARCHAR }, + P_AUTHREP: { val: body.P_AUTHREP, type: oracledb.DB_TYPE_VARCHAR }, + P_GLTABLE: { val: GLTABLE_INSTANCE, type: 'CARNETSYS.GLTABLE' }, + // P_GLTABLE: { val: GLTABLE_INSTANCE, type: oracledb.DB_TYPE_OBJECT }, + P_USSETS: { val: body.P_USSETS, type: oracledb.DB_TYPE_NUMBER }, + // P_COUNTRYTABLE: { val: COUNTRYTABLE_INSTANCE, type: 'CARNETSYS.CARNETCOUNTRYTABLE' }, + P_COUNTRYTABLE: { val: COUNTRYTABLE_INSTANCE, type: oracledb.DB_TYPE_OBJECT }, + P_SHIPTOTYPE: { val: body.P_SHIPTOTYPE, type: oracledb.DB_TYPE_VARCHAR }, + P_SHIPADDRID: { val: body.P_SHIPADDRID, type: oracledb.DB_TYPE_NUMBER }, + P_FORMOFSECURITY: { val: body.P_FORMOFSECURITY, type: oracledb.DB_TYPE_VARCHAR }, + P_INSPROTECTION: { val: body.P_INSPROTECTION, type: oracledb.DB_TYPE_VARCHAR }, + P_LDIPROTECTION: { val: body.P_LDIPROTECTION, type: oracledb.DB_TYPE_VARCHAR }, + P_DELIVERYTYPE: { val: body.P_DELIVERYTYPE, type: oracledb.DB_TYPE_VARCHAR }, + P_DELIVERYMETHOD: { val: body.P_DELIVERYMETHOD, type: oracledb.DB_TYPE_VARCHAR }, + P_PAYMENTMETHOD: { val: body.P_PAYMENTMETHOD, type: oracledb.DB_TYPE_VARCHAR }, + P_CUSTCOURIERNO: { val: body.P_CUSTCOURIERNO, type: oracledb.DB_TYPE_VARCHAR }, + P_REFNO: { val: body.P_REFNO, type: oracledb.DB_TYPE_VARCHAR }, + P_NOTES: { val: body.P_NOTES, type: oracledb.DB_TYPE_VARCHAR }, + P_CURSOR: { dir: oracledb.BIND_OUT, type: oracledb.CURSOR }, + // p_cursor: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT } + }, + { outFormat: oracledb.OUT_FORMAT_OBJECT } + ); + + await connection.commit(); + + const outBinds = result.outBinds; + if (!outBinds?.P_CURSOR) { + this.logger.error('One or more expected cursors are missing from stored procedure output.'); + throw new InternalServerException("Incomplete data received from the database."); + } + + return await fetchCursor(outBinds.p_cursor, CarnetApplicationService.name); + } catch (error) { + handleError(error, CarnetApplicationService.name) + } finally { + await closeOracleDbConnection(connection, CarnetApplicationService.name) + } + } + + async TransmitApplicationtoProcess(body: TransmitApplicationtoProcessDTO) { + let connection; + try { + connection = await this.oracleDBService.getConnection(); + + 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_spid, 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 } + }, + { outFormat: oracledb.OUT_FORMAT_OBJECT } + ); + + await connection.commit(); + + const outBinds = result.outBinds; + if (!outBinds?.P_CURSOR) { + this.logger.error('One or more expected cursors are missing from stored procedure output.'); + throw new InternalServerException("Incomplete data received from the database."); + } + + return await fetchCursor(outBinds.p_cursor, CarnetApplicationService.name); + } catch (error) { + handleError(error, CarnetApplicationService.name) + } finally { + await closeOracleDbConnection(connection, CarnetApplicationService.name) + } + } + +} diff --git a/src/oracle/home-page/home-page.controller.ts b/src/oracle/home-page/home-page.controller.ts index 105d7c1..fb121ec 100644 --- a/src/oracle/home-page/home-page.controller.ts +++ b/src/oracle/home-page/home-page.controller.ts @@ -67,14 +67,14 @@ export class HomePageController { } } - @ApiTags('HomePage - Oracle') - @Post('/oracle/SaveCarnetApplication') + // @ApiTags('HomePage - Oracle') + // @Post('/oracle/SaveCarnetApplication') SaveCarnetApplication(@Body() body: SaveCarnetApplicationDTO) { return this.homePageService.SaveCarnetApplication(body); } - @ApiTags('HomePage - Oracle') - @Post('/oracle/TransmitApplicationtoProcess') + // @ApiTags('HomePage - Oracle') + // @Post('/oracle/TransmitApplicationtoProcess') TransmitApplicationtoProcess(@Body() body: TransmitApplicationtoProcessDTO) { return this.homePageService.TransmitApplicationtoProcess(body); } diff --git a/src/oracle/oracle.module.ts b/src/oracle/oracle.module.ts index 15045b6..82178ca 100644 --- a/src/oracle/oracle.module.ts +++ b/src/oracle/oracle.module.ts @@ -7,6 +7,7 @@ import { ParamTableModule } from './param-table/param-table.module'; import { ManageFeeModule } from './manage-fee/manage-fee.module'; import { ManageClientsModule } from './manage-clients/manage-clients.module'; import { UserMaintenanceModule } from './user-maintenance/user-maintenance.module'; +import { CarnetApplicationModule } from './carnet-application/carnet-application.module'; @Module({ imports: [ @@ -18,6 +19,7 @@ import { UserMaintenanceModule } from './user-maintenance/user-maintenance.modul ManageFeeModule, ManageHoldersModule, ManageClientsModule, + CarnetApplicationModule, ], providers: [], controllers: [], diff --git a/src/oracle/uscib-managed-sp/carnet-sequence/carnet-sequence.controller.ts b/src/oracle/uscib-managed-sp/carnet-sequence/carnet-sequence.controller.ts index 02d002b..c5be891 100644 --- a/src/oracle/uscib-managed-sp/carnet-sequence/carnet-sequence.controller.ts +++ b/src/oracle/uscib-managed-sp/carnet-sequence/carnet-sequence.controller.ts @@ -1,7 +1,7 @@ import { Body, Controller, Get, Post, Query } from '@nestjs/common'; import { CreateCarnetSequenceDTO -} from '../../../dto/carnet-sequence.dto'; +} from '../../../dto/carnet-sequence/carnet-sequence.dto'; import { ApiTags } from '@nestjs/swagger'; import { CarnetSequenceService } from './carnet-sequence.service'; import { SPID_DTO } from 'src/dto/property.dto'; diff --git a/src/oracle/uscib-managed-sp/carnet-sequence/carnet-sequence.service.ts b/src/oracle/uscib-managed-sp/carnet-sequence/carnet-sequence.service.ts index 2d26727..9233ebe 100644 --- a/src/oracle/uscib-managed-sp/carnet-sequence/carnet-sequence.service.ts +++ b/src/oracle/uscib-managed-sp/carnet-sequence/carnet-sequence.service.ts @@ -3,7 +3,7 @@ import * as oracledb from 'oracledb'; import { OracleDBService } from 'src/db/db.service'; import { CreateCarnetSequenceDTO, -} from '../../../dto/carnet-sequence.dto'; +} from '../../../dto/carnet-sequence/carnet-sequence.dto'; import { BadRequestException } from 'src/exceptions/badRequest.exception'; import { InternalServerException } from 'src/exceptions/internalServerError.exception'; diff --git a/src/oracle/uscib-managed-sp/region/region.controller.ts b/src/oracle/uscib-managed-sp/region/region.controller.ts index e65ddf8..1249585 100644 --- a/src/oracle/uscib-managed-sp/region/region.controller.ts +++ b/src/oracle/uscib-managed-sp/region/region.controller.ts @@ -3,7 +3,7 @@ import { RegionService } from './region.service'; import { Get, Post, Body, Controller, Patch } from '@nestjs/common'; import { ApiTags } from '@nestjs/swagger'; -import { InsertRegionsDto, UpdateRegionDto } from '../../../dto/region.dto'; +import { InsertRegionsDto, UpdateRegionDto } from '../../../dto/region/region.dto'; @ApiTags('Regions - Oracle') @Controller('oracle') diff --git a/src/oracle/uscib-managed-sp/region/region.service.ts b/src/oracle/uscib-managed-sp/region/region.service.ts index d1df147..f23e9dd 100644 --- a/src/oracle/uscib-managed-sp/region/region.service.ts +++ b/src/oracle/uscib-managed-sp/region/region.service.ts @@ -1,7 +1,7 @@ import { Injectable, Logger } from '@nestjs/common'; import { OracleDBService } from 'src/db/db.service'; import * as oracledb from 'oracledb'; -import { InsertRegionsDto, UpdateRegionDto } from '../../../dto/region.dto'; +import { InsertRegionsDto, UpdateRegionDto } from '../../../dto/region/region.dto'; import { BadRequestException } from 'src/exceptions/badRequest.exception'; import { InternalServerException } from 'src/exceptions/internalServerError.exception'; import { closeOracleDbConnection, fetchCursor, handleError } from 'src/utils/helper'; diff --git a/src/oracle/uscib-managed-sp/sp-contacts/sp-contacts.controller.ts b/src/oracle/uscib-managed-sp/sp-contacts/sp-contacts.controller.ts index e63a1a4..84ec3c4 100644 --- a/src/oracle/uscib-managed-sp/sp-contacts/sp-contacts.controller.ts +++ b/src/oracle/uscib-managed-sp/sp-contacts/sp-contacts.controller.ts @@ -3,7 +3,7 @@ import { Body, Controller, Get, Patch, Post, Put, Query } from '@nestjs/common'; import { InsertSPContactsDTO, UpdateSPContactsDTO, -} from '../../../dto/sp-contacts.dto'; +} from '../../../dto/sp-contacts/sp-contacts.dto'; import { ApiTags } from '@nestjs/swagger'; import { SP_CONTACTID_DTO, SP_ID_DTO } from 'src/dto/property.dto'; diff --git a/src/oracle/uscib-managed-sp/sp-contacts/sp-contacts.service.ts b/src/oracle/uscib-managed-sp/sp-contacts/sp-contacts.service.ts index 7e9ac64..64f5e09 100644 --- a/src/oracle/uscib-managed-sp/sp-contacts/sp-contacts.service.ts +++ b/src/oracle/uscib-managed-sp/sp-contacts/sp-contacts.service.ts @@ -4,7 +4,7 @@ import * as oracledb from 'oracledb'; import { InsertSPContactsDTO, UpdateSPContactsDTO, -} from '../../../dto/sp-contacts.dto'; +} from '../../../dto/sp-contacts/sp-contacts.dto'; import { BadRequestException } from 'src/exceptions/badRequest.exception'; import { InternalServerException } from 'src/exceptions/internalServerError.exception'; import { SP_CONTACTID_DTO, SP_ID_DTO } from 'src/dto/property.dto'; diff --git a/src/oracle/uscib-managed-sp/sp/sp.controller.ts b/src/oracle/uscib-managed-sp/sp/sp.controller.ts index 881b1a4..1d6e297 100644 --- a/src/oracle/uscib-managed-sp/sp/sp.controller.ts +++ b/src/oracle/uscib-managed-sp/sp/sp.controller.ts @@ -4,7 +4,7 @@ import { ApiTags } from '@nestjs/swagger'; import { InsertNewServiceProviderDTO, UpdateServiceProviderDTO, -} from '../../../dto/sp.dto'; +} from '../../../dto/sp/sp.dto'; import { SPID_DTO } from 'src/dto/property.dto'; @Controller('oracle') diff --git a/src/oracle/uscib-managed-sp/sp/sp.service.ts b/src/oracle/uscib-managed-sp/sp/sp.service.ts index 63c9c2b..2b60019 100644 --- a/src/oracle/uscib-managed-sp/sp/sp.service.ts +++ b/src/oracle/uscib-managed-sp/sp/sp.service.ts @@ -4,7 +4,7 @@ import * as oracledb from 'oracledb'; import { InsertNewServiceProviderDTO, UpdateServiceProviderDTO, -} from '../../../dto/sp.dto'; +} from '../../../dto/sp/sp.dto'; import { BadRequestException } from 'src/exceptions/badRequest.exception'; import { InternalServerException } from 'src/exceptions/internalServerError.exception'; import { SPID_DTO } from 'src/dto/property.dto'; diff --git a/src/oracle/user-maintenance/user-maintenance.controller.ts b/src/oracle/user-maintenance/user-maintenance.controller.ts index c57ed91..561681a 100644 --- a/src/oracle/user-maintenance/user-maintenance.controller.ts +++ b/src/oracle/user-maintenance/user-maintenance.controller.ts @@ -1,7 +1,7 @@ import { Body, Controller, Get, Param, Patch, Post, Query } from '@nestjs/common'; import { UserMaintenanceService } from './user-maintenance.service'; import { ApiTags } from '@nestjs/swagger'; -import { CreateClientLoginsDTO, CreateSPLoginsDTO, CreateUSCIBLoginsDTO, SPID_CLIENTID_DTO, SPID_EMAIL_DTO } from '../../dto/user-maintenance.dto'; +import { CreateClientLoginsDTO, CreateSPLoginsDTO, CreateUSCIBLoginsDTO, SPID_CLIENTID_DTO, SPID_EMAIL_DTO } from '../../dto/user-maintenance/user-maintenance.dto'; import { SPID_DTO, USERID_DTO } from 'src/dto/property.dto'; @ApiTags('User Maintenance - Oracle') diff --git a/src/oracle/user-maintenance/user-maintenance.service.ts b/src/oracle/user-maintenance/user-maintenance.service.ts index efc1bc5..40517ba 100644 --- a/src/oracle/user-maintenance/user-maintenance.service.ts +++ b/src/oracle/user-maintenance/user-maintenance.service.ts @@ -1,6 +1,6 @@ import { Injectable, Logger } from '@nestjs/common'; import { OracleDBService } from 'src/db/db.service'; -import { CreateClientLoginsDTO, CreateSPLoginsDTO, CreateUSCIBLoginsDTO, SPID_CLIENTID_DTO, SPID_EMAIL_DTO } from '../../dto/user-maintenance.dto'; +import { CreateClientLoginsDTO, CreateSPLoginsDTO, CreateUSCIBLoginsDTO, SPID_CLIENTID_DTO, SPID_EMAIL_DTO } from '../../dto/user-maintenance/user-maintenance.dto'; import { InternalServerException } from 'src/exceptions/internalServerError.exception'; import * as oracledb from 'oracledb'; import { BadRequestException } from 'src/exceptions/badRequest.exception'; @@ -320,7 +320,7 @@ export class UserMaintenanceService { END;`, { p_spid: { val: body.p_spid, type: oracledb.DB_TYPE_NUMBER }, - p_clientid: { val: body.p_clientid, type: oracledb.DB_TYPE_NUMBER }, + p_clientid: { val: body.P_CLIENTID, type: oracledb.DB_TYPE_NUMBER }, p_cursor: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT } }, { outFormat: oracledb.OUT_FORMAT_OBJECT }