Files
alla-allaos-fullstack/docs/implementation/technical-debt.md
phaichayon edee45375e task-h
2026-06-16 13:42:38 +07:00

4.7 KiB

Technical Debt

After Task D

1. Database FK

Customer / Contact / Enquiry ยัง enforce relationship ด้วย application logic

Future:

  • เพิ่ม FK หลัง schema stable

2. Date Input

Form ยังใช้ text input แบบ YYYY-MM-DD

Future:

  • เปลี่ยนเป็น Date Picker กลางของระบบ

หน้า customer detail แสดง related enquiries แล้ว แต่ยังไม่มี pagination

Future:

  • เพิ่มเมื่อข้อมูลเริ่มเยอะ

4. Follow-up Activity

Activity timeline ยังพึ่ง audit payload

Future:

  • ทำ combined activity view/service

After Task E

5. Mixed Tax Rollup

Quotation item รองรับ taxRate ต่อรายการแล้ว

Current:

  • quotation summary ยังใช้ header tax calculation

Future:

  • รองรับ mixed tax per line
  • aggregate tax จาก item จริง

Priority:

  • Medium

6. Attachment Storage

Attachment ยังเป็น metadata-only

Current:

  • เก็บเฉพาะ metadata

Future:

  • storage provider abstraction
  • upload service
  • download endpoint
  • permission check

Priority:

  • High

7. Revision Snapshot

Revision copy:

  • header
  • items
  • customers
  • topics

Current:

  • ไม่ copy follow-ups
  • ไม่ copy attachments

Future:

  • กำหนด revision snapshot strategy ให้ชัดเจน

Priority:

  • Medium

8. CRM Foreign Keys

Customer Contact Enquiry Quotation

Current:

  • ใช้ organization validation ใน application layer

Future:

  • เพิ่ม FK เมื่อ schema stable
  • review cascade strategy

Priority:

  • High

9. Approval Workflow Pending

Quotation stabilization in Task E.1 only prepares:

  • approval-ready statuses
  • revision guard
  • placeholder submit-for-approval action

Current:

  • no approval table
  • no approval requester/approver history
  • no multi-step approval rule
  • no approval notification

Future:

  • introduce approval aggregate in Task F
  • separate workflow state from quotation commercial state where needed
  • define approver resolution by branch / amount / role

Priority:

  • High

After Task F

Approval Permission Sync

Existing memberships may not automatically receive new approval permissions.

Future:

  • add permission sync script
  • admin UI for role/permission management

Approval Workflow Config UI

Approval workflow is seeded but not configurable from UI.

Future:

  • workflow setup screen
  • step editor
  • approver role mapping

Approval Notification

Approval workflow has no email/line notification yet.

Future:

  • notification queue
  • approval reminder

After Task G

Document Mapping Editor

Template mappings are seeded and readable, but not yet manageable from UI.

Future:

  • mapping CRUD UI
  • table column editor
  • publish/draft template workflow

pdfme Render Parity

Document preview is application-native, not pixel-perfect pdfme rendering.

Future:

  • server-side pdfme render pipeline
  • preview image generation
  • schema validation against live template versions

Approved PDF Persistence

Approved snapshot preparation exists, but no binary file generation or storage write-back yet.

Future:

  • approved PDF generator
  • storage abstraction
  • immutable approved artifact URL on quotation

After Task H

Font Render Parity

pdfme generation currently falls back from cordia/cordiaBold to standard fonts when TTC-backed runtime rendering is not reliable.

Future:

  • package or vendor the exact Cordia font assets in a generator-friendly format
  • remove fallback normalization
  • verify Thai text metrics against the original designer output

Local PDF Storage

Approved PDFs currently persist to local public/generated/... paths.

Future:

  • object storage provider abstraction
  • signed/private delivery strategy
  • retention and regeneration policy

Post-Approval Automation

Approved PDF generation is still manual by design.

Future:

  • optional auto-generate hook after final approval
  • retry-safe job queue for PDF generation

After Task G

Template Mapping Editor

Mapping CRUD UI ยังไม่มี
Future: ทำ mapping editor สำหรับ admin

Canvas-Accurate PDF Preview

Preview ปัจจุบันเป็น native app preview ไม่ใช่ pdfme canvas rendering
Future: เพิ่ม pdfme renderer preview

Product-Specific Template Rule

ตอนนี้ใช้ productType = default
Future: define rule สำหรับ crane/dockdoor/solarcell

PDF Binary Generation

ยังไม่มี generate/download/store PDF
Future: Task H