Skip to content

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ăngRoles chínhScope
Tài khoản hệ thốngITLeader, ITStaffSystem-wide
Khách hàngITLeader, ITStaff, BranchPOSBranch + customer management
Nhân viênITLeader, ITStaffSystem-wide
Chi nhánh / phòng ban / nhómITLeader, ITStaff + WarehouseRoles cho branchInternal 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 module crm.

Feature Groups

GroupMô tảPagesDocs
System AccountsCRUD tài khoản app, role, đổi mật khẩu, merge account3Business · Technical
Customer WorkspaceDanh sách, tạo mới, detail tabs, lịch sử, ví, affiliate, ticket4 + nhiều tab conBusiness · Technical
Employee ProfilesDanh sách NV, hồ sơ, doanh thu, commission, login, vi phạm4 + 8 tabs detailBusiness · Technical
Internal DirectoryBranch, department, group, group members7Business · 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

ServiceVai trò
authCustom 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-apiCung 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

DBKey tables
defaultaccount, account_address, account_role, employee_profile, group, group_member, role, permission, branch_customer, account_activity
ecommerceecommerce_user, branch_user, department_user, customer_revenue, customer_current_level và các report views cho customer/employee
wallettransaction, 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 module user.
  • Employee list mở dialog EmployeeProfileCreate ngay 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