Skip to content

Notification - Technical Map

Auto-generated bởi codebase-doc-generator ngày 2026-03-23 (verified từ code thực). Không chỉnh sửa thủ công.

Routes

RoutePathMục đích
ROUTE_NOTIFICATION/n/notificationDanh sách notification
ROUTE_NOTIFICATION_CREATE/n/notification/createTạo notification
ROUTE_NOTIFICATION_DETAIL/n/notification/:idXem chi tiết notification
ROUTE_NOTIFICATION_UPDATE/n/notification/:id/editChỉnh sửa notification
ROUTE_NOTIFICATION_UPDATE_IN_DETAIL/n/notification/:id/update-in-detailChỉnh sửa khi đang ở detail
ROUTE_NOTIFICATION_TEMPLATE/n/notification-templateDanh sách template notification
ROUTE_NOTIFICATION_TEMPLATE_CREATE/n/notification-template/createTạo template notification
ROUTE_NOTIFICATION_TEMPLATE_DETAIL/n/notification-template/:idChi tiết template notification
ROUTE_EMAIL/n/emailDanh sách email
ROUTE_EMAIL_CREATE/n/email/createTạo email
ROUTE_EMAIL_DETAIL/n/email/:idChi tiết email
ROUTE_EMAIL_TEMPLATE/n/email-templateDanh sách email template
ROUTE_EMAIL_TEMPLATE_CREATE/n/email-template/createTạo email template
ROUTE_EMAIL_TEMPLATE_DETAIL/n/email-template/:idChi tiết email template
ItemGiá trị
MODULE_NOTIFICATIONn
Shared moderator permissionsITLeader, ITStaff
Shared moduleIdnotification
Navigation statusĐã khai báo nhưng toàn bộ block navigation đang bị comment

FE Pages (12)

Có logic thật

PageFileVai trò
Notificationspages/Notifications.tsxRender NotificationTable hoặc RouterView detail
NotificationCreatepages/NotificationCreate.tsxWrapper cho form tạo/sửa
NotificationDetailpages/NotificationDetail.tsxCard detail, preview recipient, delete/edit

Placeholder / scaffold

PageFileTrạng thái
NotificationTemplatespages/NotificationTemplates.tsxPlaceholder
NotificationTemplateCreatepages/NotificationTemplateCreate.tsxPlaceholder
NotificationTemplateDetailpages/NotificationTemplateDetail.tsxPlaceholder
Emailspages/Emails.tsxPlaceholder
EmailCreatepages/EmailCreate.tsxPlaceholder
EmailDetailpages/EmailDetail.tsxPlaceholder
EmailTemplatespages/EmailTemplates.tsxPlaceholder
EmailTemplateCreatepages/EmailTemplateCreate.tsxPlaceholder
EmailTemplateDetailpages/EmailTemplateDetail.tsxPlaceholder

FE Components (10)

ComponentVai trò
NotificationTableBảng danh sách notification quản trị
NotificationCreateComponent submit create/update notification
NotificationFormForm lõi cho targeting, content, schedule
NotificationStatusBadge trạng thái gửi
NotificationButtonIcon chuông + badge unread + mở drawer
NotificationListInbox cá nhân với paging và mark-read
NotificationListenerRuntime listener cho push/message
NotificationTypeSelectChọn loại notification
FilteredTargetSelectionChọn đối tượng theo filter
FilteredTargetTablePreview danh sách recipient theo filter

GraphQL Operations

File: diva-admin/src/modules/notification/graphql/notification.graphql

Personal inbox

OperationMục đích
GetMyNotificationsLấy notification cá nhân
WatchUnreadNotificationsAggregateSubscription unread stats
GetUnreadNotificationsAggregateQuery unread stats
GetUnreadNotificationIDsLấy list unread ids để mark-all-read
UpsertNotificationUsersMark read/delete trên bảng notification_user

Admin notification

OperationMục đích
GetNotificationsQuery thẳng bảng notification
GetNotificationPaginationsQuery qua notification_filter view
GetNotificationByPkLấy detail notification
SendNotificationsGọi action sendNotifications
UpdateNotificationStatusBật/tắt visible theo subject_id
UpdateNotificationUpdate notification by pk
DeleteNotificationByPkXóa notification
GetNotificationMasterDataLấy master data notification
GetListIdByFilterLấy list recipient ids theo filter

FE Runtime logic

NotificationForm.tsx

LogicGhi chú
Locale dictionariesDùng createDictionaryLocales() để build headings, contents, message_content đa ngôn ngữ
Content typemessage hoặc url
Targetingbroadcast, topics, user_ids, filter_value
ValidationChặn nếu thiếu content/url hoặc thiếu heading/content ở locale mặc định
Send timesend_after convert bằng createDate(..., "DD/MM/YYYY HH:mm")
Message cleanupStrip HTML trước khi submit

NotificationDetail.tsx

