ปรับปรุง phase 6 ให้ครบถ้วน

This commit is contained in:
Suphonchai Phoonsawat 2026-08-20 11:15:04 +07:00
parent 93570d38d8
commit a196b8f9a8
14 changed files with 747 additions and 40 deletions

View file

@ -54,3 +54,48 @@ export interface GenerateDocumentResponse {
/** path สัมพัทธ์ของ backend — เติม apiBaseUrl ตอนเรียก */
downloadUrl: string
}
/** item ของ GET /api/templates/{templateId}/documents (FR-12) */
export interface TemplateDocumentListItem {
documentId: string
fileName: string
createdAt: string
versionCount: number
latestVersionNumber: number
latestVersionAt: string | null
}
/** field หนึ่งตัวของ document (FR-12) — label/type null = มีค่าแต่ key ไม่มีในนิยาม template ปัจจุบัน
* sourceVersionId/updatedByUserId/updatedAt null = field เพิ่มเข้า template หลังเอกสารนี้ถูกสร้าง */
export interface DocumentFieldItem {
key: string
label: string | null
type: string | null
isRequired: boolean | null
value: string
sourceVersionId: string | null
updatedByUserId: string | null
updatedAt: string | null
}
/** response ของ GET /api/documents/{documentId} (FR-12) */
export interface DocumentDetail {
id: string
fileName: string
createdAt: string
templateId: string | null
templateName: string | null
templateIsActive: boolean
fields: DocumentFieldItem[]
}
/** item ของ GET /api/documents/{documentId}/versions — fields คือ snapshot ที่ parse แล้ว
* (2 รูปแบบ — ผ่าน normalizeSnapshot ก่อนใช้) */
export interface VersionListItem {
versionId: string
versionNumber: number
createdAt: string
createdByUserId: string
contentHash: string
fields: unknown
}