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

🐛 fix(contracts): 修复合同续签记录中contractId类型错误

- 将contractId字段类型从string修正为number,与数据库定义保持一致
- 更新验证规则,确保contractId为正整数
- 调整示例值为数字类型,反映正确的数据格式
yourname 8 месяцев назад
Родитель
Сommit
c4a323c1dc
1 измененных файлов с 7 добавлено и 7 удалено
  1. 7 7
      src/server/modules/contracts/hetong-renew.entity.ts

+ 7 - 7
src/server/modules/contracts/hetong-renew.entity.ts

@@ -9,7 +9,7 @@ export class HetongRenew {
 
   @Column({ name: 'contract_id', type: 'int', unsigned: true })
   @ForeignKey(() => Hetong)
-  contractId!: string;
+  contractId!: number;
 
   @Column({ name: 'amount', type: 'varchar', length: 50, nullable: true })
   amount?: string;
@@ -58,9 +58,9 @@ export const HetongRenewSchema = z.object({
     description: '续签记录ID',
     example: 'HTR20230001' 
   }),
-  contractId: z.string().max(50).openapi({ 
+  contractId: z.number().openapi({ 
     description: '原合同ID',
-    example: 'HT20230001' 
+    example: 12345 
   }),
   amount: z.string().max(50).nullable().openapi({ 
     description: '续签金额',
@@ -113,9 +113,9 @@ export const HetongRenewSchema = z.object({
 });
 
 export const CreateHetongRenewDto = z.object({
-  contractId: z.coerce.string().max(50).openapi({ 
+  contractId: z.coerce.number().int().positive().openapi({ 
     description: '原合同ID',
-    example: 'HT20230001' 
+    example: 12345 
   }),
   amount: z.string().max(50).nullable().optional().openapi({ 
     description: '续签金额',
@@ -156,9 +156,9 @@ export const CreateHetongRenewDto = z.object({
 });
 
 export const UpdateHetongRenewDto = z.object({
-  contractId: z.string().max(50).optional().openapi({ 
+  contractId: z.coerce.number().optional().openapi({ 
     description: '原合同ID',
-    example: 'HT20230001' 
+    example: 12345 
   }),
   amount: z.string().max(50).nullable().optional().openapi({ 
     description: '续签金额',