|
@@ -154,143 +154,135 @@ export const ExpenseSchema = z.object({
|
|
|
|
|
|
|
|
export const CreateExpenseDto = z.object({
|
|
export const CreateExpenseDto = z.object({
|
|
|
|
|
|
|
|
- expenseDate: z.coerce.date().openapi({
|
|
|
|
|
|
|
+ expenseDate: z.coerce.date().openapi({
|
|
|
description: '费用发生日期',
|
|
description: '费用发生日期',
|
|
|
- example: '2023-01-15'
|
|
|
|
|
- }),
|
|
|
|
|
- userId: z.string().max(50).openapi({
|
|
|
|
|
- description: '产生费用的用户ID',
|
|
|
|
|
- example: 'U1001'
|
|
|
|
|
|
|
+ example: '2023-01-15'
|
|
|
}),
|
|
}),
|
|
|
- type: z.string().max(50).openapi({
|
|
|
|
|
|
|
+ type: z.string().max(50).openapi({
|
|
|
description: '费用类型',
|
|
description: '费用类型',
|
|
|
- example: '差旅费'
|
|
|
|
|
|
|
+ example: '差旅费'
|
|
|
}),
|
|
}),
|
|
|
- amount: z.coerce.number().multipleOf(0.01).openapi({
|
|
|
|
|
|
|
+ amount: z.coerce.number().multipleOf(0.01).openapi({
|
|
|
description: '费用金额',
|
|
description: '费用金额',
|
|
|
- example: 1500.50
|
|
|
|
|
|
|
+ example: 1500.50
|
|
|
}),
|
|
}),
|
|
|
clientId: z.coerce.number().int().positive().nullable().optional().openapi({
|
|
clientId: z.coerce.number().int().positive().nullable().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'
|
|
|
}),
|
|
}),
|
|
|
- department: z.string().max(100).nullable().optional().openapi({
|
|
|
|
|
|
|
+ department: z.string().max(100).nullable().optional().openapi({
|
|
|
description: '产生费用的部门',
|
|
description: '产生费用的部门',
|
|
|
- example: '研发部'
|
|
|
|
|
|
|
+ example: '研发部'
|
|
|
}),
|
|
}),
|
|
|
- description: z.string().nullable().optional().openapi({
|
|
|
|
|
|
|
+ description: z.string().nullable().optional().openapi({
|
|
|
description: '费用描述',
|
|
description: '费用描述',
|
|
|
- example: '参加技术研讨会差旅费'
|
|
|
|
|
|
|
+ example: '参加技术研讨会差旅费'
|
|
|
}),
|
|
}),
|
|
|
- status: z.string().max(50).openapi({
|
|
|
|
|
|
|
+ status: z.string().max(50).openapi({
|
|
|
description: '费用状态:如审批中、已报销等',
|
|
description: '费用状态:如审批中、已报销等',
|
|
|
- example: '审批中'
|
|
|
|
|
|
|
+ example: '审批中'
|
|
|
}),
|
|
}),
|
|
|
- approver: z.string().max(50).nullable().optional().openapi({
|
|
|
|
|
|
|
+ approver: z.string().max(50).nullable().optional().openapi({
|
|
|
description: '费用审批人ID',
|
|
description: '费用审批人ID',
|
|
|
- example: 'U1002'
|
|
|
|
|
|
|
+ example: 'U1002'
|
|
|
}),
|
|
}),
|
|
|
- approveDate: z.coerce.date().nullable().optional().openapi({
|
|
|
|
|
|
|
+ approveDate: z.coerce.date().nullable().optional().openapi({
|
|
|
description: '费用审批日期',
|
|
description: '费用审批日期',
|
|
|
- example: '2023-01-20'
|
|
|
|
|
|
|
+ example: '2023-01-20'
|
|
|
}),
|
|
}),
|
|
|
- reimbursementDate: z.coerce.date().nullable().optional().openapi({
|
|
|
|
|
|
|
+ reimbursementDate: z.coerce.date().nullable().optional().openapi({
|
|
|
description: '费用报销日期',
|
|
description: '费用报销日期',
|
|
|
- example: '2023-01-25'
|
|
|
|
|
|
|
+ example: '2023-01-25'
|
|
|
}),
|
|
}),
|
|
|
- paymentMethod: z.string().max(50).nullable().optional().openapi({
|
|
|
|
|
|
|
+ paymentMethod: z.string().max(50).nullable().optional().openapi({
|
|
|
description: '支付方式',
|
|
description: '支付方式',
|
|
|
- example: '银行卡'
|
|
|
|
|
|
|
+ example: '银行卡'
|
|
|
}),
|
|
}),
|
|
|
- invoiceNumber: z.string().max(100).nullable().optional().openapi({
|
|
|
|
|
|
|
+ invoiceNumber: z.string().max(100).nullable().optional().openapi({
|
|
|
description: '发票号码',
|
|
description: '发票号码',
|
|
|
- example: 'INV20230125001'
|
|
|
|
|
|
|
+ example: 'INV20230125001'
|
|
|
}),
|
|
}),
|
|
|
- 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
|
|
|
})
|
|
})
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
export const UpdateExpenseDto = z.object({
|
|
export const UpdateExpenseDto = z.object({
|
|
|
- expenseDate: z.coerce.date().optional().openapi({
|
|
|
|
|
|
|
+ expenseDate: 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'
|
|
|
}),
|
|
}),
|
|
|
- type: z.string().max(50).optional().openapi({
|
|
|
|
|
|
|
+ type: z.string().max(50).optional().openapi({
|
|
|
description: '费用类型',
|
|
description: '费用类型',
|
|
|
- example: '差旅费'
|
|
|
|
|
|
|
+ example: '差旅费'
|
|
|
}),
|
|
}),
|
|
|
- amount: z.coerce.number().multipleOf(0.01).optional().openapi({
|
|
|
|
|
|
|
+ amount: z.coerce.number().multipleOf(0.01).optional().openapi({
|
|
|
description: '费用金额',
|
|
description: '费用金额',
|
|
|
- example: 1500.50
|
|
|
|
|
|
|
+ example: 1500.50
|
|
|
}),
|
|
}),
|
|
|
clientId: z.coerce.number().int().positive().nullable().optional().openapi({
|
|
clientId: z.coerce.number().int().positive().nullable().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'
|
|
|
}),
|
|
}),
|
|
|
- department: z.string().max(100).nullable().optional().openapi({
|
|
|
|
|
|
|
+ department: z.string().max(100).nullable().optional().openapi({
|
|
|
description: '产生费用的部门',
|
|
description: '产生费用的部门',
|
|
|
- example: '研发部'
|
|
|
|
|
|
|
+ example: '研发部'
|
|
|
}),
|
|
}),
|
|
|
- description: z.string().nullable().optional().openapi({
|
|
|
|
|
|
|
+ description: z.string().nullable().optional().openapi({
|
|
|
description: '费用描述',
|
|
description: '费用描述',
|
|
|
- example: '参加技术研讨会差旅费'
|
|
|
|
|
|
|
+ example: '参加技术研讨会差旅费'
|
|
|
}),
|
|
}),
|
|
|
- status: z.string().max(50).optional().openapi({
|
|
|
|
|
|
|
+ status: z.string().max(50).optional().openapi({
|
|
|
description: '费用状态:如审批中、已报销等',
|
|
description: '费用状态:如审批中、已报销等',
|
|
|
- example: '已报销'
|
|
|
|
|
|
|
+ example: '已报销'
|
|
|
}),
|
|
}),
|
|
|
- approver: z.string().max(50).nullable().optional().openapi({
|
|
|
|
|
|
|
+ approver: z.string().max(50).nullable().optional().openapi({
|
|
|
description: '费用审批人ID',
|
|
description: '费用审批人ID',
|
|
|
- example: 'U1002'
|
|
|
|
|
|
|
+ example: 'U1002'
|
|
|
}),
|
|
}),
|
|
|
- approveDate: z.coerce.date().nullable().optional().openapi({
|
|
|
|
|
|
|
+ approveDate: z.coerce.date().nullable().optional().openapi({
|
|
|
description: '费用审批日期',
|
|
description: '费用审批日期',
|
|
|
- example: '2023-01-20'
|
|
|
|
|
|
|
+ example: '2023-01-20'
|
|
|
}),
|
|
}),
|
|
|
- reimbursementDate: z.coerce.date().nullable().optional().openapi({
|
|
|
|
|
|
|
+ reimbursementDate: z.coerce.date().nullable().optional().openapi({
|
|
|
description: '费用报销日期',
|
|
description: '费用报销日期',
|
|
|
- example: '2023-01-25'
|
|
|
|
|
|
|
+ example: '2023-01-25'
|
|
|
}),
|
|
}),
|
|
|
- paymentMethod: z.string().max(50).nullable().optional().openapi({
|
|
|
|
|
|
|
+ paymentMethod: z.string().max(50).nullable().optional().openapi({
|
|
|
description: '支付方式',
|
|
description: '支付方式',
|
|
|
- example: '银行卡'
|
|
|
|
|
|
|
+ example: '银行卡'
|
|
|
}),
|
|
}),
|
|
|
- invoiceNumber: z.string().max(100).nullable().optional().openapi({
|
|
|
|
|
|
|
+ invoiceNumber: z.string().max(100).nullable().optional().openapi({
|
|
|
description: '发票号码',
|
|
description: '发票号码',
|
|
|
- example: 'INV20230125001'
|
|
|
|
|
|
|
+ example: 'INV20230125001'
|
|
|
}),
|
|
}),
|
|
|
- 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
|
|
|
})
|
|
})
|
|
|
});
|
|
});
|