phase 6 เบื้องต้น
This commit is contained in:
parent
1bb850c6b8
commit
93570d38d8
20 changed files with 1715 additions and 34 deletions
56
web/app/types/api.ts
Normal file
56
web/app/types/api.ts
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
/** DTO ตรงกับ JSON ที่ backend คืน (camelCase — ดู Controllers/*.cs + *Dtos.cs) */
|
||||
|
||||
export type FieldType = 'text' | 'number' | 'date'
|
||||
|
||||
export interface TemplateFieldDto {
|
||||
id: string
|
||||
/** = SDT tag ในไฟล์ template — ใช้เป็น key ของ values ตอน generate */
|
||||
key: string
|
||||
label: string
|
||||
type: FieldType | string
|
||||
isRequired: boolean
|
||||
sortOrder: number
|
||||
}
|
||||
|
||||
export interface TemplateListItem {
|
||||
id: string
|
||||
name: string
|
||||
description: string | null
|
||||
isActive: boolean
|
||||
fieldCount: number
|
||||
createdAt: string
|
||||
updatedAt: string
|
||||
}
|
||||
|
||||
export interface TemplateDetail {
|
||||
id: string
|
||||
name: string
|
||||
description: string | null
|
||||
isActive: boolean
|
||||
createdAt: string
|
||||
updatedAt: string
|
||||
fields: TemplateFieldDto[]
|
||||
}
|
||||
|
||||
/** response ของ POST /api/templates — fields ที่ detect อัตโนมัติพร้อมค่า default */
|
||||
export interface CreateTemplateResponse {
|
||||
id: string
|
||||
fields: TemplateFieldDto[]
|
||||
}
|
||||
|
||||
/** response ของ PUT /api/templates/{id}/file */
|
||||
export interface ReplaceTemplateFileResponse {
|
||||
id: string
|
||||
fields: TemplateFieldDto[]
|
||||
addedTags: string[]
|
||||
removedTags: string[]
|
||||
}
|
||||
|
||||
/** response ของ POST /api/documents/generate (FR-10) */
|
||||
export interface GenerateDocumentResponse {
|
||||
documentId: string
|
||||
versionId: string
|
||||
versionNumber: number
|
||||
/** path สัมพัทธ์ของ backend — เติม apiBaseUrl ตอนเรียก */
|
||||
downloadUrl: string
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue