|
@@ -11,8 +11,14 @@ export class Hetong {
|
|
|
@Column({ name: 'contract_date', type: 'date' })
|
|
@Column({ name: 'contract_date', type: 'date' })
|
|
|
contractDate!: Date;
|
|
contractDate!: Date;
|
|
|
|
|
|
|
|
- @Column({ name: 'user_id', type: 'varchar', length: 50 })
|
|
|
|
|
- userId!: string;
|
|
|
|
|
|
|
+ @Column({ name: 'user_id', type: 'varchar', length: 50, nullable: true })
|
|
|
|
|
+ userId?: string;
|
|
|
|
|
+
|
|
|
|
|
+ @Column({ name: 'created_by', type: 'int', nullable: true, comment: '创建人ID' })
|
|
|
|
|
+ createdBy?: number;
|
|
|
|
|
+
|
|
|
|
|
+ @Column({ name: 'updated_by', type: 'int', nullable: true, comment: '更新人ID' })
|
|
|
|
|
+ updatedBy?: number;
|
|
|
|
|
|
|
|
@Column({ name: 'client_id', type: 'int', unsigned: true })
|
|
@Column({ name: 'client_id', type: 'int', unsigned: true })
|
|
|
clientId!: number;
|
|
clientId!: number;
|
|
@@ -73,203 +79,202 @@ export class Hetong {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
export const HetongSchema = z.object({
|
|
export const HetongSchema = z.object({
|
|
|
- id: z.string().max(50).openapi({
|
|
|
|
|
|
|
+ id: z.number().int().positive().openapi({
|
|
|
description: '合同ID',
|
|
description: '合同ID',
|
|
|
- example: 'HT20230001'
|
|
|
|
|
|
|
+ example: 1
|
|
|
}),
|
|
}),
|
|
|
- contractDate: z.date().openapi({
|
|
|
|
|
|
|
+ contractDate: z.date().openapi({
|
|
|
description: '合同日期',
|
|
description: '合同日期',
|
|
|
- example: '2023-01-15'
|
|
|
|
|
|
|
+ example: '2023-01-15'
|
|
|
}),
|
|
}),
|
|
|
- userId: z.string().max(50).openapi({
|
|
|
|
|
|
|
+ userId: z.string().max(50).nullable().openapi({
|
|
|
description: '关联用户ID',
|
|
description: '关联用户ID',
|
|
|
- example: 'U1001'
|
|
|
|
|
|
|
+ example: 'U1001'
|
|
|
|
|
+ }),
|
|
|
|
|
+ createdBy: z.number().int().positive().nullable().openapi({
|
|
|
|
|
+ description: '创建人ID',
|
|
|
|
|
+ example: 1001
|
|
|
|
|
+ }),
|
|
|
|
|
+ updatedBy: z.number().int().positive().nullable().openapi({
|
|
|
|
|
+ description: '更新人ID',
|
|
|
|
|
+ example: 1001
|
|
|
}),
|
|
}),
|
|
|
clientId: z.number().int().positive().openapi({
|
|
clientId: z.number().int().positive().openapi({
|
|
|
description: '客户ID',
|
|
description: '客户ID',
|
|
|
example: 2001
|
|
example: 2001
|
|
|
}),
|
|
}),
|
|
|
- projectId: z.string().max(50).nullable().openapi({
|
|
|
|
|
|
|
+ projectId: z.string().max(50).nullable().openapi({
|
|
|
description: '项目ID',
|
|
description: '项目ID',
|
|
|
- example: 'P3001'
|
|
|
|
|
|
|
+ example: 'P3001'
|
|
|
}),
|
|
}),
|
|
|
- amount: z.number().multipleOf(0.01).openapi({
|
|
|
|
|
|
|
+ amount: z.number().multipleOf(0.01).openapi({
|
|
|
description: '合同金额',
|
|
description: '合同金额',
|
|
|
- example: 150000.00
|
|
|
|
|
|
|
+ example: 150000.00
|
|
|
}),
|
|
}),
|
|
|
- type: z.string().max(50).openapi({
|
|
|
|
|
|
|
+ type: z.string().max(50).openapi({
|
|
|
description: '合同类型',
|
|
description: '合同类型',
|
|
|
- example: '服务合同'
|
|
|
|
|
|
|
+ example: '服务合同'
|
|
|
}),
|
|
}),
|
|
|
- status: z.string().max(50).openapi({
|
|
|
|
|
|
|
+ status: z.string().max(50).openapi({
|
|
|
description: '合同状态:如生效中、已结束等',
|
|
description: '合同状态:如生效中、已结束等',
|
|
|
- example: '生效中'
|
|
|
|
|
|
|
+ example: '生效中'
|
|
|
}),
|
|
}),
|
|
|
- startDate: z.date().openapi({
|
|
|
|
|
|
|
+ startDate: z.date().openapi({
|
|
|
description: '开始日期',
|
|
description: '开始日期',
|
|
|
- example: '2023-02-01'
|
|
|
|
|
|
|
+ example: '2023-02-01'
|
|
|
}),
|
|
}),
|
|
|
- endDate: z.date().openapi({
|
|
|
|
|
|
|
+ endDate: z.date().openapi({
|
|
|
description: '结束日期',
|
|
description: '结束日期',
|
|
|
- example: '2024-01-31'
|
|
|
|
|
|
|
+ example: '2024-01-31'
|
|
|
}),
|
|
}),
|
|
|
- description: z.string().nullable().openapi({
|
|
|
|
|
|
|
+ description: z.string().nullable().openapi({
|
|
|
description: '合同描述',
|
|
description: '合同描述',
|
|
|
- example: '年度技术服务合同'
|
|
|
|
|
|
|
+ example: '年度技术服务合同'
|
|
|
}),
|
|
}),
|
|
|
- contractNumber: z.string().max(100).openapi({
|
|
|
|
|
|
|
+ contractNumber: z.string().max(100).openapi({
|
|
|
description: '合同编号',
|
|
description: '合同编号',
|
|
|
- example: 'HT-2023-0001'
|
|
|
|
|
|
|
+ example: 'HT-2023-0001'
|
|
|
}),
|
|
}),
|
|
|
- currency: z.string().max(20).openapi({
|
|
|
|
|
|
|
+ currency: z.string().max(20).openapi({
|
|
|
description: '货币类型',
|
|
description: '货币类型',
|
|
|
- example: 'CNY'
|
|
|
|
|
|
|
+ example: 'CNY'
|
|
|
}),
|
|
}),
|
|
|
- exchangeRate: z.number().multipleOf(0.0001).openapi({
|
|
|
|
|
|
|
+ exchangeRate: z.number().multipleOf(0.0001).openapi({
|
|
|
description: '汇率',
|
|
description: '汇率',
|
|
|
- example: 1.0000
|
|
|
|
|
|
|
+ example: 1.0000
|
|
|
}),
|
|
}),
|
|
|
- foreignAmount: z.number().multipleOf(0.01).nullable().openapi({
|
|
|
|
|
|
|
+ foreignAmount: z.number().multipleOf(0.01).nullable().openapi({
|
|
|
description: '外币金额',
|
|
description: '外币金额',
|
|
|
- example: null
|
|
|
|
|
|
|
+ example: null
|
|
|
}),
|
|
}),
|
|
|
- filePath: z.string().max(512).nullable().openapi({
|
|
|
|
|
|
|
+ filePath: z.string().max(512).nullable().openapi({
|
|
|
description: '合同文件路径',
|
|
description: '合同文件路径',
|
|
|
- example: '/uploads/contracts/2023/HT-2023-0001.pdf'
|
|
|
|
|
|
|
+ example: '/uploads/contracts/2023/HT-2023-0001.pdf'
|
|
|
}),
|
|
}),
|
|
|
- createdAt: z.date().openapi({
|
|
|
|
|
|
|
+ createdAt: z.date().openapi({
|
|
|
description: '创建时间',
|
|
description: '创建时间',
|
|
|
- example: '2023-01-15T00:00:00Z'
|
|
|
|
|
|
|
+ example: '2023-01-15T00:00:00Z'
|
|
|
}),
|
|
}),
|
|
|
- updatedAt: z.date().openapi({
|
|
|
|
|
|
|
+ updatedAt: z.date().openapi({
|
|
|
description: '更新时间',
|
|
description: '更新时间',
|
|
|
- example: '2023-01-15T00:00:00Z'
|
|
|
|
|
|
|
+ example: '2023-01-15T00:00:00Z'
|
|
|
})
|
|
})
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
export const CreateHetongDto = z.object({
|
|
export const CreateHetongDto = z.object({
|
|
|
-
|
|
|
|
|
- contractDate: z.coerce.date().openapi({
|
|
|
|
|
|
|
+ contractDate: z.coerce.date().openapi({
|
|
|
description: '合同日期',
|
|
description: '合同日期',
|
|
|
- example: '2023-01-15'
|
|
|
|
|
- }),
|
|
|
|
|
- userId: z.string().max(50).openapi({
|
|
|
|
|
- description: '关联用户ID',
|
|
|
|
|
- example: 'U1001'
|
|
|
|
|
|
|
+ example: '2023-01-15'
|
|
|
}),
|
|
}),
|
|
|
clientId: z.coerce.number().int().positive().openapi({
|
|
clientId: z.coerce.number().int().positive().openapi({
|
|
|
description: '客户ID',
|
|
description: '客户ID',
|
|
|
example: 2001
|
|
example: 2001
|
|
|
}),
|
|
}),
|
|
|
- projectId: z.string().max(50).nullable().optional().openapi({
|
|
|
|
|
|
|
+ projectId: z.string().max(50).nullable().optional().openapi({
|
|
|
description: '项目ID',
|
|
description: '项目ID',
|
|
|
- example: 'P3001'
|
|
|
|
|
|
|
+ example: 'P3001'
|
|
|
}),
|
|
}),
|
|
|
- amount: z.coerce.number().multipleOf(0.01).openapi({
|
|
|
|
|
|
|
+ amount: z.coerce.number().multipleOf(0.01).openapi({
|
|
|
description: '合同金额',
|
|
description: '合同金额',
|
|
|
- example: 150000.00
|
|
|
|
|
|
|
+ example: 150000.00
|
|
|
}),
|
|
}),
|
|
|
- type: z.string().max(50).openapi({
|
|
|
|
|
|
|
+ type: z.string().max(50).openapi({
|
|
|
description: '合同类型',
|
|
description: '合同类型',
|
|
|
- example: '服务合同'
|
|
|
|
|
|
|
+ example: '服务合同'
|
|
|
}),
|
|
}),
|
|
|
- status: z.string().max(50).openapi({
|
|
|
|
|
|
|
+ status: z.string().max(50).openapi({
|
|
|
description: '合同状态:如生效中、已结束等',
|
|
description: '合同状态:如生效中、已结束等',
|
|
|
- example: '生效中'
|
|
|
|
|
|
|
+ example: '生效中'
|
|
|
}),
|
|
}),
|
|
|
- startDate: z.coerce.date().openapi({
|
|
|
|
|
|
|
+ startDate: z.coerce.date().openapi({
|
|
|
description: '开始日期',
|
|
description: '开始日期',
|
|
|
- example: '2023-02-01'
|
|
|
|
|
|
|
+ example: '2023-02-01'
|
|
|
}),
|
|
}),
|
|
|
- endDate: z.coerce.date().openapi({
|
|
|
|
|
|
|
+ endDate: z.coerce.date().openapi({
|
|
|
description: '结束日期',
|
|
description: '结束日期',
|
|
|
- example: '2024-01-31'
|
|
|
|
|
|
|
+ example: '2024-01-31'
|
|
|
}),
|
|
}),
|
|
|
- description: z.string().nullable().optional().openapi({
|
|
|
|
|
|
|
+ description: z.string().nullable().optional().openapi({
|
|
|
description: '合同描述',
|
|
description: '合同描述',
|
|
|
- example: '年度技术服务合同'
|
|
|
|
|
|
|
+ example: '年度技术服务合同'
|
|
|
}),
|
|
}),
|
|
|
- contractNumber: z.string().max(100).openapi({
|
|
|
|
|
|
|
+ contractNumber: z.string().max(100).openapi({
|
|
|
description: '合同编号',
|
|
description: '合同编号',
|
|
|
- example: 'HT-2023-0001'
|
|
|
|
|
|
|
+ example: 'HT-2023-0001'
|
|
|
}),
|
|
}),
|
|
|
- currency: z.string().max(20).default('CNY').openapi({
|
|
|
|
|
|
|
+ currency: z.string().max(20).default('CNY').openapi({
|
|
|
description: '货币类型',
|
|
description: '货币类型',
|
|
|
- example: 'CNY'
|
|
|
|
|
|
|
+ example: 'CNY'
|
|
|
}),
|
|
}),
|
|
|
- exchangeRate: z.coerce.number().multipleOf(0.0001).default(1).openapi({
|
|
|
|
|
|
|
+ exchangeRate: z.coerce.number().multipleOf(0.0001).default(1).openapi({
|
|
|
description: '汇率',
|
|
description: '汇率',
|
|
|
- example: 1.0000
|
|
|
|
|
|
|
+ example: 1.0000
|
|
|
}),
|
|
}),
|
|
|
- foreignAmount: z.coerce.number().multipleOf(0.01).nullable().optional().openapi({
|
|
|
|
|
|
|
+ foreignAmount: z.coerce.number().multipleOf(0.01).nullable().optional().openapi({
|
|
|
description: '外币金额',
|
|
description: '外币金额',
|
|
|
- example: null
|
|
|
|
|
|
|
+ example: null
|
|
|
}),
|
|
}),
|
|
|
- filePath: z.string().max(512).nullable().optional().openapi({
|
|
|
|
|
|
|
+ filePath: z.string().max(512).nullable().optional().openapi({
|
|
|
description: '合同文件路径',
|
|
description: '合同文件路径',
|
|
|
- example: '/uploads/contracts/2023/HT-2023-0001.pdf'
|
|
|
|
|
|
|
+ example: '/uploads/contracts/2023/HT-2023-0001.pdf'
|
|
|
})
|
|
})
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
export const UpdateHetongDto = z.object({
|
|
export const UpdateHetongDto = z.object({
|
|
|
- contractDate: z.coerce.date().optional().openapi({
|
|
|
|
|
|
|
+ contractDate: z.coerce.date().optional().openapi({
|
|
|
description: '合同日期',
|
|
description: '合同日期',
|
|
|
- example: '2023-01-15'
|
|
|
|
|
- }),
|
|
|
|
|
- userId: z.string().max(50).optional().openapi({
|
|
|
|
|
- description: '关联用户ID',
|
|
|
|
|
- example: 'U1001'
|
|
|
|
|
|
|
+ example: '2023-01-15'
|
|
|
}),
|
|
}),
|
|
|
clientId: z.coerce.number().int().positive().optional().openapi({
|
|
clientId: z.coerce.number().int().positive().optional().openapi({
|
|
|
description: '客户ID',
|
|
description: '客户ID',
|
|
|
example: 2001
|
|
example: 2001
|
|
|
}),
|
|
}),
|
|
|
- projectId: z.string().max(50).nullable().optional().openapi({
|
|
|
|
|
|
|
+ projectId: z.string().max(50).nullable().optional().openapi({
|
|
|
description: '项目ID',
|
|
description: '项目ID',
|
|
|
- example: 'P3001'
|
|
|
|
|
|
|
+ example: 'P3001'
|
|
|
}),
|
|
}),
|
|
|
- amount: z.coerce.number().multipleOf(0.01).optional().openapi({
|
|
|
|
|
|
|
+ amount: z.coerce.number().multipleOf(0.01).optional().openapi({
|
|
|
description: '合同金额',
|
|
description: '合同金额',
|
|
|
- example: 150000.00
|
|
|
|
|
|
|
+ example: 150000.00
|
|
|
}),
|
|
}),
|
|
|
- type: z.string().max(50).optional().openapi({
|
|
|
|
|
|
|
+ type: z.string().max(50).optional().openapi({
|
|
|
description: '合同类型',
|
|
description: '合同类型',
|
|
|
- example: '服务合同'
|
|
|
|
|
|
|
+ example: '服务合同'
|
|
|
}),
|
|
}),
|
|
|
- status: z.string().max(50).optional().openapi({
|
|
|
|
|
|
|
+ status: z.string().max(50).optional().openapi({
|
|
|
description: '合同状态:如生效中、已结束等',
|
|
description: '合同状态:如生效中、已结束等',
|
|
|
- example: '生效中'
|
|
|
|
|
|
|
+ example: '生效中'
|
|
|
}),
|
|
}),
|
|
|
- startDate: z.coerce.date().optional().openapi({
|
|
|
|
|
|
|
+ startDate: z.coerce.date().optional().openapi({
|
|
|
description: '开始日期',
|
|
description: '开始日期',
|
|
|
- example: '2023-02-01'
|
|
|
|
|
|
|
+ example: '2023-02-01'
|
|
|
}),
|
|
}),
|
|
|
- endDate: z.coerce.date().optional().openapi({
|
|
|
|
|
|
|
+ endDate: z.coerce.date().optional().openapi({
|
|
|
description: '结束日期',
|
|
description: '结束日期',
|
|
|
- example: '2024-01-31'
|
|
|
|
|
|
|
+ example: '2024-01-31'
|
|
|
}),
|
|
}),
|
|
|
- description: z.string().nullable().optional().openapi({
|
|
|
|
|
|
|
+ description: z.string().nullable().optional().openapi({
|
|
|
description: '合同描述',
|
|
description: '合同描述',
|
|
|
- example: '年度技术服务合同'
|
|
|
|
|
|
|
+ example: '年度技术服务合同'
|
|
|
}),
|
|
}),
|
|
|
- contractNumber: z.string().max(100).optional().openapi({
|
|
|
|
|
|
|
+ contractNumber: z.string().max(100).optional().openapi({
|
|
|
description: '合同编号',
|
|
description: '合同编号',
|
|
|
- example: 'HT-2023-0001'
|
|
|
|
|
|
|
+ example: 'HT-2023-0001'
|
|
|
}),
|
|
}),
|
|
|
- currency: z.string().max(20).optional().openapi({
|
|
|
|
|
|
|
+ currency: z.string().max(20).optional().openapi({
|
|
|
description: '货币类型',
|
|
description: '货币类型',
|
|
|
- example: 'CNY'
|
|
|
|
|
|
|
+ example: 'CNY'
|
|
|
}),
|
|
}),
|
|
|
- exchangeRate: z.coerce.number().multipleOf(0.0001).optional().openapi({
|
|
|
|
|
|
|
+ exchangeRate: z.coerce.number().multipleOf(0.0001).optional().openapi({
|
|
|
description: '汇率',
|
|
description: '汇率',
|
|
|
- example: 1.0000
|
|
|
|
|
|
|
+ example: 1.0000
|
|
|
}),
|
|
}),
|
|
|
- foreignAmount: z.coerce.number().multipleOf(0.01).nullable().optional().openapi({
|
|
|
|
|
|
|
+ foreignAmount: z.coerce.number().multipleOf(0.01).nullable().optional().openapi({
|
|
|
description: '外币金额',
|
|
description: '外币金额',
|
|
|
- example: null
|
|
|
|
|
|
|
+ example: null
|
|
|
}),
|
|
}),
|
|
|
- filePath: z.string().max(512).nullable().optional().openapi({
|
|
|
|
|
|
|
+ filePath: z.string().max(512).nullable().optional().openapi({
|
|
|
description: '合同文件路径',
|
|
description: '合同文件路径',
|
|
|
- example: '/uploads/contracts/2023/HT-2023-0001.pdf'
|
|
|
|
|
|
|
+ example: '/uploads/contracts/2023/HT-2023-0001.pdf'
|
|
|
})
|
|
})
|
|
|
});
|
|
});
|