新增: 灵感软删除回收站+雷达图正名(父⑤)

- IDEA-FIX-01: ideas 软删除(对标 tasks V14)— V28 迁移 deleted_at(幂等 ALTER) + IdeaRepo soft_delete/restore/list_deleted + list_by_query 恒带 deleted_at IS NULL(防回收站泄漏) + delete_idea 改软删 + restore_idea/list_deleted_ideas IPC + IdeaRecord 不加字段(纯 SQL WHERE 过滤)
- IDEA-FIX-14: 雷达图 CSS class radar→score-bar(IdeaDetail/ProjectDetail 2 文件 template+style+注释,纯正名零行为变更)
- 6 新测试(soft_delete 标记+过滤/幂等/missing, restore 还原/仅已删, list_deleted 排序);df-storage 73 测试过
This commit is contained in:
2026-06-26 20:42:48 +08:00
parent 308775cf4d
commit 005079f762
7 changed files with 230 additions and 37 deletions

View File

@@ -122,10 +122,22 @@ pub async fn update_idea(
.map_err(err_str)
}
/// 删除灵感
/// 删除灵感(软删 → 回收站,可恢复)。对标 delete_task(SET deleted_at=now)。
#[tauri::command]
pub async fn delete_idea(state: State<'_, AppState>, id: String) -> Result<bool, String> {
state.ideas.delete(&id).await.map_err(err_str)
state.ideas.soft_delete(&id).await.map_err(err_str)
}
/// 恢复灵感(从回收站还原,清 deleted_at)。对标 restore_task / restore_project。
#[tauri::command]
pub async fn restore_idea(state: State<'_, AppState>, id: String) -> Result<bool, String> {
state.ideas.restore(&id).await.map_err(err_str)
}
/// 列出回收站灵感(deleted_at IS NOT NULL,按更新时间降序)。对标 list_deleted_projects。
#[tauri::command]
pub async fn list_deleted_ideas(state: State<'_, AppState>) -> Result<Vec<IdeaRecord>, String> {
state.ideas.list_deleted().await.map_err(err_str)
}
/// 将灵感晋升为项目 — 复用 df-project 领域逻辑创建项目,回写灵感 status=promoted/promoted_to

View File

@@ -260,6 +260,8 @@ pub fn run() {
commands::idea::create_idea,
commands::idea::update_idea,
commands::idea::delete_idea,
commands::idea::restore_idea,
commands::idea::list_deleted_ideas,
commands::idea::evaluate_idea,
commands::idea::list_idea_evaluations,
commands::idea::promote_idea,