WELIFE Docs Swagger Admin Web

Full Screen · ERD · Mock/API Audit

Field Value
Date 2026-08-06
Domain TOOLING
WP WP-FULL-APP-AUDIT-01
Surfaces CON · PAR · DRV · ADM · API
Method Nav cross-check script · Prisma schema · api.ts · feature scan · existing audits

0. Verdict (1 phút)

Trục Kết luận
404 / broken route (CON) Literal names OK · 1 cross-stack đã sửa (WalletAction từ Map WalletHome)
ServiceStub Còn safety-net; catalog tiles đã map stack thật + auto-replace
Mock data FE 0 feature thuần MOCK · 26 LIVE · 9 HYBRID (chủ yếu PAYMENTS_MOCK) · 1 STATIC_UI (geo)
BE 86 Prisma models · 363 IMP / 0 STUB / 40 tags · smoke 103 PASS
Hướng đi Không mở vertical mới · harden P7 OWNER · sâu journey · live pay/SMS/Google

1. Sơ đồ màn hình (Consumer shell)

flowchart TB
  Boot[Boot / ready] --> AuthCheck{user JWT?}
  AuthCheck -->|no| AuthGate
  AuthCheck -->|yes| MainTabs
  AuthCheck -->|sessionExpired| SessionExpired

  AuthGate --> Splash --> Onboard --> Location --> Login
  Login --> Register
  Login --> Forgot
  Register --> VerifyEmail
  Login -->|success| MainTabs

  MainTabs --> MapTab
  MainTabs --> ReelsTab
  MainTabs --> SocialTab
  MainTabs --> ChatTab
  MainTabs --> AccountTab

  MapTab --> HomeMap
  HomeMap -->|service tile| navigateService
  navigateService -->|known id| VerticalStacks
  navigateService -->|unknown| ServiceStub
  ServiceStub -->|auto replace| VerticalStacks

  VerticalStacks --> Ride[FNB·Ride·Hotel·Rental·Park…]
  VerticalStacks --> P8[Charging·Transit·HomeSvc·Delivery·Bills·QR]
  VerticalStacks --> Platform[Places·Wallet·Routing·Assistant]

  AccountTab --> AccountHome
  AccountHome --> Wallet[Wallet·Pay]
  AccountHome --> Support[Support·KYC·2FA·Sessions]
  AccountHome --> Profile[Profile·Addr·Fav·Reviews]

Tabs & stacks

Tab Entry Stack size (approx) Ghi chú
MapTab HomeMap ~90 screens Toàn bộ vertical CON
ReelsTab ReelsHome 2 Social reels
SocialTab SocialHome 4 Feed · Friends · Profile
ChatTab ChatHome 3 Inbox · Thread · Call
AccountTab AccountHome ~30 Wallet duplicate + settings

Typed route keys: 129 · *Screen.tsx: ~125 unique (dup path Windows)

Auth flow (CON)

Splash → Onboarding → LocationPermission → Login | Register | Forgot | VerifyEmail → Main

Gate: AuthGate (phase machine, không phải React Navigation stack riêng).


2. Kiểm soát link / 404

Check Result
String navigation.navigate('X') vs registered Stack.Screen / typed params 100/100 OK · 0 missing
Home / AllServices catalog → navigateService Tất cả id trong catalogIdsWithRealStack() có stack
ServiceStub Fallback UI + replace sang stack thật nếu tìm thấy catalog item
Unknown route / NotFound screen IMP WP-NAV-CI-01 — Root NotFound + onUnhandledAction
Deep link welife:// PARTIAL — scheme có; chưa matrix đầy đủ
Wallet screens Đăng ký kép MapStack + AccountStack (+ WalletAction trên Map sau fix)

Cross-stack (audit nav · fix WP-FE-WALLET-MAP-NAV-01):

Issue Trước Sau
Map WalletHome → WalletAction Chỉ AccountStack → runtime fail WalletAction trên MapStack
Map Wallet → Support / Promotions Account-only openAccountFromWallet → AccountTab
MedicalChat Thread local MOCK IMP WP-FE-MED-CHAT-01 → ChatApi + WS
Assistant Không inbound navigate Orphan UI (API live)
HubPlace vs Place Hai bảng POI Không gộp ERD

Orphan false-positive: HotelList / RideMatching / success screens đi qua navigateService / params — không phải 404.

Residual 404-risk

  1. navigate động / typo runtime.
  2. Deep link chưa whitelist (WelifeMapScreen cast).
  3. Catalog id mới quên navigateService → ServiceStub.

Hardening: npm run audit:nav PASS · Root NotFound soft-404.


3. Mock vs API (Consumer features)

Tổng

Class # features Ý nghĩa
LIVE 26 Gọi *Api BE, không phụ thuộc fixture list
HYBRID 9 API thật + nhánh MOCK payment / fallback UI
MOCK 0 —
STATIC_UI 1 geo helpers, không screen data

