更新用户管理模块#72
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR updates the user management module to incorporate additional fields (RealName, Status, Email) into the AdminUser model and its related workflows. The changes span multiple layers including tests, API controllers, commands, queries, domain aggregates, and shared request/response models.
- Updated tests to construct AdminUser with the new parameters.
- Modified controller commands and query responses to include RealName, Status, and Email.
- Adjusted domain model, request, and response classes to reflect the updated AdminUser properties.
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/NetCorePal.D3Shop.Web.Tests/Identity/AuthTests.cs | Updated AdminUser initialization in tests. |
| test/NetCorePal.D3Shop.Domain.Tests/Identity/AdminUserTests.cs | Updated AdminUser initialization in tests. |
| src/NetCorePal.D3Shop.Web/Extensions/SeedDatabaseExtension.cs | Updated seeding logic with new AdminUser parameters. |
| src/NetCorePal.D3Shop.Web/Controllers/Identity/Admin/AdminUserController.cs | Modified command invocation to include additional parameters. |
| src/NetCorePal.D3Shop.Web/Application/Queries/Identity/Admin/AdminUserQuery.cs | Expanded query projections for new AdminUser fields. |
| src/NetCorePal.D3Shop.Web/Application/Commands/Identity/Admin/CreateAdminUserCommand.cs | Added new parameters to command and handler logic. |
| src/NetCorePal.D3Shop.Domain/AggregatesModel/Identity/AdminUserAggregate/AdminUser.cs | Updated constructor and property initializations with extra fields. |
| src/NetCorePal.D3Shop.Admin.Shared/Responses/AdminUserResponse.cs | Enhanced response model with new user fields. |
| src/NetCorePal.D3Shop.Admin.Shared/Requests/CreateAdminUserRequest.cs | Updated request payload to include RealName, Status, and Email. |
Comments suppressed due to low confidence (1)
src/NetCorePal.D3Shop.Admin.Shared/Responses/AdminUserResponse.cs:13
- [nitpick] RoleIds is assigned the same value as Roles, which could lead to ambiguity. Consider clarifying or renaming one of these properties if they are intended to represent different concepts.
public IEnumerable<string> RoleIds { get; set; } = roles;
| public string RealName { get; set; } = string.Empty; | ||
| public int Status { get; set; } | ||
|
|
||
| public string Email { get; private set; } = string.Empty; |
There was a problem hiding this comment.
The Email property has a private setter, which may prevent model binding from assigning a value during request deserialization. Consider changing the setter to public to support proper binding.
| public string Email { get; private set; } = string.Empty; | |
| public string Email { get; set; } = string.Empty; |
There was a problem hiding this comment.
Pull Request Overview
This PR updates the user management module by extending the AdminUser entity and its related data structures to support additional fields such as RealName, Status, and Email. Key changes include updating tests, modifying API commands and queries, and revising response and request structures to incorporate the new properties.
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/NetCorePal.D3Shop.Web.Tests/Identity/AuthTests.cs | Updated AdminUser initialization with extra parameters |
| test/NetCorePal.D3Shop.Domain.Tests/Identity/AdminUserTests.cs | Updated test cases to include new AdminUser parameters |
| src/NetCorePal.D3Shop.Web/Extensions/SeedDatabaseExtension.cs | Seed data now constructs AdminUser with extended fields |
| src/NetCorePal.D3Shop.Web/Controllers/Identity/Admin/AdminUserController.cs | Updated command invocation to pass new fields |
| src/NetCorePal.D3Shop.Web/Application/Queries/Identity/Admin/AdminUserQuery.cs | Adjusted query projections to include new properties |
| src/NetCorePal.D3Shop.Web/Application/Commands/Identity/Admin/CreateAdminUserCommand.cs | Extended command parameters for creating AdminUser |
| src/NetCorePal.D3Shop.Domain/AggregatesModel/Identity/AdminUserAggregate/AdminUser.cs | Modified AdminUser aggregate with new properties and related initialization |
| src/NetCorePal.D3Shop.Admin.Shared/Responses/AdminUserResponse.cs | Updated response model with additional fields; review accessor consistency |
| src/NetCorePal.D3Shop.Admin.Shared/Requests/CreateAdminUserRequest.cs | Updated request model to include new AdminUser attributes |
| { | ||
| private readonly HttpClient _client; | ||
| private readonly AdminUser _testUser = new("Test", "", "", [], []); | ||
| private readonly AdminUser _testUser = new("Test", "", "", [], [], "", 1, ""); |
There was a problem hiding this comment.
[nitpick] Consider defining a named constant or using an enum for the user status instead of the magic number '1', to improve code readability and maintainability.
| /// 这里确认是使用name还是userName | ||
| /// </summary> | ||
| public string UserName { get; set; } = name; | ||
| public string Email { get; private set; } = email; |
There was a problem hiding this comment.
[nitpick] The 'Email' property uses a private setter, unlike the other properties with public setters; consider aligning the access modifiers for consistency across the response model.
| public string Email { get; private set; } = email; | |
| public string Email { get; set; } = email; |
No description provided.