diff --git a/crates/df-ideas/src/capture.rs b/crates/df-ideas/src/capture.rs index f7810cb..b496daf 100644 --- a/crates/df-ideas/src/capture.rs +++ b/crates/df-ideas/src/capture.rs @@ -1,26 +1,9 @@ -//! 想法捕获 — 快速记录与管理 +//! 想法实体与评分类型 — 供 scoring/adversarial/promotion 共享 use serde::{Deserialize, Serialize}; use df_core::types::{IdeaId, Priority}; -/// 捕获一个新想法的输入 -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct CaptureInput { - /// 标题 - pub title: String, - /// 详细描述 - pub description: String, - /// 优先级 - #[serde(default)] - pub priority: Priority, - /// 标签 - #[serde(default)] - pub tags: Vec, - /// 来源(如 "用户输入"、"AI 生成"、"会议记录") - pub source: Option, -} - /// 想法实体 #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Idea { @@ -60,39 +43,3 @@ pub struct IdeaScores { /// 综合评分 (加权平均) pub overall: f64, } - -/// 想法捕获器 -pub struct IdeaCapture; - -impl IdeaCapture { - /// 捕获一个新想法 - /// - /// TODO: 接入存储层持久化 - pub fn capture(input: CaptureInput) -> Idea { - let now = chrono::Utc::now(); - Idea { - id: df_core::types::new_id(), - title: input.title, - description: input.description, - status: df_core::types::IdeaStatus::Draft, - priority: input.priority, - scores: None, - tags: input.tags, - source: input.source, - related_ids: Vec::new(), - created_at: now, - updated_at: now, - } - } - - /// 快速捕获(仅标题) - pub fn quick_capture(title: String) -> Idea { - Self::capture(CaptureInput { - title, - description: String::new(), - priority: Priority::default(), - tags: Vec::new(), - source: None, - }) - } -} diff --git a/src-tauri/src/commands/idea.rs b/src-tauri/src/commands/idea.rs index 1a25e15..efa5305 100644 --- a/src-tauri/src/commands/idea.rs +++ b/src-tauri/src/commands/idea.rs @@ -146,7 +146,7 @@ pub async fn promote_idea( if let Err(e) = state.ideas.update_full(&updated).await { // 回写失败:补偿删除已建项目,避免悬空项目(idea.promoted_to 仍空,可重试立项) tracing::error!("想法 {id} 回写失败,补偿删除已建项目 {project_id}: {e}"); - if let Err(del_err) = state.projects.delete(&project_id).await { + if let Err(del_err) = state.projects.purge_with_descendants(&project_id).await { tracing::error!("补偿删除项目 {project_id} 也失败(需人工清理): {del_err}"); } return Err(format!("想法立项回写失败(已回滚项目创建): {}", e));