2
0
Просмотр исходного кода

✨ feat(customer): 优化客户创建DTO字段定义

- 为phone、email、company和source字段添加optional()约束
- 允许客户创建时可选提交联系电话、电子邮箱、公司名称和客户来源信息
yourname 6 месяцев назад
Родитель
Сommit
7d882c8ca1
1 измененных файлов с 4 добавлено и 4 удалено
  1. 4 4
      src/server/modules/customers/customer.entity.ts

+ 4 - 4
src/server/modules/customers/customer.entity.ts

@@ -75,19 +75,19 @@ export const CreateCustomerDto = z.object({
     description: '客户姓名',
     example: '张三'
   }),
-  phone: z.string().max(20).nullable().openapi({
+  phone: z.string().max(20).nullable().optional().openapi({
     description: '联系电话',
     example: '13800138000'
   }),
-  email: z.string().email().nullable().openapi({
+  email: z.string().email().nullable().optional().openapi({
     description: '电子邮箱',
     example: 'zhangsan@example.com'
   }),
-  company: z.string().max(255).nullable().openapi({
+  company: z.string().max(255).nullable().optional().openapi({
     description: '公司名称',
     example: '示例科技有限公司'
   }),
-  source: z.string().max(50).nullable().openapi({
+  source: z.string().max(50).nullable().optional().openapi({
     description: '客户来源',
     example: '网站'
   })