WP-NOTIF-HUB-01 — Audit + hub thông báo booking / ride / chat / call / push
Domain: D-NOTIF · Surfaces: CON · PAR · DRV · ADM · API Status: IMP · Date: 2026-08-17 Nguồn chân lý sơ đồ/ma trận: architecture/NOTIFICATION-SYSTEM.md
1. Verdict trước hub
Ma trận cũ ghi D-NOTIF IMP (8 ops + Expo push) và PAR «order push» / DRV «trip push». Audit code:
| Lớp | Hiện trạng cũ | Gap |
|---|---|---|
| Inbox + Expo | Có createAndPush |
Chỉ chat / call / admin / device |
| Chat | Push + WS message:new |
Không tôn trọng muted |
| Call đến | Push kind SYSTEM | Lẫn với broadcast |
| Call nhỡ | CALL_MISSED |
OK |
| Social | Chỉ inbox Prisma | Không push |
| Ride | Chỉ WS ride:status / GPS |
Không inbox, không push CON/DRV |
| Hotel / park / rent / med / school / homesvc | Persist booking | Không thông báo |
| FNB/grocery order | Persist order | Không thông báo CON/PAR |
| Rental cọc | Ví escrow | Không thông báo 2 bên |
Prefs notificationsEnabled |
Settings persist | Không đọc lúc gửi push |
| FE list | Title/body | Thiếu data → không deep-link |
| FE tap push | — | Không listener |
| DRV / PAR token | — | Không đăng ký Expo |
| SMS | eSMS OTP | Đúng — không dùng cho booking |
2. Đã làm (hub)
- Catalog
notif-catalog.ts— event → kind / sfx / channel / deepLink / SMS=false. dispatch+dispatchFanout— prefs, mute, inbox, Expo (priority,channelId,data.sfx).- Prisma kinds:
CALL_INCOMING·RIDE·ORDER·BOOKING·WALLET. - Wire: hotel, parking, rental viewing+deposit, medical, school, homeservice, orders, merchant accept, ride match/cancel, driver accept/pickup/complete/cancel, chat (mute + CALL_INCOMING), social push, new-device.
- CON:
datatrên list, icon kind mới, «Mở chi tiết», tap Expo →openNotifDeepLink. - DRV + PAR: đăng ký push token sau login.
3. Phân luồng hiệu quả (đã chốt)
Xem sơ đồ §3–4 trong architecture doc.
- Call: WS chuông + push high (không bị prefs/mute chặn) — khác chat.
- Chat: WS luôn; push chỉ khi không mute và prefs on.
- Ride live GPS: không inbox/push (tránh 1 ping / 2–3s).
- Ride status / booking / order: inbox + push (prefs) + WS nếu có room.
- SMS: chỉ OTP. Booking không blast SMS.
4. Files
API
api/src/modules/notifications/notif-catalog.ts+.spec.tsapi/src/modules/notifications/notifications.service.tsapi/prisma/schema.prisma+migrations/20260817140000_notif_kind_hub/- Wire: hotels · parking · rentals · medical · schools · homeservices · orders · merchants · rides · driver · chat · social · auth-session
FE
mobile/src/features/notifications/notifDeepLink.ts+ testNotificationsScreen·NotificationDetailScreen·RootNavigator·api.tstypesdriver/src/services/push.ts·partner/src/services/push.ts
Docs
docs/architecture/NOTIFICATION-SYSTEM.md- Report này
5. Verify
cd api && npx prisma generate
npx jest src/modules/notifications/notif-catalog.spec.ts --runInBand
CON: npx jest src/features/notifications/notifDeepLink.test.ts
Local: migrate 20260817140000_notif_kind_hub rồi đặt phòng / đặt xe / gửi tin — inbox + (dev build) push.
6. Next
Presence suppress · Android channels · bundle SFX · prefs theo kênh · iOS VoIP — listed in architecture §9.