feat(server): 工作流扩展 leave 实体骨架(F24)

- workflow_instances 解耦 reimbursement FK:新增 reimbursement_id/leave_request_id + 回填迁移
- 新增 leave_requests 表与 /api/leave-requests 最小链路(create/submit)
- workflow approve/reject/return 支持 leave 状态更新;transfer 非报销任务禁用
- seed-config 增加 leave workflow definition;更新 v3 CSV 状态推进
这个提交包含在:
2026-02-09 21:24:53 +08:00
父节点 3cc3013d5a
当前提交 70f4d729f0
共修改 9 个文件,包含 695 行新增和 132 行删除
+47
查看文件
@@ -92,6 +92,19 @@ const DEFAULT_WORKFLOW_DEFINITION = {
],
};
const DEFAULT_LEAVE_WORKFLOW_DEFINITION = {
steps: [
{
id: "leave_approval_manager",
name: "部门审批",
type: "approval",
assignee_rule: {
type: "department_manager",
},
},
],
};
async function seedExpenseTypes(prisma) {
const now = new Date();
const allTypes = [
@@ -198,6 +211,38 @@ async function seedWorkflowDefinition(prisma) {
created_by: null,
},
});
await prisma.workflowDefinition.updateMany({
where: {
entity_type: "leave",
},
data: {
is_active: false,
},
});
await prisma.workflowDefinition.upsert({
where: {
entity_type_version: {
entity_type: "leave",
version: 1,
},
},
update: {
name: "请假审批流程(MVP)",
definition_json: DEFAULT_LEAVE_WORKFLOW_DEFINITION,
is_active: true,
created_by: null,
},
create: {
name: "请假审批流程(MVP)",
entity_type: "leave",
definition_json: DEFAULT_LEAVE_WORKFLOW_DEFINITION,
version: 1,
is_active: true,
created_by: null,
},
});
}
async function main() {
@@ -220,6 +265,8 @@ async function main() {
console.log("- document sequence: reimbursement(reset_period=none)");
// eslint-disable-next-line no-console
console.log("- workflow definition: reimbursement v1 (1-step role=ceo)");
// eslint-disable-next-line no-console
console.log("- workflow definition: leave v1 (1-step department_manager)");
} finally {
await prisma.$disconnect();
await pool.end();