diff --git a/src/dto/carnet-application/carnet-application-property.dto.ts b/src/dto/carnet-application/carnet-application-property.dto.ts index a16181b..cebe486 100644 --- a/src/dto/carnet-application/carnet-application-property.dto.ts +++ b/src/dto/carnet-application/carnet-application-property.dto.ts @@ -169,6 +169,17 @@ export class GLTABLE_DTO { P_GLTABLE: GLTABLE_ROW_DTO[]; } +export class ITEMNO_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' }) + P_ITEMNO: number; +} + export class USSETS_DTO { @ApiProperty({ required: true }) // @Max(99999, { message: 'Property P_USSETS must not exceed 99999' }) diff --git a/src/dto/carnet-application/carnet-application.dto.ts b/src/dto/carnet-application/carnet-application.dto.ts index 8b0dab9..55892f1 100644 --- a/src/dto/carnet-application/carnet-application.dto.ts +++ b/src/dto/carnet-application/carnet-application.dto.ts @@ -4,7 +4,7 @@ import { APPLICATIONNAME_DTO, AUTHREP_DTO, AUTO_FLAG_DTO, COMMERCIAL_SAMPLE_FLAG_DTO, COUNTRYTABLE_DTO, CUSTCOURIERNO_DTO, DELIVERYMETHOD_DTO, DELIVERYTYPE_DTO, EXIBITIONS_FAIR_FLAG_DTO, FORMOFSECURITY_DTO, GLTABLE_DTO, HEADERID_DTO, - HORSE_FLAG_DTO, INSPROTECTION_DTO, LDIPROTECTION_DTO, ORDERTYPE_DTO, PAYMENTMETHOD_DTO, + HORSE_FLAG_DTO, INSPROTECTION_DTO, ITEMNO_DTO, LDIPROTECTION_DTO, ORDERTYPE_DTO, PAYMENTMETHOD_DTO, PROF_EQUIPMENT_FLAG_DTO, REFNO_DTO, SHIPADDRID_DTO, SHIPTOTYPE_DTO, USSETS_DTO } from "./carnet-application-property.dto"; @@ -72,6 +72,10 @@ export class AddGenerallistItemsDTO extends IntersectionType( HEADERID_DTO, GLTABLE_DTO, USERID_DTO ) { } +export class DeleteGenerallistItemsDTO extends IntersectionType( + HEADERID_DTO, ITEMNO_DTO, USERID_DTO +){} + export class AddCountriesDTO extends IntersectionType( HEADERID_DTO, USSETS_DTO, COUNTRYTABLE_DTO, USERID_DTO ) { } diff --git a/src/oracle/carnet-application/carnet-application.controller.ts b/src/oracle/carnet-application/carnet-application.controller.ts index 69eb98c..1fb39e6 100644 --- a/src/oracle/carnet-application/carnet-application.controller.ts +++ b/src/oracle/carnet-application/carnet-application.controller.ts @@ -7,7 +7,7 @@ import { AddCountriesDTO, AddGenerallistItemsDTO, CA_UpdateHolderDTO, - CarnetProcessingCenterDTO, CreateApplicationDTO, GetCarnetControlCenterDTO, SaveCarnetApplicationDTO, TransmitApplicationtoProcessDTO, + CarnetProcessingCenterDTO, CreateApplicationDTO, DeleteGenerallistItemsDTO, GetCarnetControlCenterDTO, SaveCarnetApplicationDTO, TransmitApplicationtoProcessDTO, UpdateExpGoodsAuthRepDTO, UpdateShippingDetailsDTO } from 'src/dto/property.dto'; @@ -69,7 +69,7 @@ export class CarnetApplicationController { } @Delete('DeleteGenerallistItems') - DeleteGenerallistItems(@Body() body: AddGenerallistItemsDTO) { + DeleteGenerallistItems(@Body() body: DeleteGenerallistItemsDTO) { return this.carnetApplicationService.DeleteGenerallistItems(body); } diff --git a/src/oracle/carnet-application/carnet-application.service.ts b/src/oracle/carnet-application/carnet-application.service.ts index 5e1d10b..67956d4 100644 --- a/src/oracle/carnet-application/carnet-application.service.ts +++ b/src/oracle/carnet-application/carnet-application.service.ts @@ -12,7 +12,8 @@ import { AddCountriesDTO, UpdateShippingDetailsDTO, CA_UpdateHolderDTO, - GetCarnetControlCenterDTO + GetCarnetControlCenterDTO, + DeleteGenerallistItemsDTO } from 'src/dto/property.dto'; import { OracleService } from '../oracle.service'; import { BadRequestException } from 'src/exceptions/badRequest.exception'; @@ -515,7 +516,7 @@ export class CarnetApplicationService { } } - async DeleteGenerallistItems(body: AddGenerallistItemsDTO) { + async DeleteGenerallistItems(body: DeleteGenerallistItemsDTO) { let connection; try { connection = await this.oracleDBService.getConnection(); @@ -525,12 +526,13 @@ export class CarnetApplicationService { const result = await connection.execute( `BEGIN CARNETAPPLICATION_PKG.DeleteGenerallistItems( - :P_HEADERID, :P_GLTABLE, :P_USERID, :P_CURSOR + :P_HEADERID, :P_ITEMNO, :P_USERID, :P_CURSOR ); END;`, { P_HEADERID: { val: body.P_HEADERID, type: oracledb.DB_TYPE_NUMBER }, - P_GLTABLE: { val: GLTABLE_INSTANCE, type: 'CARNETSYS.GLTABLE' }, + P_ITEMNO: { val: body.P_ITEMNO, type: oracledb.DB_TYPE_NUMBER }, + // P_GLTABLE: { val: GLTABLE_INSTANCE, type: 'CARNETSYS.GLTABLE' }, // P_GLTABLE: { val: GLTABLE_INSTANCE, type: oracledb.DB_TYPE_OBJECT }, P_USERID: { val: body.P_USERID, type: oracledb.DB_TYPE_NVARCHAR }, // P_ERRORMESG: { dir: oracledb.BIND_OUT, type: oracledb.CURSOR },