Skip to content

Conversation

@iammukeshm
Copy link
Member

Summary

Splits the UserService god class into focused, single-responsibility services for better maintainability and testability.

Changes

New Interfaces (Modules.Identity.Contracts/Services/)

  • IUserRegistrationService: User registration and external authentication
  • IUserProfileService: Profile CRUD operations
  • IUserStatusService: Status toggle and delete operations
  • IUserRoleService: Role assignment operations
  • IUserPasswordService: Password operations (forgot/reset/change)
  • IUserPermissionService: Permission queries and caching

New Implementations (Modules.Identity/Services/)

  • UserRegistrationService
  • UserProfileService
  • UserStatusService
  • UserRoleService
  • UserPasswordService
  • UserPermissionService

Other Changes

  • UserService now acts as a facade delegating to the new services (backward compatibility)
  • Updated DI registration in IdentityModule.cs
  • Deleted 7 old partial class files

Benefits

  • Single Responsibility Principle compliance
  • Better testability (smaller focused services)
  • Improved maintainability (clear separation of concerns)
  • Enhanced reusability (handlers can inject specific services they need)

Build Status

  • 0 errors
  • 4 warnings (pre-existing, unrelated to this change)

Closes #1174

…ices (#1174)

Split the UserService god class into focused, single-responsibility services:

**New Interfaces (Modules.Identity.Contracts/Services/):**
- IUserRegistrationService: User registration and external auth
- IUserProfileService: Profile CRUD operations
- IUserStatusService: Status toggle and delete operations
- IUserRoleService: Role assignment operations
- IUserPasswordService: Password operations (forgot/reset/change)
- IUserPermissionService: Permission queries and caching

**New Implementations (Modules.Identity/Services/):**
- UserRegistrationService
- UserProfileService
- UserStatusService
- UserRoleService
- UserPasswordService
- UserPermissionService

**Other Changes:**
- UserService now acts as a facade delegating to the new services
- Updated DI registration in IdentityModule.cs
- Deleted 7 old partial class files

This improves:
- Single Responsibility Principle compliance
- Testability (smaller focused services)
- Maintainability (clear separation of concerns)
- Reusability (handlers can inject specific services they need)

Closes #1174
@iammukeshm iammukeshm merged commit 447481a into develop Jan 26, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Refactor] Split UserService.cs (657 lines) into smaller services

2 participants