95 lines
1.5 KiB
TypeScript
95 lines
1.5 KiB
TypeScript
import { Type } from 'class-transformer';
|
|
import {
|
|
IsArray,
|
|
IsDateString,
|
|
IsInt,
|
|
IsNumber,
|
|
IsOptional,
|
|
IsString,
|
|
MaxLength,
|
|
Min,
|
|
ValidateNested,
|
|
} from 'class-validator';
|
|
|
|
export class PredictionValueDto {
|
|
@IsString()
|
|
fieldId!: string;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
@MaxLength(200)
|
|
valueText?: string;
|
|
|
|
@IsOptional()
|
|
@IsNumber()
|
|
valueNumber?: number;
|
|
|
|
@IsOptional()
|
|
@IsDateString()
|
|
valueDate?: string;
|
|
}
|
|
|
|
export class UpsertPredictionEntryDto {
|
|
@IsOptional()
|
|
@IsInt()
|
|
@Min(1)
|
|
selectedBabyIndex?: number;
|
|
|
|
@IsArray()
|
|
@ValidateNested({ each: true })
|
|
@Type(() => PredictionValueDto)
|
|
values!: PredictionValueDto[];
|
|
}
|
|
|
|
export class OutcomeValueDto {
|
|
@IsString()
|
|
fieldId!: string;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
@MaxLength(200)
|
|
valueText?: string;
|
|
|
|
@IsOptional()
|
|
@IsNumber()
|
|
valueNumber?: number;
|
|
|
|
@IsOptional()
|
|
@IsDateString()
|
|
valueDate?: string;
|
|
}
|
|
|
|
export class SetOutcomesDto {
|
|
@IsOptional()
|
|
@IsInt()
|
|
@Min(1)
|
|
selectedBabyIndex?: number;
|
|
|
|
@IsArray()
|
|
@ValidateNested({ each: true })
|
|
@Type(() => OutcomeValueDto)
|
|
values!: OutcomeValueDto[];
|
|
}
|
|
|
|
export class ValidateScoreItemDto {
|
|
@IsString()
|
|
fieldId!: string;
|
|
|
|
@IsOptional()
|
|
@IsInt()
|
|
@Min(0)
|
|
awardedPoints?: number;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
@MaxLength(300)
|
|
note?: string;
|
|
}
|
|
|
|
export class ValidateScoresDto {
|
|
@IsArray()
|
|
@ValidateNested({ each: true })
|
|
@Type(() => ValidateScoreItemDto)
|
|
scores!: ValidateScoreItemDto[];
|
|
}
|