LIVE (API BE)

addresses · assistant · atm · auth · charging · chat · delivery · favorites · fuel · homeservices · hotels · kyc · medical · notifications · parking · pharmacy · places · promotions · rentals · reviews · rides · routing · schools · social · support · transit

HYBRID — chi tiết

Feature API Phần “mock” còn lại
wallet WalletApi · PaymentsApi PAYMENTS_MOCK topup/withdraw confirm
fnb / grocery / bills / qr / payments Merchants/Orders/Bills/Qr + Payments mockConfirm khi provider MOCK
health MedicalApi · UsersApi LIVE (WP-HEALTH-FALLBACK-01) · empty hồ sơ thật
home PlacesApi · AddressesApi Catalog icon/tile static config (đúng thiết kế)
profile Users/Rides/Orders · CmsApi SystemStates demo · Terms/Privacy LIVE (WP-FE-CMS-LEGAL-01)
medical (chat) MedicalApi + ChatApi LIVE (WP-FE-MED-CHAT-01) · Doctor.userId peer
wallet (chrome) WalletApi PROMOS hardcode trên WalletHome

Payment truth

Local: PAYMENTS_MOCK=true → giao dịch giả lập qua BE mock provider (vẫn HTTP thật, không hardcode số dư FE). Production go-live: cần OWNER MoMo/VNPay (WP-PAY-LIVE-01).


4. Surfaces khác

Surface Nav model Data Ghi chú
DRV Auth → MainTabs (Home/Trips/Wallet/Ratings/Account) Driver + Rides API Trip/GPS WS IMP
PAR Login → Onboarding → Home Partners API Thin UI; forms board còn gap
ADM Vite modules sidebar Cùng Nest API + ADMIN Overview/KYC/Ops/Ledger…
API Nest 39 modules · tags ×40 Prisma 86 models 0 stub() · STUB = 0

Auth (WP-AUTH-CREDENTIALS-SESSIONS-01): passwordHash · lockout · AuthSession · AuthDevice · AuthLoginEvent.


5. ERD (core) — vẽ lại

Full schema: 86 models trong api/prisma/schema.prisma. Sơ đồ dưới = trục nghiệp vụ (bỏ join nhỏ).

