From 41b52d34bf0d9baf738b36fa82f2b097583d3042 Mon Sep 17 00:00:00 2001 From: enlineawork Date: Mon, 7 Sep 2026 20:10:11 -0300 Subject: [PATCH] =?UTF-8?q?F4.7=20=C2=B7=20DTO=20de=20reincidencia?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...create-recurrent-inspection-finding.dto.ts | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 api-v3/src/inspection-findings/dto/create-recurrent-inspection-finding.dto.ts diff --git a/api-v3/src/inspection-findings/dto/create-recurrent-inspection-finding.dto.ts b/api-v3/src/inspection-findings/dto/create-recurrent-inspection-finding.dto.ts new file mode 100644 index 0000000..37b78ec --- /dev/null +++ b/api-v3/src/inspection-findings/dto/create-recurrent-inspection-finding.dto.ts @@ -0,0 +1,38 @@ +import { Transform, Type } from 'class-transformer'; +import { + IsInt, + IsOptional, + IsString, + IsUUID, + Matches, + Max, + MaxLength, + Min, + MinLength, +} from 'class-validator'; + +const optionalText = ({ value }: { value: unknown }) => + typeof value === 'string' && value.trim() ? value.trim() : null; + +export class CreateRecurrentInspectionFindingDto { + @IsUUID('4') + antecedentFindingId!: string; + + @Transform(({ value }) => (typeof value === 'string' ? value.trim() : value)) + @IsString() + @MinLength(1) + @MaxLength(20000) + description!: string; + + @IsOptional() + @Type(() => Number) + @IsInt() + @Min(1) + @Max(10) + severity?: number; + + @IsOptional() + @Transform(optionalText) + @Matches(/^\d{4}-\d{2}-\d{2}$/) + correctionDueOn?: string | null; +}