Skip to content

feat(UI):refactor issue/mr list API#1189

Merged
benjamin-747 merged 1 commit into
gitmono-dev:mainfrom
benjamin-747:main
Jul 4, 2025
Merged

feat(UI):refactor issue/mr list API#1189
benjamin-747 merged 1 commit into
gitmono-dev:mainfrom
benjamin-747:main

Conversation

@benjamin-747

Copy link
Copy Markdown
Collaborator

No description provided.

@benjamin-747 benjamin-747 added this to the Web UI milestone Jul 3, 2025
@benjamin-747
benjamin-747 requested a review from genedna July 3, 2025 12:25
@benjamin-747 benjamin-747 self-assigned this Jul 3, 2025
@benjamin-747 benjamin-747 added the rust Pull requests that update Rust code label Jul 3, 2025
@benjamin-747 benjamin-747 added the ui label Jul 3, 2025
@vercel

vercel Bot commented Jul 3, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
mega ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 4, 2025 1:15am

@benjamin-747

Copy link
Copy Markdown
Collaborator Author

需要前端更新代码,忽略前端构建失败

@genedna
genedna requested a review from Copilot July 3, 2025 12:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 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 ListPayload model and shared api_common helpers 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) with combine_item_list, dynamic filters, and migrations to support item_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.

Comment thread vault/src/integration/vault_core.rs Outdated
let dir = common::config::mega_base().join("vault");
let key_path = dir.join(CORE_KEY_FILE);
println!("{:?}", key_path);
println!("{key_path:?}");

Copilot AI Jul 3, 2025

Copy link

Choose a reason for hiding this comment

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

Consider replacing println! with a logging macro like log::debug! so that debug output can be enabled or disabled via configuration.

Suggested change
println!("{key_path:?}");
log::debug!("{key_path:?}");

Copilot uses AI. Check for mistakes.
Comment thread mono/src/api/mr/mr_router.rs Outdated
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

Copilot AI Jul 3, 2025

Copy link

Choose a reason for hiding this comment

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

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.

Suggested change
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

Copilot uses AI. Check for mistakes.
Comment thread mono/src/api/api_common/mod.rs Outdated
payload: LabelUpdatePayload,
item_type: String,
) -> Result<Json<CommonResult<()>>, ApiError> {
let issue_storage = state.issue_stg();

Copilot AI Jul 3, 2025

Copy link

Choose a reason for hiding this comment

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

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().

Suggested change
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()));
};

Copilot uses AI. Check for mistakes.
Comment thread jupiter/src/storage/issue_storage.rs Outdated
&link,
&username,
Some(format!("{username} unassigned {to_remove:?}")),
ConvTypeEnum::Label,

Copilot AI Jul 3, 2025

Copy link

Choose a reason for hiding this comment

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

In modify_assignees, the unassignment conversation uses ConvTypeEnum::Label. It should use ConvTypeEnum::Assignee to correctly represent an assignee change.

Suggested change
ConvTypeEnum::Label,
ConvTypeEnum::Assignee,

Copilot uses AI. Check for mistakes.
@benjamin-747
benjamin-747 added this pull request to the merge queue Jul 4, 2025
Merged via the queue into gitmono-dev:main with commit d46ddd8 Jul 4, 2025
19 of 21 checks passed
yyk808 pushed a commit to yyk808/mega that referenced this pull request Jul 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rust Pull requests that update Rust code ui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants