Files
dh-inspeccion-v2/api-v3/src/asset-master/dto/update-asset-provenance.dto.ts
T

40 lines
815 B
TypeScript

import { Transform } from 'class-transformer';
import {
IsEnum,
IsISO8601,
IsOptional,
IsString,
MaxLength,
} from 'class-validator';
import { AssetDataOrigin } from '../../database/entities';
const nullableTrim = ({ value }: { value: unknown }) =>
typeof value === 'string' ? value.trim() || null : value;
export class UpdateAssetProvenanceDto {
@IsEnum(AssetDataOrigin)
origin!: AssetDataOrigin;
@IsOptional()
@Transform(nullableTrim)
@IsString()
@MaxLength(160)
sourceName?: string | null;
@IsOptional()
@Transform(nullableTrim)
@IsString()
@MaxLength(255)
sourceReference?: string | null;
@IsOptional()
@IsISO8601({ strict: true })
observedAt?: string | null;
@IsOptional()
@Transform(nullableTrim)
@IsString()
@MaxLength(4000)
notes?: string | null;
}