Skip to content

Fix/update cur team#1466

Merged
Qinyouzeng merged 4 commits intomainfrom
fix/update_cur_team
Jan 28, 2026
Merged

Fix/update cur team#1466
Qinyouzeng merged 4 commits intomainfrom
fix/update_cur_team

Conversation

@MayueCif
Copy link
Contributor

fix:insert or update on table "Staff" violates foreign key constraint "FK_Staff_Team_CurrentTeamId"

新增RoleBasicDto和RoleDetailByCodeQuery,实现通过角色Code获取基础信息。完善QueryHandler和RoleService相关逻辑,并统一版权声明。
移除了RoleBasicDto类中将Name和Code初始化为空字符串的无参构造函数,仅保留带参数的构造函数。此更改有助于避免属性被默认初始化为无意义的空字符串。
将 Staff.SetCurrentTeam 方法参数类型由 Guid 改为 Guid?,并在清除当前团队时传入 null,提升对无团队状态的支持。
Copilot AI review requested due to automatic review settings January 28, 2026 02:43
@Qinyouzeng Qinyouzeng merged commit 8d160b0 into main Jan 28, 2026
5 checks passed
@Qinyouzeng Qinyouzeng deleted the fix/update_cur_team branch January 28, 2026 02:44
Copy link

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 fixes a foreign key constraint violation that occurred when attempting to clear a staff member's current team during LDAP synchronization. The root cause was using Guid.Empty instead of null to clear the CurrentTeamId, which violated the FK constraint since no Team with ID 00000000-0000-0000-0000-000000000000 exists.

Changes:

  • Updated SetCurrentTeam method to accept nullable Guid? parameter instead of non-nullable Guid
  • Changed the LDAP sync logic to pass null instead of Guid.Empty when clearing a staff's current team

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/Domain/Masa.Auth.Domain/Subjects/Aggregates/Staff.cs Modified SetCurrentTeam method signature to accept Guid? instead of Guid, allowing null values for clearing the current team
src/Services/Masa.Auth.Service.Admin/Application/Subjects/StaffCommandHandler.cs Updated LDAP sync logic to pass null instead of Guid.Empty when disabling users and clearing their team assignments

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants

Comments