|
|
@@ -4,12 +4,10 @@ import { Client } from '../clients/client.entity';
|
|
|
import { z } from '@hono/zod-openapi';
|
|
|
|
|
|
// 合同状态枚举
|
|
|
-export const CONTRACT_STATUS = {
|
|
|
- PENDING: '待审',
|
|
|
- ACTIVE: '合同有效'
|
|
|
-} as const;
|
|
|
-
|
|
|
-export type ContractStatusType = typeof CONTRACT_STATUS[keyof typeof CONTRACT_STATUS];
|
|
|
+export enum ContractStatus {
|
|
|
+ PENDING = 'pending',
|
|
|
+ ACTIVE = 'active'
|
|
|
+}
|
|
|
|
|
|
@Entity('hetong')
|
|
|
export class Hetong {
|
|
|
@@ -44,8 +42,8 @@ export class Hetong {
|
|
|
@Column({ name: 'type', type: 'varchar', length: 50 })
|
|
|
type!: string;
|
|
|
|
|
|
- @Column({ name: 'status', type: 'varchar', length: 50, default: '待审' })
|
|
|
- status!: string;
|
|
|
+ @Column({ name: 'status', type: 'varchar', length: 50, default: 'pending' })
|
|
|
+ status!: ContractStatus;
|
|
|
|
|
|
@Column({ name: 'received_amount', type: 'decimal', precision: 15, scale: 2, default: 0 })
|
|
|
receivedAmount!: number;
|
|
|
@@ -129,9 +127,9 @@ export const HetongSchema = z.object({
|
|
|
description: '合同类型',
|
|
|
example: '服务合同'
|
|
|
}),
|
|
|
- status: z.string().max(50).openapi({
|
|
|
- description: '合同状态:待审/合同有效',
|
|
|
- example: '待审'
|
|
|
+ status: z.enum(['pending', 'active']).openapi({
|
|
|
+ description: '合同状态:pending待审/active合同有效',
|
|
|
+ example: 'pending'
|
|
|
}),
|
|
|
startDate: z.date().openapi({
|
|
|
description: '开始日期',
|
|
|
@@ -196,9 +194,9 @@ export const CreateHetongDto = z.object({
|
|
|
description: '合同类型',
|
|
|
example: '服务合同'
|
|
|
}),
|
|
|
- status: z.string().max(50).openapi({
|
|
|
- description: '合同状态:待审/合同有效',
|
|
|
- example: '待审'
|
|
|
+ status: z.enum(['pending', 'active']).openapi({
|
|
|
+ description: '合同状态:pending待审/active合同有效',
|
|
|
+ example: 'pending'
|
|
|
}),
|
|
|
startDate: z.coerce.date().openapi({
|
|
|
description: '开始日期',
|
|
|
@@ -255,9 +253,9 @@ export const UpdateHetongDto = z.object({
|
|
|
description: '合同类型',
|
|
|
example: '服务合同'
|
|
|
}),
|
|
|
- status: z.string().max(50).optional().openapi({
|
|
|
- description: '合同状态:待审/合同有效',
|
|
|
- example: '待审'
|
|
|
+ status: z.enum(['pending', 'active']).optional().openapi({
|
|
|
+ description: '合同状态:pending待审/active合同有效',
|
|
|
+ example: 'pending'
|
|
|
}),
|
|
|
startDate: z.coerce.date().optional().openapi({
|
|
|
description: '开始日期',
|