erDiagram
  User ||--o| WalletAccount : has
  User ||--o{ Address : saves
  User ||--o{ AuthSession : sessions
  User ||--o{ AuthDevice : devices
  User ||--o| UserTwoFactor : 2fa
  User ||--o| SocialAccount : oauth
  User ||--o| DriverProfile : may
  User ||--o| PartnerOrg : may
  User ||--o| UserKyc : kyc
  User ||--o| HealthProfile : health
  User ||--o| SocialProfile : social

  WalletAccount ||--o{ WalletLedger : ledger
  User ||--o{ PaymentIntent : pays
  User ||--o{ PaymentMethod : methods

  Merchant ||--o{ MenuCategory : menu
  MenuCategory ||--o{ MenuItem : items
  User ||--o{ Cart : carts
  Cart ||--o{ CartItem : lines
  Cart }o--|| Merchant : at
  User ||--o{ Order : orders
  Order ||--o{ OrderItem : lines
  Order }o--|| Merchant : from

  User ||--o{ RideQuote : quotes
  User ||--o{ Ride : books
  DriverProfile ||--o{ Ride : drives
  Ride ||--o{ RideRating : ratings

  Place ||--o| HotelPlaceDetail : hotel
  Place ||--o| RentalPlaceDetail : rental
  Place ||--o| RestaurantPlaceDetail : fnb
  Hotel ||--o{ HotelRoomType : rooms
  Hotel ||--o{ HotelBooking : bookings
  RentalListing ||--o{ RentalViewing : viewings

  ParkingLot ||--o{ ParkingBooking : bookings
  PharmacyStore ||--o{ PharmacyProduct : catalog
  PharmacyStore ||--o{ PharmacyPrescription : rx
  MedicalFacility ||--o{ Doctor : doctors
  MedicalFacility ||--o{ Appointment : appts
  School ||--o{ SchoolConsultation : consults

  ChargingStation
  TransitStop ||--o{ TransitRoute : routes
  HomeServiceProvider ||--o{ HomeServiceBooking : bookings
  BillProvider ||--o{ BillInvoice : invoices
  DeliveryOrder }o--|| User : buyer

  Conversation ||--o{ ConversationMember : members
  Conversation ||--o{ ChatMessage : messages
  SocialPost ||--o{ PostLike : likes
  SocialPost ||--o{ PostComment : comments
  User ||--o{ Favorite : favorites
  User ||--o{ Review : reviews
  User ||--o{ SupportTicket : tickets
  User ||--o{ AppNotification : notifs

Domain clusters

Cluster Models chính
Identity User · AuthSession · AuthDevice · AuthLoginEvent · SocialAccount · UserTwoFactor · UserKyc
Money WalletAccount · WalletLedger · PaymentIntent · PaymentMethod
FNB Merchant · Menu* · Cart* · Order*
Mobility RideQuote · Ride · RideRating · DriverProfile · Parking* · FuelStation · Atm · ChargingStation · Transit*
Stay Hotel* · Rental* · Place (+ details)
Care Pharmacy* · Medical* · HealthProfile · School*
P8 HomeService* · DeliveryOrder · Bill* · Qr (API)
Social SocialProfile · Post* · Follow · Friendship · Conversation* · CallSession
Platform Favorite · Review · Promotion · SupportTicket · CmsPage · MediaObject · AssistantMessage

6. Cấu trúc lại luồng (đề xuất)

Giữ (đã ổn)

  1. Map-first hub + navigateService single router.
  2. Journey chuẩn vertical: List → Detail → Action → Success → History.
  3. Một Nest API cho CON/PAR/DRV/ADM.
  4. Auth email OTP + credentials/sessions (WP-AUTH-CREDENTIALS-SESSIONS) làm nền.

Sửa / siết

# Luồng Việc
1 Payment Tách rõ UI “sandbox MOCK” vs live; OWNER bật MoMo/VNPay; không credit nội bộ prod
2 Health IMP WP-HEALTH-FALLBACK-01 — empty hồ sơ / không vax-hpv FE
3 ServiceStub Log metric khi hit; fail CI nếu catalog id mới không có case
4 Auth Hoàn thiện FE password/sessions/2FA trên Account; Google chỉ khi có Client ID
5 Account vs Map wallet Deep-link helper thống nhất (tránh duplicate state)
6 Error/404 NotFound + Empty/Offline/Error đã có StateBlocks — áp dụng đều list screens
7 PAR forms Ưu tiên board Partner (hotel/rent/med/school/fnb) trước vertical CON mới
8 Shared types Khởi tạo packages/shared cho DTO auth/wallet/order (giảm drift FE/BE)

Không làm


7. Hướng phát triển tổng thể (roadmap)

NOW (local stable)
  └─ Audit PASS · smoke PASS · IMP queue empty

NEXT (product depth · agent-safe)
  ├─ Nav CI + NotFound
  ├─ Kill residual fallbacks (health labels · stub hits)
  ├─ Journey polish: Ride map device QA · FNB checkout · Wallet transfer UX
  ├─ Partner thin → forms depth (BOARD-PAR-*)
  └─ Auth credentials/sessions FE polish

OWNER gates (blocked without secrets)
  ├─ WP-PAY-LIVE-01 (MoMo/VNPay)
  ├─ WP-AUTH-SMS-01 (eSMS) — optional nếu giữ email OTP
  ├─ WP-AUTH-GOOGLE-LIVE-01 (Web Client ID)
  └─ EAS cloud builds CON/DRV/PAR

THEN (scale)
  ├─ packages/shared
  ├─ Deep-link matrix + push notification routing
  ├─ Observability / SLO trên VPS
  └─ Figma exact sync khi có edit access

Ưu tiên nghiệp vụ (chức năng → trải nghiệm)

  1. Tiền thật chạy được (wallet topup / order pay) — tin cậy siêu ứng dụng.
  2. Ride end-to-end device (map + matching + chat) — hero use-case.
  3. FNB + Grocery checkout ổn định — tần suất cao.
  4. Account security (sessions · 2FA · password) — vừa ship credentials.
  5. Partner supply — không có listing/merchant thật thì CON trống.
  6. Visual polish — sau function; Figma vẫn BLOCKED_EXTERNAL.

8. File đụng / artifacts

Artifact Path
Báo cáo này docs/reports/FULL-SCREEN-ERD-AUDIT-2026-08-06.md
Nav script scripts/audit-nav-routes.mjs
Wallet map-nav mobile/src/features/wallet/walletNav.ts · MapStack WalletAction
Nav types mobile/src/navigation/types.ts
Service router mobile/src/features/home/navigateService.ts
Prisma api/prisma/schema.prisma (86 models · 39 Nest modules)
Prior audits MOBILE-NAVIGATION-AUDIT.md · FUNCTIONAL-AUDIT-2026-08-06.md · 14/16

Footer

Domain: TOOLING + D-WALLET
WP: WP-FULL-APP-AUDIT-01 · WP-FE-WALLET-MAP-NAV-01
Surfaces: CON|PAR|DRV|ADM|API
Status: IMP (audit + wallet map-nav fix)
Local: N/A (nav fix compile) · prior smoke PASS
Next: OWNER Pay/SMS/Google (stop-gate)