Feat/namespace member display username#236
Open
Rsweater wants to merge 2 commits intoiflytek:mainfrom
Open
Conversation
MemberResponse DTO now includes displayName and email fields. NamespacePortalQueryAppService batch-loads UserAccount data via findByIdIn to avoid N+1 queries. Frontend member table shows username (with userId as fallback subtitle) and email columns instead of raw user IDs.
…ement MemberResponse DTO now includes displayName and email fields. NamespacePortalQueryAppService batch-loads UserAccount data via findByIdIn to avoid N+1 queries. Frontend member table shows username (with userId as fallback subtitle) and email columns instead of raw user IDs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat(namespace): display username and email in namespace member management
Summary
What changed?(改了什么?)
命名空间成员管理页面当前只显示用户 ID(userId),不方便人类阅读。本 PR 在成员列表中增加了
displayName(用户名)和email(邮箱)字段,使管理员可以快速识别成员身份。后端改动(3 个文件):
MemberResponse.javadisplayName+email字段from(member)方法保留,新增from(member, user)方法)NamespacePortalQueryAppService.javaUserAccountRepository,listMembers批量查询用户信息findByIdIn批量查询,避免 N+1 问题NamespacePortalCommandAppService.javaUserAccountRepository,addMember/updateMemberRole填充用户信息后端测试(3 个文件):
NamespacePortalControllerTest.javaUserAccountRepositorymock,addMember/updateMemberRole测试添加 stubNamespacePortalCommandAppServiceTest.javaUserAccountRepository参数NamespacePortalQueryAppServiceTest.javaUserAccountRepository参数前端改动(4 个文件):
namespace-members.tsxtypes.tsNamespaceMember接口新增displayName?: string+email?: stringschema.d.tsen.json/zh.jsoncolUsername+colEmail翻译 key总计:11 个文件变更,+84 行新增,-9 行删除
Why is this needed?(为什么需要?)
当前成员管理页面只显示 userId(如
docker-admin),管理员无法快速识别成员身份。加上 displayName 和 email 后,管理员可以直观看到"Platform Admin (admin@skillhub.local)"这样的信息,大幅提升管理效率。同时,该需求与管理员账户的用户管理页面保持一致,后者已经正确显示了用户名和邮箱。Validation
NamespacePortalControllerTest全部通过pnpm typecheck和pnpm build均通过schema.d.ts已更新displayName?+email?Commands run:
Risk
命名空间成员表格列从 "User ID" 改为 "Username" + "Email"。现有功能完全不受影响(向后兼容 — 新字段为可选,
from(member)方法保留返回 null)。无。无数据库 migration,无配置变更,无 API 路径变更。
直接 revert 此 PR。
MemberResponse.from(member)工厂方法已保留并返回null,回滚安全无风险。Notes
完整测试方案
一、自动化测试
1. 后端单元测试
预期:全部通过,无编译错误。
2. 前端类型检查 + 构建
预期:无类型错误,构建成功。
3. API 响应验证
预期响应:
{ "code": 0, "data": { "items": [ { "id": 1, "namespaceId": 1, "userId": "local-admin", "displayName": "Local Admin", "email": "admin@skillhub.local", "role": "OWNER", "createdAt": "...", "updatedAt": "..." } ] } }二、人工测试
1. UI 验证
make dev-all或跳过 scanner 见下方)admin/ChangeMe!20262. 回归测试
三、冒烟测试(5 分钟快速验证)
基于 Local Development Setup 官方文档:
通过标准:
make dev-all成功displayName和email字段http://localhost:3000可访问make test-backend-app通过make typecheck-web无错误