feat(auth): referral agent code and auto-assign agent codes
Validate optional referrer code at OTP registration and persist assignedAgentId. Auto-generate unique W-XXXX codes when creating or promoting agents and backfill on agent login when missing. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+10
-9
@@ -290,15 +290,16 @@ model AdminUser {
|
||||
}
|
||||
|
||||
model OtpChallenge {
|
||||
id String @id @default(cuid())
|
||||
phone String
|
||||
code String
|
||||
firstName String?
|
||||
lastName String?
|
||||
isRegister Boolean @default(false)
|
||||
attempts Int @default(0)
|
||||
expiresAt DateTime
|
||||
createdAt DateTime @default(now())
|
||||
id String @id @default(cuid())
|
||||
phone String
|
||||
code String
|
||||
firstName String?
|
||||
lastName String?
|
||||
isRegister Boolean @default(false)
|
||||
assignedAgentId String?
|
||||
attempts Int @default(0)
|
||||
expiresAt DateTime
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
@@index([phone])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user