User/Auth Service
ccr-user-service ดูแล identity, role permission, customer profile และ policy consent
Domain หลัก
| Domain | รายละเอียด |
|---|---|
| Backoffice users | สร้าง/แก้ไข/ลบ user, reset/change password |
| Roles & permissions | RBAC สำหรับ Backoffice menu/action |
| Customer profile | Customer list/detail, group, tier, activation |
| Consent | Register policy และ customer policy acceptance |
| Me endpoint | ข้อมูล session user, contact, consent |
| Auth0/APIM | Lookup/sync external identity |
User rules
| Rule | รายละเอียด |
|---|---|
| Create user password | required, 8-128 chars, ต้องมี lowercase, uppercase, number |
| User email | required, valid email, max 100 chars |
| Role | RoleId required |
| Status | Active หรือ Inactive |
| Phone | max 20 chars, pattern ตัวเลข/ช่องว่าง/ขีด/เครื่องหมายบวก |
Role rules
| Rule | รายละเอียด |
|---|---|
| Role name | required, max 100 chars |
| Description | max 500 chars |
| Permissions | required อย่างน้อย 1 ค่า |
| Permission validation | ทุกค่าเช็คผ่าน PermissionHelper.IsValidPermission |
Customer rules
| Rule | รายละเอียด |
|---|---|
| External auth create | Auth0Id, Provider, ProviderUserName required |
| Customer status | Active, Inactive, Blacklisted |
| Activation reason | max 500 chars |
| Social providers | GoogleOAuth2, Facebook, Line, Sms, Email |
| Driver license fields | DriverLicenseNumber (string, optional), DriverLicenseExpiry (DateTime, optional) |
Me & Profile Endpoints
| Endpoint | Method | รายละเอียด |
|---|---|---|
GET /me | GET | ข้อมูล session user หรือ customer profile summary |
GET /me/profile | GET | ข้อมูล customer profile ทั้งหมด (รวมถึงข้อมูลใบขับขี่) |
GET /me/contact | GET | ข้อมูลผู้ติดต่อของลูกค้า |
PUT /me/contact | PUT | อัปเดตข้อมูลผู้ติดต่อ |
GET /me/phone/check | GET | ตรวจสอบความพร้อมใช้งานของหมายเลขโทรศัพท์ (เช็คว่าซ้ำหรือไม่) |
PUT /me/phone | PUT | อัปเดตหมายเลขโทรศัพท์ (ผูกกับ Auth0 ID) |
GET /me/email/check | GET | ตรวจสอบความพร้อมใช้งานของอีเมล (เช็คว่าซ้ำหรือไม่) |
PUT /me/email | PUT | อัปเดตอีเมล (ผูกกับ Auth0 ID) |
PUT /me/personal-info | PUT | อัปเดตข้อมูลส่วนตัว (คำนำหน้า, ชื่อ, นามสกุล, เพศ, วันเกิด, เลขใบขับขี่, วันหมดอายุใบขับขี่) |
GET /me/register-policies/consent | GET | ดู consent/policy ที่ลูกค้ายังต้องกดยอมรับ |
POST /me/accept-register-policies | POST | กดยอมรับ register policy (บันทึก consent) |
Database
| DbSet | รายละเอียด |
|---|---|
Users, Roles, RolePermissions | Backoffice RBAC |
Customers, Groups, Tiers, SocialLogins | Customer domain (เก็บประวัติลูกค้า, ข้อมูลใบขับขี่ DriverLicenseNumber, DriverLicenseExpiry และช่องทาง social ที่ผูกไว้) |
CustomerActivationLogs | Activation history |
BookingPolicies, RegisterPolicies, CustomerPolicyAcceptances | Policy/consent |
Titles | Master data คำนำหน้า |
ระบบงานจัดการข้อมูลลูกค้า (Admin Backoffice)
ภาพตัวอย่างหน้าจอจริงจากระบบในการจัดการข้อมูลลูกค้าที่สอดคล้องกับโครงสร้างฐานข้อมูลและกฎเกณฑ์ด้านบน:
Customer Management
