feat(observations): add dto
This commit is contained in:
parent
4315e7f31f
commit
3cd2bdc82b
1 changed files with 38 additions and 0 deletions
38
src/observations/dto.ts
Normal file
38
src/observations/dto.ts
Normal file
|
|
@ -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;
|
||||
}
|
||||
Loading…
Reference in a new issue