Files
dh-inspeccion-v2/api-v3/src/inspection-visits/dto/create-field-inventory.dto.ts
T
DH V2 079728aa6d
Android CI / RC / Android · lint, tests, debug APK, release compile (push) Successful in 3m41s
DH V2 CI / API · typecheck, tests, build (push) Successful in 31s
DH V2 CI / WEB · typecheck, build (push) Successful in 19s
Production dependency audit / API · production dependencies (push) Successful in 9s
Production dependency audit / WEB · production dependencies (push) Successful in 8s
DH V2 CI / Docker / scripts contract (push) Successful in 1m14s
feat(f6.8): harden offline field flow and act documents
2026-09-15 15:56:50 -03:00

94 lines
1.9 KiB
TypeScript

import { Transform, Type } from 'class-transformer';
import {
IsISO8601,
IsNumber,
IsObject,
IsOptional,
IsString,
IsUUID,
Matches,
Max,
MaxLength,
Min,
MinLength,
} from 'class-validator';
export class CreateFieldInventoryDto {
@IsOptional()
@IsUUID('4')
clientGeneratedId?: string;
@IsUUID('4')
typeId!: string;
@IsOptional()
@IsUUID('4')
parentId?: string;
@IsOptional()
@IsUUID('4')
familyId?: string;
@IsOptional()
@Transform(({ value }) => typeof value === 'string' && value.trim() ? value.trim().toUpperCase() : undefined)
@IsString()
@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;
@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>;
@Type(() => Number)
@IsNumber({ maxDecimalPlaces: 6 })
@Min(-90)
@Max(90)
deviceLatitude!: number;
@Type(() => Number)
@IsNumber({ maxDecimalPlaces: 6 })
@Min(-180)
@Max(180)
deviceLongitude!: number;
@IsOptional()
@Type(() => Number)
@IsNumber({ maxDecimalPlaces: 3 })
@Min(0)
@Max(100000)
deviceAccuracyM?: number;
@IsISO8601({ strict: true })
deviceCapturedAt!: string;
@IsOptional()
@Transform(({ value }) => typeof value === 'string' && value.trim() ? value.trim() : null)
@IsString()
@MaxLength(255)
deviceLabel?: string | null;
}