LogicGhi chú
Detail sourceGetNotificationByPk(id)
Filter rehydrateDựng lại customer/employee filter từ notification.data
Target previewGọi GetListIdByFilter để intersect với modelValue.user_ids
Sent stateisSent nếu send_after <= now
DeleteDeleteNotificationByPk rồi redirect về list

NotificationButton.tsx

LogicGhi chú
Count cacheDùng Pinia store + localStorage
Reload throttlingKhông query lại nếu lần request trước < 60 giây
DrawerMở QDialog bên phải, render NotificationList

NotificationList.tsx

LogicGhi chú
Personal feedQuery notification_personal(args)
Read oneUpsert notification_user(read = true)
Read allLấy unread ids rồi bulk upsert
Show all / unread onlyĐiều khiển bằng _read trong args
RoutingResolve route từ subject_type thông qua NOTIFICATION_TYPE

NotificationListener.tsx

LogicGhi chú
Subscription sourceuseNotification().onMessage()
Runtime effectHiện Quasar notify popup khi có push hiển thị
GuardChỉ subscribe khi globalStore.account.id tồn tại

useOneSignal.ts

LogicGhi chú
InitoneSignal.init({ appId: Config.oneSignalAppId })
Auto registerNếu chưa bật push thì registerForPushNotifications()
User bindingsetExternalUserId(userId)
EventLắng nghe notificationDisplay
Tag APIsHỗ trợ sendTags, getTags, deleteTags

Backend Services

ServiceVai trò
notification-apiGửi push, email, SMS; scheduler gửi pending notification
notification-v2-apiZNS, scheduled tasks, integrations khác
controllerCRUD tables/functions của notification DB

Backend Actions / Schedulers

notification-api

Action/SchedulerVai trò
sendNotificationsGửi ad-hoc hoặc persist notification
sendEmailsLấy template email, apply vars, save hoặc send-now
sendSMSLấy template SMS, apply vars, save hoặc send-now
notification_sendScheduler quét notification pending và gửi
notification_cleanupCleanup notification cũ/pending theo scheduler riêng

notification-v2-api

Action/EventVai trò
scheduleTaskPersist scheduled_tasks và nạp vào scheduler runtime
zns_request_insertGửi ZNS ngay hoặc schedule sau
scheduled_task_insert / scheduled_task_updateĐồng bộ runtime scheduler

Messenger model

NotificationInput

FieldÝ nghĩa
TemplateIDTemplate notification sử dụng
BroadcastGửi toàn hệ thống
Headings, Contents, ContentsHTMLNội dung đa ngôn ngữ
SubjectType, SubjectIDGắn context điều hướng
Topics, UserIDsNhóm người nhận
SendAfterThời điểm gửi
DataPayload phụ trợ
MetadataURL, icon, buttons, image, badge, subtitle...

NotificationMetadata

Field nhómVai trò
Deep link / mediaURL, ImageURL, SmallIcon, LargeIcon
GroupingGroupID, GroupMessage, CollapseID
DeliveryTTL, Priority, DelayedOption, DeliveryTimeOfDay
Platform overridesIOS*, Android*, Huawei*, APNSPushTypeOverride
ButtonsAction buttons cho notification

Store / Data model

Notification domain

ObjectVai trò
notificationBản ghi notification gốc
notification_userTrạng thái đọc/xóa theo user
notification_templateTemplate push/in-app
notification_filterView/filter cho admin list
notification_personalFunction/view cho inbox cá nhân
notification_personal_statsAggregate unread/read stats

Email / SMS / ZNS

ObjectVai trò
email_requestHàng đợi/lịch sử email
email_templateTemplate email
sms_requestHàng đợi/lịch sử SMS
sms_templateTemplate SMS
zns_requestHàng đợi/lịch sử ZNS
zns_templateTemplate ZNS
notification_queueQueue metadata-driven cho SMS/ZNS
scheduled_tasksTác vụ gửi deferred trong v2
NhómVí dụ trigger code
Requests / HRnoti_request_working_schedule_pending, noti_late_arrival, noti_leave_early_employee
Appointments / ordersnoti_appointment_reminder, noti_order_confirm, noti_order_complete
KPI / task / projectnoti_staff_kpi_assign, noti_task_updated, noti_project_task_comment_new
Commission / walletnoti_commission_received_customer, noti_wallet_deposit_success
Eventsnoti_birthday_user, noti_birthday_customer, noti_voucher_activated_print

Rủi ro / Findings kỹ thuật

#Note
1Nhiều page quản trị email/template và notification template hiện vẫn là stub FE dù route đã khai báo đầy đủ.
2navigation của module đang bị comment, nên khả năng cao module không có menu sidebar mặc định.
3Admin notification và personal notification dùng hai bề mặt đọc khác nhau: bảng/view quản trị vs function notification_personal.
4Backend notification đang chia đôi giữa notification-apinotification-v2-api, với ZNS/scheduled task đi theo nhánh v2.