forked from ChaiHao/BPOS-MVP
三面拆分⑥:触发器 upsert 路由 —— 定义面的 HTTP 口(启停仍走 toggle)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KeDBx2PHLavbURXB8LJJ7m
This commit is contained in:
@@ -29,6 +29,7 @@ import {
|
||||
staffIdSchema,
|
||||
taskIdSchema,
|
||||
toggleTriggerRoute,
|
||||
upsertTriggerRoute,
|
||||
validateProcessRoute,
|
||||
} from '@contracts';
|
||||
import { NotPublishableError } from '@modules/process';
|
||||
@@ -331,6 +332,21 @@ export function registerGovernanceOpsRoutes(app: Hono<AppEnv>, container: Contai
|
||||
return c.json({ ok: true });
|
||||
});
|
||||
|
||||
/**
|
||||
* 调起规则的定义面(设计中心)—— 新建 / 改规则 / 改起单装配。
|
||||
* 启停不走这里(那是运营的事,见 toggle);改定义同样不动任何流程包版本。
|
||||
*/
|
||||
app.put(upsertTriggerRoute.path, async (c) => {
|
||||
const denied = await governTrigger(c.get('account'));
|
||||
if (denied) return c.json(denied, denyStatus(denied));
|
||||
const parsed = upsertTriggerRoute.body.safeParse(await c.req.json());
|
||||
if (!parsed.success) {
|
||||
const body: ApiError = { code: 'validation-failed', message: '触发器不合 schema', detail: parsed.error.issues };
|
||||
return c.json(body, 400);
|
||||
}
|
||||
return c.json({ trigger: await container.trigger.upsert(parsed.data.trigger) });
|
||||
});
|
||||
|
||||
/* ── 活动库管理:两维分类 × 两条版本序列 ─────────────────────────── */
|
||||
|
||||
app.get(listActivitiesRoute.path, async (c) => {
|
||||
|
||||
Reference in New Issue
Block a user