54 lines
1.3 KiB
TypeScript
54 lines
1.3 KiB
TypeScript
import { Transform } from 'class-transformer';
|
|
import { IsObject, IsOptional, IsString, IsUUID, Matches, MaxLength, MinLength } from 'class-validator';
|
|
|
|
export class CreateFieldDiscoveryDto {
|
|
@IsUUID('4')
|
|
visitId!: string;
|
|
|
|
@Transform(({ value }) => typeof value === 'string' ? value.trim().toUpperCase() : value)
|
|
@IsString()
|
|
@MinLength(1)
|
|
@MaxLength(120)
|
|
@Matches(/^[A-Z0-9][A-Z0-9._/-]*$/)
|
|
code!: string;
|
|
|
|
@Transform(({ value }) => typeof value === 'string' ? value.trim() : value)
|
|
@IsString()
|
|
@MinLength(1)
|
|
@MaxLength(200)
|
|
name!: string;
|
|
|
|
@IsOptional()
|
|
@Transform(({ value }) => typeof value === 'string' && value.trim() ? value.trim() : null)
|
|
@IsString()
|
|
@MaxLength(200)
|
|
commonName?: string | null;
|
|
|
|
@IsUUID('4')
|
|
typeId!: string;
|
|
|
|
@IsUUID('4')
|
|
parentId!: string;
|
|
|
|
@IsUUID('4')
|
|
operationalAreaId!: string;
|
|
|
|
@IsUUID('4')
|
|
operatorCompanyId!: string;
|
|
|
|
@IsOptional()
|
|
@Transform(({ value }) => typeof value === 'string' && value.trim() ? value.trim() : null)
|
|
@IsString()
|
|
@MaxLength(4000)
|
|
description?: string | null;
|
|
|
|
@IsOptional()
|
|
@Transform(({ value }) => typeof value === 'string' && value.trim() ? value.trim() : null)
|
|
@IsString()
|
|
@MaxLength(4000)
|
|
discoveryNotes?: string | null;
|
|
|
|
@IsObject()
|
|
attributes!: Record<string, unknown>;
|
|
}
|