fix: 强化工作空间字段运行时校验
This commit is contained in:
1 parent
1503f042e0
commit
1a4e806ca8
2 files changed
+33
-10
No files matched your search
@@ -1,4 +1,15 @@
|
||||
import { IsArray, IsBoolean, IsIn, IsInt, IsOptional, IsString, Max, Min } from "class-validator";
|
||||
import {
|
||||
IsArray,
|
||||
IsBoolean,
|
||||
IsIn,
|
||||
IsInt,
|
||||
IsObject,
|
||||
IsOptional,
|
||||
IsString,
|
||||
Matches,
|
||||
Max,
|
||||
Min,
|
||||
} from "class-validator";
|
||||
|
||||
export class UpdateBrandDto {
|
||||
@IsOptional() @IsString() name?: string;
|
||||
@@ -137,21 +148,21 @@ export class UpdateModuleDto {
|
||||
}
|
||||
|
||||
export class CreateFieldDefinitionDto {
|
||||
@IsString() scope!: string;
|
||||
@IsString() key!: string;
|
||||
@IsIn(["profile", "service", "inquiry"]) scope!: string;
|
||||
@IsString() @Matches(/^[a-z][a-z0-9_]*$/) key!: string;
|
||||
@IsString() label!: string;
|
||||
@IsIn(["text", "textarea", "number", "date", "select", "multi-select", "image", "url", "phone"])
|
||||
type!: string;
|
||||
@IsOptional() @IsBoolean() required?: boolean;
|
||||
@IsOptional() @IsBoolean() isVisible?: boolean;
|
||||
@IsOptional() @IsInt() @Min(0) @Max(9999) sortOrder?: number;
|
||||
@IsOptional() options?: unknown;
|
||||
@IsOptional() visibleWhen?: unknown;
|
||||
@IsOptional() @IsArray() options?: unknown[];
|
||||
@IsOptional() @IsObject() visibleWhen?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export class UpdateFieldDefinitionDto {
|
||||
@IsOptional() @IsString() scope?: string;
|
||||
@IsOptional() @IsString() key?: string;
|
||||
@IsOptional() @IsIn(["profile", "service", "inquiry"]) scope?: string;
|
||||
@IsOptional() @IsString() @Matches(/^[a-z][a-z0-9_]*$/) key?: string;
|
||||
@IsOptional() @IsString() label?: string;
|
||||
@IsOptional()
|
||||
@IsIn(["text", "textarea", "number", "date", "select", "multi-select", "image", "url", "phone"])
|
||||
@@ -159,8 +170,8 @@ export class UpdateFieldDefinitionDto {
|
||||
@IsOptional() @IsBoolean() required?: boolean;
|
||||
@IsOptional() @IsBoolean() isVisible?: boolean;
|
||||
@IsOptional() @IsInt() @Min(0) @Max(9999) sortOrder?: number;
|
||||
@IsOptional() options?: unknown;
|
||||
@IsOptional() visibleWhen?: unknown;
|
||||
@IsOptional() @IsArray() options?: unknown[];
|
||||
@IsOptional() @IsObject() visibleWhen?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export class CreateInquiryFormDto {
|
||||
|
||||
Reference in new issue
Block a user