Appearance
User Module
Mục đích
Quản lý danh mục người dùng nền của Diva: tài khoản hệ thống, nhân viên, khách hàng, chi nhánh, phòng ban và nhóm. Đây là module "identity + organization" mà các module khác đều phụ thuộc.
Quy mô
- 18 FE pages
- 157 FE components
- 11 GraphQL files / 143 operations
- 4 nhóm nghiệp vụ chính
Actors & Permissions
| Nhóm chức năng | Roles chính | Scope |
|---|---|---|
| Tài khoản hệ thống | ITLeader, ITStaff | System-wide |
| Khách hàng | ITLeader, ITStaff, BranchPOS | Branch + customer management |
| Nhân viên | ITLeader, ITStaff | System-wide |
| Chi nhánh / phòng ban / nhóm | ITLeader, ITStaff + WarehouseRoles cho branch | Internal configuration |
Ghi chú: navigation customer được mở rộng sang CRM platform qua
process.env.NAME === "crm", nhưng nghiệp vụ CRM chi tiết được tách sang modulecrm.
Feature Groups
| Group | Mô tả | Pages | Docs |
|---|---|---|---|
| System Accounts | CRUD tài khoản app, role, đổi mật khẩu, merge account | 3 | Business · Technical |
| Customer Workspace | Danh sách, tạo mới, detail tabs, lịch sử, ví, affiliate, ticket | 4 + nhiều tab con | Business · Technical |
| Employee Profiles | Danh sách NV, hồ sơ, doanh thu, commission, login, vi phạm | 4 + 8 tabs detail | Business · Technical |
| Internal Directory | Branch, department, group, group members | 7 | Business · Technical |
Liên kết Modules
- crm — customer detail, customer visit, ticket manager, call history
- ecommerce — order history, appointments, treatment record, doanh thu
- wallet — payment histories, wallet stats, commission history
- affiliate — collaborator orders, payments, withdraw history
- salary — employee commission, revenue, timekeeping, violation data
- settings — branch route nằm dưới
/s/internal-settings/*nhưng được khai báo trong user module
Backend Services
| Service | Vai trò |
|---|---|
| auth | Custom actions cho createAccount, đổi mật khẩu, OTP merge, OTP forget password |
| ecommerce-api | Đồng bộ account/branch/department sang ecommerce views và dataset phụ trợ |
| wallet-api | Cung cấp balance / transaction cho customer và employee detail |
| controller (Hasura) | CRUD trực tiếp trên account, employee_profile, branch, department, group |
Databases
| DB | Key tables |
|---|---|
| default | account, account_address, account_role, employee_profile, group, group_member, role, permission, branch_customer, account_activity |
| ecommerce | ecommerce_user, branch_user, department_user, customer_revenue, customer_current_level và các report views cho customer/employee |
| wallet | transaction, wallet_stats_result, wallet_balance_result |
Đặc điểm kiến trúc
- Customer detail là "workspace tổng hợp": nhiều tab không nằm trong user module gốc mà reuse component từ
crm,ecommerce,wallet,affiliate. - Branch và department route dùng prefix
/s/internal-settings/*, nhưng route config và UI vẫn được quản lý trong moduleuser. - Employee list mở dialog
EmployeeProfileCreatengay trên trang danh sách, trong khi detail dùng route riêng. - Export người dùng dùng paging 1000 records/lặp, không export bằng 1 query lớn.
Domain Docs
- Canonical business docs:
- Compatibility index cũ: