Commit bc721dc
committed
refactor(api): update User interface to use entity objects
- Change UserUpdate to accept *models.User instead of separate
id/changes parameters
- Change UserDelete to accept *models.User instead of id string
- Update service layer to resolve users before update/delete operations
- Remove UserChanges model usage in favor of direct entity updates
- Add applyUserChanges helper function for user field updates
- Update all service methods to use new interface signatures
- Add proper BSON marshaling with ObjectID conversion in UserUpdate
- Update AuthLocalUser to modify user object directly before update
- Update CreateUserToken to handle preferred namespace updates
- Update LeaveNamespace to resolve user before clearing preferences
- Update Setup to pass user entity to UserDelete on rollback
- Simplify UserDelete implementation using DeleteOne directly
- Add case-insensitive field comparison in applyUserChanges
- Normalize string fields (username, email, recovery_email) to lowercase
- Update password hashing to return complete UserPassword object
- Update all mock expectations to use entity objects
- Add complete user and updatedUser fixtures in test cases
- Reorder mock setup in tests for better clarity
- Fix expected error user state in UpdatePasswordUser tests
BREAKING CHANGE: UserUpdate and UserDelete now accept *models.User and
return only error1 parent b899d7b commit bc721dc
File tree
14 files changed
+587
-318
lines changed- api
- services
- store
- mocks
- mongo
- cli/services
14 files changed
+587
-318
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
310 | 310 | | |
311 | 311 | | |
312 | 312 | | |
313 | | - | |
| 313 | + | |
| 314 | + | |
314 | 315 | | |
315 | 316 | | |
316 | | - | |
| 317 | + | |
317 | 318 | | |
318 | 319 | | |
319 | 320 | | |
320 | 321 | | |
321 | | - | |
| 322 | + | |
322 | 323 | | |
323 | 324 | | |
324 | 325 | | |
| |||
391 | 392 | | |
392 | 393 | | |
393 | 394 | | |
394 | | - | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
395 | 400 | | |
396 | 401 | | |
397 | 402 | | |
| |||
0 commit comments