feat(UI):refactor issue/mr list API#1189
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
需要前端更新代码,忽略前端构建失败 |
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the issue and merge request list APIs to use a unified payload and shared logic, adds endpoints for updating assignees, and restructures storage querying to support dynamic filters and sorting.
- Introduce a common
ListPayloadmodel and sharedapi_commonhelpers for labels and assignees. - Update TypeScript client and generated types for the new list response and assignees endpoints.
- Refactor Rust storage layers (
get_issue_list/get_mr_list) withcombine_item_list, dynamic filters, and migrations to supportitem_assignees.
Reviewed Changes
Copilot reviewed 30 out of 30 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| vault/src/integration/vault_core.rs | Simplified println! formatting and inlined return of config. |
| moon/packages/types/generated.ts | Added types for assignee updates, unified list response, and client methods. |
| mono/src/api/mr/mr_router.rs | Refactored MR router to use api_common and added assignees endpoint. |
| mono/src/api/issue/issue_router.rs | Refactored Issue router to use api_common and added assignees endpoint. |
| mono/src/api/api_common/{model.rs,mod.rs} | Created shared models and helpers for label and assignee updates. |
| jupiter/src/storage/stg_common/{query_build.rs,model.rs,item.rs} | New utilities for filtering, sorting, and combining item details. |
| jupiter/src/storage/{issue_storage.rs,mr_storage.rs} | Updated storage methods to use ListParams, dynamic queries, and combine logic. |
| jupiter/src/migration/m20250702_072055_add_item_assignees.rs | Added migration for item_assignees table and author column. |
| jupiter/callisto/src/{item_assignees.rs,sea_orm_active_enums.rs,entity_ext} | Extended SeaORM entities and enums to support assignees and relations. |
| let dir = common::config::mega_base().join("vault"); | ||
| let key_path = dir.join(CORE_KEY_FILE); | ||
| println!("{:?}", key_path); | ||
| println!("{key_path:?}"); |
There was a problem hiding this comment.
Consider replacing println! with a logging macro like log::debug! so that debug output can be enabled or disabled via configuration.
| println!("{key_path:?}"); | |
| log::debug!("{key_path:?}"); |
| Json(payload): Json<LabelUpdatePayload>, | ||
| ) -> Result<Json<CommonResult<()>>, ApiError> { | ||
| common_label_update(user, state, payload).await | ||
| api_common::common_label_update(user, state, payload, String::from("mr")).await |
There was a problem hiding this comment.
The common_label_update helper always uses state.issue_stg(). MR label updates should use mr_stg() instead, or separate MR-specific logic to avoid writing to the issue storage.
| api_common::common_label_update(user, state, payload, String::from("mr")).await | |
| api_common::common_label_update(user, state, payload, String::from("mr"), true).await |
| payload: LabelUpdatePayload, | ||
| item_type: String, | ||
| ) -> Result<Json<CommonResult<()>>, ApiError> { | ||
| let issue_storage = state.issue_stg(); |
There was a problem hiding this comment.
common_label_update unconditionally uses issue_stg(). To support both issues and MRs, this helper must either accept a storage selector or have separate code paths for mr_stg() and issue_stg().
| let issue_storage = state.issue_stg(); | |
| let storage = if item_type == "issue" { | |
| state.issue_stg() | |
| } else if item_type == "mr" { | |
| state.mr_stg() | |
| } else { | |
| return Err(ApiError::BadRequest("Invalid item_type".into())); | |
| }; |
| &link, | ||
| &username, | ||
| Some(format!("{username} unassigned {to_remove:?}")), | ||
| ConvTypeEnum::Label, |
There was a problem hiding this comment.
In modify_assignees, the unassignment conversation uses ConvTypeEnum::Label. It should use ConvTypeEnum::Assignee to correctly represent an assignee change.
| ConvTypeEnum::Label, | |
| ConvTypeEnum::Assignee, |
No description provided.