Quan hệ giữa entity/module. Chỉ index quan hệ + dẫn nguồn (chi tiết ở travel-os/03-DOMAIN-MAP & 04-EVENT-CATALOG). Entity: 02-ENTITY-MAP.
graph TD
ACC[Account]-- 1:1 -->TEN[Tenant]
TEN-- scopes -->RES[Reservation]
TEN-- scopes -->everything[(mọi entity tenant-scoped)]
RES-- uses -->AVA[Availability]
RES-- snapshots -->PRI[Pricing]
RES-- belongs to -->UNIT[Unit]-- belongs to -->LIS[Listing]
PART[Partner]-- publishes -->LIS
CUST[Customer]-- places -->RES
RES-- produces -->EV[Domain Events]
EV-- stored in -->OUT[Outbox Event]
OUT-- feeds -->NOTIF[Notification]
OUT-- feeds -->PAY[Payment]
OUT-- feeds -->AFF[Affiliate]
OUT-- feeds -->TI[Travel Intelligence]
USR[User]-- member of (many) -->TEN
USR-- has -->SES[Session]
KEY[API Key]-- maps to -->TEN
MED[Medical Tourism]-- reuses -->RES
MED-- reuses -->PAY
RES-. is Module #1 of .->TOS[Travel OS]
| Quan hệ | Ý nghĩa | Nguồn |
|---|---|---|
| Tenant owns Account (1:1) | Mỗi Account có đúng một Tenant (vùng dữ liệu) | travel-os/07, business-os/06 |
| Tenant scopes Reservation (và mọi entity) | Mọi entity tenant-scoped; tenant từ server-side, không từ client | backend/AUTH-TENANT-CONTEXT |
| Reservation uses Availability | Giữ chỗ khoá Availability (chống overbook) | backend/BOOKING-API |
| Reservation snapshots Pricing | Giá chốt tại thời điểm đặt (bất biến) | travel-os/03 |
| Reservation belongs to Unit → Listing | Unit thuộc Listing; API nhận unitId, suy listingId | backend/BOOKING-API |
| Partner publishes Listing | Partner (bên cung) tạo Listing/Unit trong Catalog | travel-os/03 |
| Customer places Reservation | Khách du lịch tạo đơn (guest ẩn danh → merge khi đăng ký) | travel-os/03 |
| Reservation produces Events | reservation.created/confirmed/cancelled… | travel-os/04 |
| Events → Outbox | Event lưu cùng transaction (at-least-once) | backend/OUTBOX-HANDLERS |
| Outbox feeds Notification/Payment/Affiliate/Travel Intelligence | Consumer async, idempotent theo eventId | travel-os/04 |
| User member-of Tenant (N:M) | 1 user thuộc nhiều tenant + role (membership) | backend/AUTH-GATEWAY |
| User has Session; API Key maps to Tenant | Hai đường xác thực → tenant context | backend/AUTH-GATEWAY |
| Medical reuses Reservation & Payment | Vertical = composition, không fork module nền | platform/MEDICAL-TOURISM-INTEGRATION, travel-os/02 |
| Booking is Module #1 of Travel OS | Reference implementation của mọi pattern nền tảng | travel-os/00, travel-os/01 |