From 3cd2bdc82b4c2bc5f2254dc19e17ca1b5e8aa0b9 Mon Sep 17 00:00:00 2001 From: admin-valentin Date: Fri, 31 Jul 2026 10:45:00 +0000 Subject: [PATCH] feat(observations): add dto --- src/observations/dto.ts | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/observations/dto.ts diff --git a/src/observations/dto.ts b/src/observations/dto.ts new file mode 100644 index 0000000..d6cdf02 --- /dev/null +++ b/src/observations/dto.ts @@ -0,0 +1,38 @@ +import { IsISO8601, IsNumber, IsOptional, IsString, Length, Max, Min } from 'class-validator'; + +export class CreateObservationDto { + @IsString() + @Length(1, 64) + subjectType!: string; + + @IsString() + @Length(1, 255) + subjectId!: string; + + @IsString() + @Length(1, 128) + metric!: string; + + @IsString() + @Length(1, 1000) + value!: string; + + @IsOptional() + @IsString() + @Length(1, 32) + unit?: string; + + @IsString() + @Length(1, 128) + source!: string; + + @IsOptional() + @IsISO8601() + observedAt?: string; + + @IsOptional() + @IsNumber() + @Min(0) + @Max(1) + confidence?: number; +}