690417:1538 Refactor Work flow ADR-021

This commit is contained in:
2026-04-17 15:38:20 +07:00
parent 6d45bdaeb5
commit 3a5fc8d4af
23 changed files with 892 additions and 135 deletions
@@ -17,7 +17,7 @@ import { WorkflowTransitionDto } from '../workflow-engine/dto/workflow-transitio
@Injectable()
export class CirculationWorkflowService {
private readonly logger = new Logger(CirculationWorkflowService.name);
private readonly WORKFLOW_CODE = 'CIRCULATION_INTERNAL_V1';
private readonly WORKFLOW_CODE = 'CIRCULATION_FLOW_V1';
constructor(
private readonly workflowEngine: WorkflowEngineService,
@@ -48,8 +48,9 @@ export class CirculationWorkflowService {
);
}
// Context อาจประกอบด้วย Department หรือ Priority
const context = {
// Context — Circulation เป็น internal document ระดับ Organization (ไม่ผูก contract)
// Guard Level 2 ตรวจ organizationId; Level 2.5 (contract check) จะ skip เมื่อ contractId = null
const context: Record<string, unknown> = {
organizationId: circulation.organization,
creatorId: userId,
};