Explorar el Código

🐛 fix(user): 修复头像字段可选性问题

- 将头像字段的可选性从仅optional修改为nullable().optional()
- 允许头像字段为null值,修复数据验证错误
yourname hace 4 meses
padre
commit
4bea231e8e
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      src/server/modules/users/user.schema.ts

+ 1 - 1
src/server/modules/users/user.schema.ts

@@ -40,7 +40,7 @@ export const UserSchema = z.object({
     fullUrl: z.string().openapi({ description: '文件完整URL', example: 'https://example.com/avatar.jpg' }),
     type: z.string().nullable().openapi({ description: '文件类型', example: 'image/jpeg' }),
     size: z.number().nullable().openapi({ description: '文件大小(字节)', example: 102400 })
-  }).optional().openapi({
+  }).nullable().optional().openapi({
     description: '头像文件信息'
   }),
   isDisabled: z.number().int().min(0).max(1).default(DisabledStatus.ENABLED).openapi({