Files
dh-inspeccion-v2/api-v3/src/inspection-reports/dto/create-inspection-report-follow-up.dto.ts
T

24 lines
753 B
TypeScript

import { Transform } from 'class-transformer';
import { IsEnum, IsOptional, IsString, Matches, MaxLength } from 'class-validator';
import { InspectionReportFollowUpType } from '../../database/entities';
export class CreateInspectionReportFollowUpDto {
@IsEnum(InspectionReportFollowUpType)
eventType!: InspectionReportFollowUpType;
@IsOptional()
@Transform(({ value }) => (typeof value === 'string' && value.trim() ? value.trim() : null))
@IsString()
@MaxLength(255)
referenceNumber?: string | null;
@Matches(/^\d{4}-\d{2}-\d{2}$/)
occurredOn!: string;
@IsOptional()
@Transform(({ value }) => (typeof value === 'string' && value.trim() ? value.trim() : null))
@IsString()
@MaxLength(20000)
description?: string | null;
}