修复: status→enum + type alias(SMELL-P1-6)
This commit is contained in:
@@ -6,7 +6,7 @@ use serde::Deserialize;
|
||||
use tauri::State;
|
||||
|
||||
use df_ai::provider::LlmProvider;
|
||||
use df_types::types::{new_id, Priority};
|
||||
use df_types::types::{new_id, IdeaStatus, Priority, ProjectStatus};
|
||||
use df_ideas::capture::Idea;
|
||||
use df_storage::crud::{is_unique_constraint_err, IdeaQuery};
|
||||
use df_storage::models::{IdeaEvaluationRecord, IdeaRecord, ProjectEventRecord, ProjectRecord};
|
||||
@@ -87,7 +87,7 @@ pub async fn create_idea(
|
||||
id: new_id(),
|
||||
title: input.title,
|
||||
description: input.description,
|
||||
status: "draft".to_string(),
|
||||
status: IdeaStatus::Draft,
|
||||
priority: input.priority,
|
||||
score: None,
|
||||
tags: input.tags,
|
||||
@@ -190,7 +190,7 @@ pub async fn promote_idea(
|
||||
id: project_id.clone(),
|
||||
name: project.name,
|
||||
description: project.description,
|
||||
status: "planning".to_string(),
|
||||
status: ProjectStatus::Planning,
|
||||
idea_id: Some(id.clone()),
|
||||
path: None,
|
||||
stack: None,
|
||||
@@ -208,7 +208,7 @@ pub async fn promote_idea(
|
||||
// 灵感状态未变的数据不一致)。Repository 方法各自持锁不支持跨 repo 共享事务对象,故选补偿
|
||||
// 删除而非真事务(改动最小,工程投入产出比最高)。
|
||||
let updated = IdeaRecord {
|
||||
status: "promoted".to_string(),
|
||||
status: IdeaStatus::Promoted,
|
||||
promoted_to: Some(project_id.clone()),
|
||||
updated_at: now,
|
||||
..record
|
||||
@@ -338,7 +338,7 @@ pub async fn evaluate_idea(
|
||||
scores: Some(scores_json.clone()),
|
||||
ai_analysis: Some(ai_analysis.clone()),
|
||||
score: Some(score_value as f64),
|
||||
status: "pending_review".to_string(),
|
||||
status: IdeaStatus::PendingReview,
|
||||
updated_at: now_millis(),
|
||||
..record
|
||||
};
|
||||
@@ -460,7 +460,7 @@ fn record_to_idea(record: &IdeaRecord) -> Idea {
|
||||
title: record.title.clone(),
|
||||
description: record.description.clone(),
|
||||
// IDEA-FIX-05: 读真实 status(原硬编码 Draft 丢真实状态,评估上下文完整性)
|
||||
status: status_from_str(&record.status),
|
||||
status: status_from_str(record.status.as_str()),
|
||||
priority: priority_from_i32(record.priority),
|
||||
scores: None,
|
||||
tags,
|
||||
|
||||
Reference in New Issue
Block a user