WELIFE Docs Swagger Admin Web

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)

  1. Catalog notif-catalog.ts — event → kind / sfx / channel / deepLink / SMS=false.
  2. dispatch + dispatchFanout — prefs, mute, inbox, Expo (priority, channelId, data.sfx).
  3. Prisma kinds: CALL_INCOMING · RIDE · ORDER · BOOKING · WALLET.
  4. 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.
  5. CON: data trên list, icon kind mới, «Mở chi tiết», tap Expo → openNotifDeepLink.
  6. 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.

4. Files

API

FE

Docs

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.