路由表化:迁移订单及订单修改/归属/作废/售后审批路由

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
黄健铭andClaude Opus 5.5 committed 2026-12-04 12:29:25 -08:00
1 parent 900fc2f527
commit babb914c59
5 files changed
+219 -116

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
'use strict';
// 审批类资源的三条标准路由:申请列表、单条详情、approve/reject 审批(写入事务内)。
function reviewRoutes(base, { list, one, approve, reject }) {
return [
{ method: 'GET', path: base, handler: ({ ledger, query, actor }) => ledger[list](query, actor) },
{
method: 'GET',
path: base + '/:id(uuid)',
handler: ({ ledger, params: { id }, actor }) => ledger[one](id, actor),
},
{
method: 'POST',
path: base + '/:id(uuid)/:decision(approve|reject)',
write: true,
handler: ({ ledger, params: { id, decision }, body, actor }) =>
ledger[decision === 'approve' ? approve : reject](id, body, actor),
},
];
}
module.exports = { reviewRoutes };