690414:1113 Update README.md /.agents/skills, /.windsurf/workflows
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
// lib/i18n/index.ts
|
||||
// ADR-021 Phase 7: Minimal i18n utility — Thai เป็น default locale
|
||||
// English ถูก reserve ไว้สำหรับอนาคต (05-08-i18n-guidelines.md)
|
||||
|
||||
import thMessages from '@/public/locales/th/common.json';
|
||||
import enMessages from '@/public/locales/en/common.json';
|
||||
|
||||
type Locale = 'th' | 'en';
|
||||
|
||||
const messages: Record<Locale, Record<string, string>> = {
|
||||
th: thMessages as Record<string, string>,
|
||||
en: enMessages as Record<string, string>,
|
||||
};
|
||||
|
||||
// สร้าง translator function ตาม locale
|
||||
export function createT(locale: Locale = 'th') {
|
||||
const dict = messages[locale];
|
||||
return function t(key: string, params?: Record<string, string | number>): string {
|
||||
const text = dict[key] ?? key;
|
||||
if (!params) return text;
|
||||
// รองรับ template เช่น "ลบ {{filename}}" → "ลบ report.pdf"
|
||||
return text.replace(/\{\{(\w+)\}\}/g, (_, k: string) => String(params[k] ?? ''));
|
||||
};
|
||||
}
|
||||
|
||||
// Default translator (Thai) — ใช้ได้โดยตรงใน utility functions นอก component
|
||||
export const t = createT('th');
|
||||
@@ -43,6 +43,15 @@ export const transmittalService = {
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* Submit Transmittal to Workflow (EC-RFA-004 validation fires on backend)
|
||||
* POST /transmittals/:uuid/submit
|
||||
*/
|
||||
submit: async (uuid: string): Promise<{ instanceId: string; currentState: string }> => {
|
||||
const response = await apiClient.post(`/transmittals/${uuid}/submit`);
|
||||
return response.data?.data ?? response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* ลบเอกสาร (Soft Delete)
|
||||
*/
|
||||
|
||||
@@ -5,9 +5,10 @@ import {
|
||||
UpdateWorkflowDefinitionDto,
|
||||
EvaluateWorkflowDto,
|
||||
GetAvailableActionsDto,
|
||||
WorkflowTransitionWithAttachmentsDto,
|
||||
} from '@/types/dto/workflow-engine/workflow-engine.dto';
|
||||
|
||||
import { Workflow, WorkflowType } from '@/types/workflow';
|
||||
import { Workflow, WorkflowHistoryItem, WorkflowType } from '@/types/workflow';
|
||||
|
||||
interface WorkflowResponseShape {
|
||||
data?: unknown;
|
||||
@@ -185,4 +186,35 @@ export const workflowEngineService = {
|
||||
const response = await apiClient.delete(`/workflow-engine/definitions/${id}`);
|
||||
return response.data?.data || response.data;
|
||||
},
|
||||
|
||||
// --- ADR-021: Workflow Transition + History ---
|
||||
|
||||
/**
|
||||
* ส่ง Action เพื่อเปลี่ยนสถานะ Workflow (พร้อมไฟล์แนบและ Idempotency-Key)
|
||||
* POST /workflow-engine/instances/:id/transition
|
||||
*/
|
||||
transition: async (
|
||||
instanceId: string,
|
||||
dto: WorkflowTransitionWithAttachmentsDto,
|
||||
idempotencyKey: string
|
||||
) => {
|
||||
const response = await apiClient.post(
|
||||
`/workflow-engine/instances/${instanceId}/transition`,
|
||||
dto,
|
||||
{ headers: { 'Idempotency-Key': idempotencyKey } }
|
||||
);
|
||||
return response.data?.data ?? response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* ดึงประวัติ Workflow พร้อมไฟล์แนบประจำ Step
|
||||
* GET /workflow-engine/instances/:id/history
|
||||
*/
|
||||
getHistory: async (instanceId: string): Promise<WorkflowHistoryItem[]> => {
|
||||
const response = await apiClient.get(
|
||||
`/workflow-engine/instances/${instanceId}/history`
|
||||
);
|
||||
const payload = response.data?.data ?? response.data;
|
||||
return Array.isArray(payload) ? (payload as WorkflowHistoryItem[]) : [];
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user