Skip to main content

User/Auth Service

ccr-user-service ดูแล identity, role permission, customer profile และ policy consent

Domain หลัก

Domainรายละเอียด
Backoffice usersสร้าง/แก้ไข/ลบ user, reset/change password
Roles & permissionsRBAC สำหรับ Backoffice menu/action
Customer profileCustomer list/detail, group, tier, activation
ConsentRegister policy และ customer policy acceptance
Me endpointข้อมูล session user, contact, consent
Auth0/APIMLookup/sync external identity

User rules

Ruleรายละเอียด
Create user passwordrequired, 8-128 chars, ต้องมี lowercase, uppercase, number
User emailrequired, valid email, max 100 chars
RoleRoleId required
StatusActive หรือ Inactive
Phonemax 20 chars, pattern ตัวเลข/ช่องว่าง/ขีด/เครื่องหมายบวก

Role rules

Ruleรายละเอียด
Role namerequired, max 100 chars
Descriptionmax 500 chars
Permissionsrequired อย่างน้อย 1 ค่า
Permission validationทุกค่าเช็คผ่าน PermissionHelper.IsValidPermission

Customer rules

Ruleรายละเอียด
External auth createAuth0Id, Provider, ProviderUserName required
Customer statusActive, Inactive, Blacklisted
Activation reasonmax 500 chars
Social providersGoogleOAuth2, Facebook, Line, Sms, Email
Driver license fieldsDriverLicenseNumber (string, optional), DriverLicenseExpiry (DateTime, optional)

Me & Profile Endpoints

EndpointMethodรายละเอียด
GET /meGETข้อมูล session user หรือ customer profile summary
GET /me/profileGETข้อมูล customer profile ทั้งหมด (รวมถึงข้อมูลใบขับขี่)
GET /me/contactGETข้อมูลผู้ติดต่อของลูกค้า
PUT /me/contactPUTอัปเดตข้อมูลผู้ติดต่อ
GET /me/phone/checkGETตรวจสอบความพร้อมใช้งานของหมายเลขโทรศัพท์ (เช็คว่าซ้ำหรือไม่)
PUT /me/phonePUTอัปเดตหมายเลขโทรศัพท์ (ผูกกับ Auth0 ID)
GET /me/email/checkGETตรวจสอบความพร้อมใช้งานของอีเมล (เช็คว่าซ้ำหรือไม่)
PUT /me/emailPUTอัปเดตอีเมล (ผูกกับ Auth0 ID)
PUT /me/personal-infoPUTอัปเดตข้อมูลส่วนตัว (คำนำหน้า, ชื่อ, นามสกุล, เพศ, วันเกิด, เลขใบขับขี่, วันหมดอายุใบขับขี่)
GET /me/register-policies/consentGETดู consent/policy ที่ลูกค้ายังต้องกดยอมรับ
POST /me/accept-register-policiesPOSTกดยอมรับ register policy (บันทึก consent)

Database

DbSetรายละเอียด
Users, Roles, RolePermissionsBackoffice RBAC
Customers, Groups, Tiers, SocialLoginsCustomer domain (เก็บประวัติลูกค้า, ข้อมูลใบขับขี่ DriverLicenseNumber, DriverLicenseExpiry และช่องทาง social ที่ผูกไว้)
CustomerActivationLogsActivation history
BookingPolicies, RegisterPolicies, CustomerPolicyAcceptancesPolicy/consent
TitlesMaster data คำนำหน้า

ระบบงานจัดการข้อมูลลูกค้า (Admin Backoffice)

ภาพตัวอย่างหน้าจอจริงจากระบบในการจัดการข้อมูลลูกค้าที่สอดคล้องกับโครงสร้างฐานข้อมูลและกฎเกณฑ์ด้านบน:

Customer Management

Customer Management