优化: 工程实体化(description/stack/status)+ 概览工程列表
- project_modules 加 description/status 列(V40 迁移,stack V34 已有)+ models/repo/INSERT/UPDATE/SELECT 映射 - FileExplorer 工程 CRUD 弹窗加 description(textarea)/stack(input)/status(select)输入,工程有完整身份 - ProjectDetail 概览工程列表升级:name+status badge+path + description 段(2行省略)+ stack tag - 老工程兼容(None=active),update 部分更新语义,status 归一(active/archived)
This commit is contained in:
@@ -35,6 +35,8 @@ fn project_module_from_row(row: &Row<'_>) -> std::result::Result<ProjectModuleRe
|
||||
sort_order: row.get("sort_order")?,
|
||||
created_at: row.get("created_at")?,
|
||||
updated_at: row.get("updated_at")?,
|
||||
description: row.get("description")?,
|
||||
status: row.get("status")?,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -71,12 +73,13 @@ impl ProjectModuleRepo {
|
||||
let affected = conn
|
||||
.execute(
|
||||
"INSERT INTO project_modules \
|
||||
(id, project_id, name, path, git_url, stack, auto_detected, sort_order, created_at, updated_at) \
|
||||
VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10)",
|
||||
(id, project_id, name, path, git_url, stack, auto_detected, sort_order, created_at, updated_at, description, status) \
|
||||
VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12)",
|
||||
params![
|
||||
r.id, r.project_id, r.name, r.path,
|
||||
r.git_url, r.stack, r.auto_detected, r.sort_order,
|
||||
r.created_at, r.updated_at,
|
||||
r.description, r.status,
|
||||
],
|
||||
)
|
||||
.map_err(storage_err)?;
|
||||
@@ -116,7 +119,7 @@ impl ProjectModuleRepo {
|
||||
let guard = conn.blocking_lock();
|
||||
let mut stmt = guard
|
||||
.prepare(
|
||||
"SELECT id, project_id, name, path, git_url, stack, auto_detected, sort_order, created_at, updated_at \
|
||||
"SELECT id, project_id, name, path, git_url, stack, auto_detected, sort_order, created_at, updated_at, description, status \
|
||||
FROM project_modules WHERE project_id = ?1 ORDER BY sort_order ASC",
|
||||
)
|
||||
.map_err(storage_err)?;
|
||||
@@ -147,12 +150,15 @@ impl ProjectModuleRepo {
|
||||
.execute(
|
||||
"UPDATE project_modules SET \
|
||||
project_id = ?1, name = ?2, path = ?3, git_url = ?4, stack = ?5, \
|
||||
auto_detected = ?6, sort_order = ?7, updated_at = ?8 \
|
||||
WHERE id = ?9",
|
||||
auto_detected = ?6, sort_order = ?7, updated_at = ?8, \
|
||||
description = ?9, status = ?10 \
|
||||
WHERE id = ?11",
|
||||
params![
|
||||
r.project_id, r.name, r.path,
|
||||
r.git_url, r.stack, r.auto_detected, r.sort_order,
|
||||
r.updated_at, r.id,
|
||||
r.updated_at,
|
||||
r.description, r.status,
|
||||
r.id,
|
||||
],
|
||||
)
|
||||
.map_err(storage_err)?;
|
||||
@@ -239,6 +245,8 @@ mod tests {
|
||||
sort_order: 0,
|
||||
created_at: "0".to_string(),
|
||||
updated_at: "0".to_string(),
|
||||
description: None,
|
||||
status: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user