690414:1113 Update README.md /.agents/skills, /.windsurf/workflows

This commit is contained in:
2026-04-14 11:13:42 +07:00
parent 02400fd88c
commit 6d45bdaeb5
194 changed files with 12708 additions and 8762 deletions
+24
View File
@@ -0,0 +1,24 @@
// ADR-021: Hook สำหรับดึงประวัติ Workflow พร้อมไฟล์แนบประจำ Step (US2)
import { useQuery } from '@tanstack/react-query';
import { workflowEngineService } from '@/lib/services/workflow-engine.service';
import type { WorkflowHistoryItem } from '@/types/workflow';
export const workflowHistoryKeys = {
all: ['workflow-history'] as const,
instance: (instanceId: string) =>
[...workflowHistoryKeys.all, instanceId] as const,
};
/**
* ดึงประวัติการเดินเรื่องของ Workflow Instance
* disabled อัตโนมัติถ้า instanceId ไม่มีค่า
*/
export function useWorkflowHistory(instanceId: string | undefined) {
return useQuery<WorkflowHistoryItem[]>({
queryKey: workflowHistoryKeys.instance(instanceId ?? ''),
queryFn: () => workflowEngineService.getHistory(instanceId!),
enabled: !!instanceId,
staleTime: 60_000, // 1 นาที — ประวัติไม่เปลี่ยนบ่อย
retry: false, // ถ้า 404 (endpoint ยังไม่มี) ไม่ต้อง retry
});
}