Files
DianZhanDemo/shared/dist/schemas/user.d.ts

63 lines
5.3 KiB
TypeScript
Raw Normal View History

2025-12-11 02:09:07 +08:00
/**
* Valibot
* User-related Valibot validation schemas
*/
import * as v from 'valibot';
/**
*
* Base user validation schema
*/
export declare const BaseUserSchema: v.ObjectSchema<{
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<"姓名必须是字符串">, v.TrimAction, v.MinLengthAction<string, 2, "姓名至少需要2个字符">, v.MaxLengthAction<string, 50, "姓名不能超过50个字符">, v.NonEmptyAction<string, "姓名不能为空">]>;
readonly email: v.SchemaWithPipe<readonly [v.StringSchema<"邮箱必须是字符串">, v.TrimAction, v.EmailAction<string, "请输入有效的邮箱地址">, v.MaxLengthAction<string, 100, "邮箱不能超过100个字符">]>;
readonly age: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<"年龄必须是数字">, v.IntegerAction<number, "年龄必须是整数">, v.MinValueAction<number, 1, "年龄不能小于1岁">, v.MaxValueAction<number, 150, "年龄不能超过150岁">]>, undefined>;
}, undefined>;
/**
*
* Create user validation schema
*/
export declare const CreateUserSchema: v.ObjectSchema<{
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<"姓名必须是字符串">, v.TrimAction, v.MinLengthAction<string, 2, "姓名至少需要2个字符">, v.MaxLengthAction<string, 50, "姓名不能超过50个字符">, v.NonEmptyAction<string, "姓名不能为空">]>;
readonly email: v.SchemaWithPipe<readonly [v.StringSchema<"邮箱必须是字符串">, v.TrimAction, v.EmailAction<string, "请输入有效的邮箱地址">, v.MaxLengthAction<string, 100, "邮箱不能超过100个字符">]>;
readonly age: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<"年龄必须是数字">, v.IntegerAction<number, "年龄必须是整数">, v.MinValueAction<number, 1, "年龄不能小于1岁">, v.MaxValueAction<number, 150, "年龄不能超过150岁">]>, undefined>;
}, undefined>;
/**
* -
* Update user validation schema - all fields are optional
*/
export declare const UpdateUserSchema: v.ObjectSchema<{
readonly name: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<"姓名必须是字符串">, v.TrimAction, v.MinLengthAction<string, 2, "姓名至少需要2个字符">, v.MaxLengthAction<string, 50, "姓名不能超过50个字符">, v.NonEmptyAction<string, "姓名不能为空">]>, undefined>;
readonly email: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<"邮箱必须是字符串">, v.TrimAction, v.EmailAction<string, "请输入有效的邮箱地址">, v.MaxLengthAction<string, 100, "邮箱不能超过100个字符">]>, undefined>;
readonly age: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<"年龄必须是数字">, v.IntegerAction<number, "年龄必须是整数">, v.MinValueAction<number, 1, "年龄不能小于1岁">, v.MaxValueAction<number, 150, "年龄不能超过150岁">]>, undefined>;
}, undefined>;
/**
*
* User query parameters validation schema
*/
export declare const UserQuerySchema: v.ObjectSchema<{
readonly page: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<"页码必须是数字">, v.IntegerAction<number, "页码必须是整数">, v.MinValueAction<number, 1, "页码不能小于1">]>, 1>;
readonly limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<"每页数量必须是数字">, v.IntegerAction<number, "每页数量必须是整数">, v.MinValueAction<number, 1, "每页数量不能小于1">, v.MaxValueAction<number, 100, "每页数量不能超过100">]>, 10>;
readonly search: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<"搜索关键词必须是字符串">, v.TrimAction, v.MaxLengthAction<string, 100, "搜索关键词不能超过100个字符">]>, undefined>;
readonly minAge: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<"最小年龄必须是数字">, v.IntegerAction<number, "最小年龄必须是整数">, v.MinValueAction<number, 1, "最小年龄不能小于1岁">]>, undefined>;
readonly maxAge: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<"最大年龄必须是数字">, v.IntegerAction<number, "最大年龄必须是整数">, v.MaxValueAction<number, 150, "最大年龄不能超过150岁">]>, undefined>;
}, undefined>;
/**
*
* Email query validation schema
*/
export declare const EmailQuerySchema: v.ObjectSchema<{
readonly email: v.SchemaWithPipe<readonly [v.StringSchema<"邮箱必须是字符串">, v.TrimAction, v.EmailAction<string, "请输入有效的邮箱地址">, v.NonEmptyAction<string, "邮箱不能为空">]>;
}, undefined>;
/**
* ID
* ID parameter validation schema
*/
export declare const UserIdSchema: v.ObjectSchema<{
readonly id: v.SchemaWithPipe<readonly [v.NumberSchema<"用户ID必须是数字">, v.IntegerAction<number, "用户ID必须是整数">, v.MinValueAction<number, 1, "用户ID必须大于0">]>;
}, undefined>;
export type CreateUserInput = v.InferInput<typeof CreateUserSchema>;
export type UpdateUserInput = v.InferInput<typeof UpdateUserSchema>;
export type UserQueryParams = v.InferInput<typeof UserQuerySchema>;
export type EmailQuery = v.InferInput<typeof EmailQuerySchema>;
export type UserIdParams = v.InferInput<typeof UserIdSchema>;
//# sourceMappingURL=user.d.ts.map