Skip to content

更新用户管理模块#72

Merged
witskeeper merged 2 commits into
netcorepal:mainfrom
zhouda1fu:main
May 12, 2025
Merged

更新用户管理模块#72
witskeeper merged 2 commits into
netcorepal:mainfrom
zhouda1fu:main

Conversation

@zhouda1fu
Copy link
Copy Markdown
Contributor

No description provided.

@witskeeper witskeeper requested a review from Copilot May 12, 2025 11:38
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
Copy link

Copilot AI May 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
public string Email { get; private set; } = string.Empty;
public string Email { get; set; } = string.Empty;

Copilot uses AI. Check for mistakes.
@witskeeper witskeeper requested a review from Copilot May 12, 2025 12:14
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, "");
Copy link

Copilot AI May 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

Copilot uses AI. Check for mistakes.
/// 这里确认是使用name还是userName
/// </summary>
public string UserName { get; set; } = name;
public string Email { get; private set; } = email;
Copy link

Copilot AI May 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

Suggested change
public string Email { get; private set; } = email;
public string Email { get; set; } = email;

Copilot uses AI. Check for mistakes.
@witskeeper witskeeper merged commit 669d3cb into netcorepal:main May 12, 2025
1 check 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.

4 participants