Báo cáo ma trận · gắn API hồ sơ / avatar (D-USER)
Ngày: 2026-08-06 · WP: WP-USER-AVATAR-01 · WP-FE-USER-AVATAR-01 Nguồn ma trận:
docs/01-MATRIX-TRACEABILITY.mdRef BE:D:\APP_DESIGN_BUILD\BE-baotienweb.cloud\src\profileHTTP log:HTTP_DEBUG=1· Nestapi:dev· terminal watch đang chạy (filter[HTTP]|users/me|profile|avatar) Probe raw:_probe-profile-matrix.json
1. Verdict
| Hạng mục | Kết luận |
|---|---|
BE routes D-USER (avatar/cover/summary + alias /profile) |
ALIVE — đã map + smoke 200 |
| FE Consumer gắn API | ĐÃ GẮN me / PATCH / avatar / summary |
| FE cover upload UI | CHƯA (API sẵn, chưa nút trên ProfileEdit) |
| Dashboard admin profile avatar | CHƯA (login OTP only) |
| Settings → notification-preferences | CHƯA (local toggle) |
| Prod VPS | ĐÃ DEPLOY cùng wave avatar |
2. Ma trận Domain (trích) → BE ops thực tế
D-USER (matrix §A)
| Matrix claim | Thực tế code 2026-08-06 |
|---|---|
Tag users + profile · 8 IMP |
Controller UsersController 7 routes + ProfileAliasController 8 aliases (cùng service) |
Consumer features/profile + avatar |
AccountHome · ProfileEdit · AuthContext |
| Partner staff profile | Ngoài scope wave này (merchant partner/profile khác domain) |
| Driver profile + avatar | Driver app riêng — chưa wire avatar user |
| Admin User admin | Dashboard chưa gọi /users/me/avatar |
D-AUTH / D-MEDIA (liên quan)
| Domain | Liên quan hồ sơ | Gắn? |
|---|---|---|
| D-AUTH | GET /auth/me alias profile · sessions · 2FA |
Có — AuthContext hydrate sau login qua /users/me |
| D-MEDIA | MinIO POST /upload/single · avatar dùng MediaService nội bộ |
Có — avatar/cover gọi media.uploadSingle rồi set URL trên User/SocialProfile |
3. Bảng gắn API (BE ↔ FE) — chi tiết
Prefix: /api/v1
| # | Method | Path BE | FE caller | File | Status |
|---|---|---|---|---|---|
| 1 | GET | /users/me |
UsersApi.me |
AuthContext · ProfileEditScreen · Health screens |
WIRED |
| 2 | PATCH | /users/me |
UsersApi.updateMe |
ProfileEditScreen (fullName, email, phone, birthDate, gender, bio) |
WIRED |
| 3 | GET | /users/me/summary |
UsersApi.summary |
AccountHomeScreen (điểm) |
WIRED |
| 4 | POST | /users/me/avatar |
UsersApi.uploadAvatar |
ProfileEditScreen (camera/thư viện) |
WIRED |
| 5 | DELETE | /users/me/avatar |
UsersApi.deleteAvatar |
ProfileEditScreen |
WIRED |
| 6 | POST | /users/me/cover |
UsersApi.uploadCover |
(API client có) | API OK · FE UI thiếu |
| 7 | DELETE | /users/me/cover |
UsersApi.deleteCover |
(API client có) | API OK · FE UI thiếu |
| 8 | GET | /profile |
alias baotienweb | không gọi từ mobile (dùng /users/me) |
ALIVE |
| 9 | PATCH/PUT | /profile |
alias | — | ALIVE |
| 10 | GET | /profile/summary |
alias | — | ALIVE |
| 11 | POST/DELETE | /profile/avatar · /profile/cover |
alias | — | ALIVE |
| 12 | GET | /auth/me |
alias → users | smoke OK | ALIVE |
| 13 | POST | /upload/single |
MediaApi (KYC/social) |
không dùng cho avatar dedicated | ALIVE (POST only; GET→404 đúng) |
Luồng dữ liệu (đã pin log)
ProfileEdit → UsersApi.uploadAvatar (multipart field avatar)
→ POST /users/me/avatar
→ MediaService.uploadSingle → MinIO
→ User.avatarUrl = publicUrl
→ AuthContext.refreshUser → AccountHome Image
AccountHome focus
→ UsersApi.summary → GET /users/me/summary
→ rewards.rewardPoints hiển thị (thay hardcode 1250)
4. Evidence HTTP log (local · HTTP_DEBUG=1)
Probe lúc 2026-08-06T08:30:40Z (xem JSON đính kèm):
| Call | Status | ms |
|---|---|---|
POST /auth/login/password |
200 | 260 |
GET /users/me |
200 | 24 |
PATCH /users/me (+ bio) |
200 | 47 |
GET /users/me/summary |
200 | 34 |
DELETE /users/me/avatar |
200 | 35 |
DELETE /users/me/cover |
200 | 22 |
GET /profile |
200 | 26 |
GET /profile/summary |
200 | 27 |
GET /auth/me |
200 | 26 |
GET /auth/sessions |
200 | 24 |
GET /auth/2fa/status |
200 | 12 |
Log Nest mẫu (redacted):
[HTTP] → PATCH /api/v1/users/me b={"fullName":"Consumer Local","bio":"Bao cao matrix probe"}
[HTTP] ← PATCH /api/v1/users/me 200 … "bio":"Bao cao matrix probe"
[HTTP] ← GET /api/v1/users/me/summary 200 … favoritesCount, walletBalance
Cách xem log tiếp: terminal đang Get-Content -Wait file nest log (filter HTTP). Nest gốc: npm run api:dev · HTTP_DEBUG=1 trong api/.env.
5. So baotienweb — còn thiếu gì?
| baotienweb | WELIFE | Cần chỉnh? |
|---|---|---|
POST /profile/avatar + thumbnail |
Upload + avatarUrl (không thumb riêng) |
P2 — thumb optional |
POST /profile/cover trên User |
Cover → SocialProfile.coverUrl |
OK schema; thiếu UI CON |
GET /profile/summary |
Có | OK |
location Json trên user |
Addresses module riêng | Không bắt buộc gộp |
GET/PUT notification-preferences |
Settings local-only | P1 WP-USER-PREFS-01 |
Avatar trên /auth/me login payload |
Login trả user mỏng; FE refresh /users/me |
OK đủ |
6. Việc cần chỉnh / gắn tiếp (ưu tiên)
| P | Việc | Domain/WP đề xuất | Surfaces |
|---|---|---|---|
| P0 | Reload Expo · QA đổi avatar trên máy | — | CON |
| P1 | UI upload/xóa cover trên ProfileEdit hoặc SocialProfile | WP-FE-USER-COVER-01 | CON |
| P1 | Persist Settings → notif prefs API (clone baotien) | WP-USER-PREFS-01 | API+CON |
| P2 | Social feed/profile dùng avatarUrl Image (đang letter) |
WP-FE-SOC-AVATAR | CON |
| P2 | Dashboard hiện avatar admin khi OTP login | WP-FE-ADM-USER | ADM |
| P2 | avatarThumbnail nếu cần perf list |
WP-USER-THUMB | API |
Không cần tạo API thứ hai — canonical giữ /users/me/*; /profile/* chỉ alias.
7. File đụng (wave này)
BE
api/src/modules/users/users.controller.tsapi/src/modules/users/users.service.tsapi/src/modules/users/profile-alias.controller.tsapi/src/modules/users/users.module.tsapi/src/modules/users/dto/update-profile.dto.tsapi/src/modules/media/media.service.ts(tryDeleteByPublicUrl)
FE
mobile/src/services/api.ts(UsersApi·AuthUser)mobile/src/features/auth/AuthContext.tsxmobile/src/features/profile/screens/ProfileEditScreen.tsxmobile/src/features/profile/screens/AccountHomeScreen.tsx
Docs
docs/01-MATRIX-TRACEABILITY.md(D-USER 8 ops)docs/05-PHASE-BACKLOG.mddocs/reports/WP-USER-AVATAR-01.md- this file
8. Footer
Domain: D-USER (+ D-AUTH/D-MEDIA liên quan)
WP: WP-USER-AVATAR-01 · WP-FE-USER-AVATAR-01
Surfaces: API · CON (ADM/DRV cover UI chưa)
Status: IMP (core) · PARTIAL (cover UI · prefs)
Local HTTP: PASS (probe JSON)
Prod: DEPLOYED earlier same day
Log watch: ON (HTTP_DEBUG=1)
Next: WP-FE-USER-COVER-01 | WP-USER-PREFS-01