feat(user): 优化getInfo接口,添加用户部门、岗位和角色信息,更新相关接口和组件#729
Merged
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (12)
📝 WalkthroughWalkthrough该 PR 在后端新增用户部门、岗位、角色的结构化返回能力,并在前端强化了对空值用户信息的访问容错。后端通过 PassportService 格式化方法集中处理数据映射;前端统一了 TypeScript 类型定义,存储与组件普遍采用可选链与计算属性来避免运行时异常。 Changes用户信息充实与空安全性重构
Sequence Diagram(s)sequenceDiagram
participant Client as 前端组件
participant Store as useUserStore
participant API as /admin/passport/getInfo
participant Service as PassportService
participant DB as 数据库
Client->>Store: getUserInfo()
Store->>API: useHttp().get()
API->>Service: formatUserInfo(user)
Service->>DB: 加载 user.department/position/roles
DB-->>Service: 关联数据集合
Service->>Service: 映射字段、过滤排序
Service-->>API: 返回含 departments/positions/roles 的数组
API-->>Store: ResponseStruct<UserInfo>
Store-->>Client: userInfo | null
Client->>Client: computed(()=>getUserInfo())
Client->>Client: 可选链与空值合并安全渲染
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested labels
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Summary by CodeRabbit
新功能
缺陷修复