Appearance
Config And Template Surface — Business Rules
Tổng quan
Domain này gom phần notification mà IT/ops nhìn thấy như một bề mặt cấu hình:
- notification admin list/create/detail
- notification template
- email request + email template
- phần template SMS/ZNS và trigger config đang sống trong DB/service notification nhưng ownership UI lại rơi nhiều về
settings
Điểm quan trọng là notification trong FE hiện không chỉ là nơi "cấu hình template". Nó đang là một admin surface pha trộn giữa:
- cấu hình nội dung/thông điệp,
- chọn audience,
- lên lịch gửi,
- xem lại lịch sử request đã tạo.
Scope nghiệp vụ
| Nhóm | Vai trò | Surface chính |
|---|---|---|
| Notification requests | Tạo và quản lý notification in-app/push dạng general | Notifications, NotificationCreate, NotificationDetail |
| Notification templates | Quản trị template push/in-app theo trigger_code | notification_template, notification_trigger_conditions |
| Email requests | Tạo/lưu request email và đọc lịch sử gửi | email_request, sendEmails |
| Email templates | Quản trị subject/body/html theo locale | email_template |
| SMS/ZNS template config | Quản trị template SMS, ZNS, trigger condition | sms_template, zns_template, zns_config, zns_oa_list |
Luồng chính
text
IT/ops mở admin notification surface
-> tạo notification hoặc chỉnh sửa notification đã có
-> nhập headings / contents / message payload / icon / target
-> chọn audience theo topic, user_ids hoặc filter
-> chọn send_after
-> submit
-> backend action save request vào DB hoặc gửi ngay tùy path
IT/ops quản lý template
-> CRUD notification/email template
-> mapping trigger_code -> nội dung template
-> runtime service load template để apply variables khi gửiQuy tắc nghiệp vụ
| Mã | Quy tắc |
|---|---|
| BR-NCF-001 | FE admin surface của notification chỉ mở cho ITLeader, ITStaff; người dùng business thường chỉ chạm runtime result chứ không vào route quản trị. |
| BR-NCF-002 | Một notification admin hợp lệ phải có ít nhất một trong các cơ chế target: broadcast, user_ids, hoặc topics. |
| BR-NCF-003 | FE đang cho phép hai kiểu body chính: message hoặc url; nếu là url thì metadata chỉ giữ deep-link thay vì rich text message. |
| BR-NCF-004 | FE luôn ép locale mặc định phải có headings và contents, rồi tự fill locale còn thiếu từ locale mặc định. |
| BR-NCF-005 | Nếu người dùng chọn "all" trong recipient picker, FE sẽ expand ra toàn bộ account.id theo filter hiện tại thay vì lưu literal "all". |
| BR-NCF-006 | notification_template là template family cho push/in-app; email_template, sms_template, zns_template là các family riêng, không phải cùng một bảng. |
| BR-NCF-007 | Template runtime gắn với trigger qua trigger_code; đây là điểm nối giữa domain notification với ecommerce/hrm/project/wallet. |
| BR-NCF-008 | sendEmails và sendSMS đều có hai mode: Save = true để lưu request vào DB, Save = false để gửi ngay. |
| BR-NCF-009 | Khi request email/SMS dùng template, backend sẽ load nội dung từ template rồi apply variables dạng {\{.key}\} trước khi gửi. |
| BR-NCF-010 | scheduleTask của nhánh notification-v2-api là primitive chung để persist future task vào scheduled_tasks, không chỉ dành riêng cho ZNS. |
Boundary
| Boundary | Ghi chú |
|---|---|
settings | SMS/ZNS/notification template management trong thực tế bị split ownership với settings |
user | Audience chọn theo account, role, branch, department, customer group/source |
cms | Campaign/event/voucher có thể bơm trigger code sang notification template |
ecommerce / wallet / hrm / projects | Nhiều trigger code thực chất đến từ domain khác, notification chỉ giữ template và delivery |
Rủi ro / Findings
| Mức | Finding |
|---|---|
| P1 | FE khai báo đủ route cho notification template, email, email template, nhưng nhiều page hiện vẫn là placeholder return <div></div>. |
| P1 | navigation của module đang bị comment toàn bộ, nên admin surface tồn tại theo route nhưng không chắc hiện trên sidebar. |
| P1 | FE đang mô tả semantics "lên lịch" rất rõ, nhưng implementation path phía backend không khớp hoàn toàn với cảm nhận này. |
| P2 | Ownership template bị tách giữa notification và settings, nên BA/dev rất dễ đọc nhầm chỗ cấu hình với chỗ runtime. |