Giao diện
@digiforce-nc/plugin-notifications
Plugin thông báo cơ bản (deprecated) — hệ thống notification legacy. Khuyến nghị sử dụng plugin-notification-manager thay thế.
Plugin này làm gì?
Lưu ý: Plugin này đã deprecated. Các dự án mới nên dùng
@digiforce-nc/plugin-notification-manager— hệ thống thông báo thế hệ mới với multi-channel, template engine, và kiến trúc mở rộng tốt hơn.
plugin-notifications là hệ thống thông báo đời đầu của Digiforce. Nó cung cấp notification center cơ bản: gửi thông báo in-app, hiển thị bell icon với badge count, đánh dấu đã đọc/chưa đọc. Hệ thống này đã phục vụ tốt nhưng thiếu khả năng mở rộng multi-channel và template linh hoạt.
So sánh với plugin-notification-manager
| Tính năng | plugin-notifications (legacy) | plugin-notification-manager (mới) |
|---|---|---|
| In-app notification | Có | Có |
| Multi-channel (email, push, SMS) | Không | Có |
| Template engine | Cơ bản (lodash.template) | Nâng cao |
| Subscription preferences | Cơ bản | Nâng cao |
| Plugin channel mở rộng | Không | Có |
| Batch / digest | Không | Có |
Kiến trúc
Luồng gửi thông báo
Luồng đọc thông báo
API endpoints
| Endpoint | Mô tả |
|---|---|
notifications:list | Danh sách thông báo (phân trang, lọc read/unread) |
notifications:get | Chi tiết thông báo theo ID |
notifications:read | Đánh dấu 1 thông báo đã đọc |
notifications:readAll | Đánh dấu tất cả đã đọc |
notifications:destroy | Xóa thông báo |
notifications:count | Đếm số thông báo chưa đọc (cho badge) |
notifications:send | Gửi thông báo (internal API cho plugin khác gọi) |
Database
| Bảng | Mô tả | Ví dụ |
|---|---|---|
notifications | Thông báo (name, subject, body, receiver_options, service) | { name: 'n_xxx', subject: 'Task mới', body: '<p>Nội dung</p>' } |
notification_services | Cấu hình dịch vụ gửi — SMTP transport (type, title, options) | { type: 'email', title: 'SMTP chính', options: { host, port, auth } } |
notification_logs | Nhật ký gửi thông báo (receiver, state, response) | { receiver: 'user@example.com', state: 'success' } |
Thành phần client
| Thành phần | Mô tả |
|---|---|
PluginNotificationClient | Plugin client — hiện tại chỉ đăng ký plugin, chưa có UI riêng |
Dependencies
| Package | Vai trò |
|---|---|
nodemailer | Thư viện gửi email qua SMTP |
@digiforce-nc/server | Server framework (peer) |
@digiforce-nc/database | Database ORM (peer) |
@digiforce-nc/client | Client UI framework (peer) |