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

♻️ refactor(silver-jobs): 优化公司实体经纬度字段类型处理

- 为longitude字段添加z.coerce.number()转换,支持字符串到数字的自动转换
- 为latitude字段添加z.coerce.number()转换,增强数据类型兼容性
yourname 7 месяцев назад
Родитель
Сommit
b0e8cd90a1
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      src/server/modules/silver-jobs/company.entity.ts

+ 2 - 2
src/server/modules/silver-jobs/company.entity.ts

@@ -33,11 +33,11 @@ export const CompanySchema = z.object({
     description: '企业地址',
     example: '北京市朝阳区科技园区88号'
   }),
-  longitude: z.number().multipleOf(0.000001).openapi({
+  longitude: z.coerce.number().multipleOf(0.000001).openapi({
     description: '经度',
     example: 116.4074
   }),
-  latitude: z.number().multipleOf(0.000001).openapi({
+  latitude: z.coerce.number().multipleOf(0.000001).openapi({
     description: '纬度',
     example: 39.9042
   }),