Commit 55b990b
committed
Fix user resource tracking during onboarding
Issue: First user created during onboarding not tracked in billing system
Root cause: User created BEFORE company exists, so company_uuid is null
Solution: Create company FIRST, then set company_uuid before user creation
Flow before:
1. User::create() - no company_uuid
2. Company created
3. assignCompany() - sets company_uuid after creation
Flow after:
1. Company::create() - company exists first
2. Set company_uuid in attributes
3. User::create() - with company_uuid set
4. assignCompany() - maintains relationship
This ensures ResourceCreatedListener can track the first user properly
since it requires company_uuid to log usage to billing_resource_usage table.
Related to fleetops driver creation fix (same issue, same solution).1 parent 9dd7a72 commit 55b990b
1 file changed
+7
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
60 | 66 | | |
61 | 67 | | |
62 | 68 | | |
| |||
66 | 72 | | |
67 | 73 | | |
68 | 74 | | |
69 | | - | |
70 | | - | |
| 75 | + | |
71 | 76 | | |
72 | 77 | | |
73 | 78 | | |
| |||
0 commit comments