Appearance
Customer Workspace — Business Rules
Tổng quan
Domain này là customer workspace thật của user module. Nó không chỉ là danh sách khách hàng, mà là một shell hồ sơ khách hàng tổng hợp, kéo dữ liệu từ nhiều module khác nhau.
Scope nghiệp vụ
| Nhóm | Vai trò | Ví dụ surface |
|---|---|---|
| Customer list | Tìm kiếm, lọc, phân trang khách hàng | Customers.tsx, CustomerTable |
| Customer create / edit | Tạo hoặc cập nhật hồ sơ khách | CustomerCreate.tsx |
| Customer detail shell | Workspace chính của một khách hàng | CustomerDetail.tsx |
| Customer detail tabs | Note, contact book, appointment, activity, reward, ticket, call history, task, order, record, payment, SMS, collaborator, complaint | nested routes dưới ROUTE_CUSTOMER_DETAIL |
Luồng chính
text
Customer list
-> filter / search / export
-> mở customer detail
-> workspace shell hiển thị profile + wallet stats + cumulative stats
-> đổi tab sang note / order / payment / ticket / collaborator / complaint
-> nhiều tab reuse component từ crm / ecommerce / wallet / affiliateQuy tắc nghiệp vụ
| Mã | Quy tắc |
|---|---|
| BR-UCW-001 | CustomerDetail là shell tổng hợp; customer_id được dùng chung cho toàn bộ tab con. |
| BR-UCW-002 | Route detail mặc định redirect về tab note. |
| BR-UCW-003 | Customer workspace không tự sở hữu toàn bộ business logic; nó chủ yếu là lớp hợp nhất read/write surface từ module khác. |
| BR-UCW-004 | Collaborator flows của khách hàng được mount trực tiếp trong user detail nhưng thực chất reuse pages/components từ module affiliate. |
| BR-UCW-005 | Khi chạy ở CRM platform, navigation customer đổi path sang /crm/customer, nhưng ownership code vẫn nằm trong module user. |
| BR-UCW-006 | Customer workspace không phải read-only thuần; create/update customer, note/contact book, ticket status và một số thao tác affiliate đều có write path ngay trong shell này. |
Boundary
| Boundary | Ghi chú |
|---|---|
crm | Customer visit, ticket manager, call history, một phần route constants |
ecommerce | Appointment, order history, record, treatment images |
wallet | Wallet stats, payment/refund histories |
affiliate | Collaborator order/payment/withdraw flows |
Rủi ro / Findings
| Mức | Finding |
|---|---|
| P1 | Customer workspace bị coupling rất mạnh với crm, ecommerce, wallet, affiliate; đổi route/tab dễ gây vỡ liên module. |
| P1 | Navigation customer thay đổi theo platform (admin/pos vs crm), nên trace route thực tế không chỉ nhìn user/module.ts. |
| P2 | CustomerCreate.tsx đang import route constants từ crm/types, cho thấy boundary UI bị trộn ngay từ create flow. |
| P2 | Complaint tab không query từ module complaint mà dùng query/report layer, nên ownership dữ liệu ở nhánh này khá mờ. |