fix: require notice threshold when type time (#24784)
* feat: enhance validation for confirmation policy notice threshold * feat: add confirmation policy validation tests for event types
This commit is contained in:
1 parent
e9d409c0d5
commit
807848cce2
2 files changed
+199
-20
No files matched your search
+2
-2
@@ -1,6 +1,6 @@
|
||||
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
|
||||
import { Type } from "class-transformer";
|
||||
import { IsEnum, IsOptional, IsInt, ValidateNested, IsBoolean } from "class-validator";
|
||||
import { IsEnum, IsOptional, IsInt, ValidateNested, IsBoolean, ValidateIf } from "class-validator";
|
||||
import type { ValidatorConstraintInterface, ValidationOptions } from "class-validator";
|
||||
import { ValidatorConstraint, registerDecorator } from "class-validator";
|
||||
|
||||
@@ -35,7 +35,7 @@ export class BaseConfirmationPolicy_2024_06_14 {
|
||||
})
|
||||
type!: ConfirmationPolicyEnum;
|
||||
|
||||
@IsOptional()
|
||||
@ValidateIf((o) => o.type === ConfirmationPolicyEnum.TIME || o.noticeThreshold !== undefined)
|
||||
@ValidateNested()
|
||||
@Type(() => NoticeThreshold_2024_06_14)
|
||||
@ApiPropertyOptional({
|
||||
|
||||
Reference in new issue
Block a user