From 264dc75b2c91778016131d2c1fedb6bc2dcd63c3 Mon Sep 17 00:00:00 2001 From: iven Date: Fri, 3 Apr 2026 21:41:30 +0800 Subject: [PATCH] =?UTF-8?q?fix(production-readiness):=20audit=20fixes=20?= =?UTF-8?q?=E2=80=94=20duplicate=20useState=20+=20route=20mismatch=20+=20s?= =?UTF-8?q?tale=20@reserved?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ChatArea.tsx: remove duplicate useState(searchOpen) declaration on line 70 - scheduled_task/mod.rs: fix route from /api/scheduler/tasks to /api/v1/scheduler/tasks (matches admin-v2 service baseURL pattern and all other modules) - scheduled_task/handlers.rs: remove @reserved annotations (now has Admin V2 frontend) - scheduled_task/handlers.rs: update doc comments with correct /api/v1/ paths --- .../zclaw-saas/src/scheduled_task/handlers.rs | 20 +++++++++---------- crates/zclaw-saas/src/scheduled_task/mod.rs | 4 ++-- desktop/src/components/ChatArea.tsx | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/crates/zclaw-saas/src/scheduled_task/handlers.rs b/crates/zclaw-saas/src/scheduled_task/handlers.rs index df3d53e..2ae752b 100644 --- a/crates/zclaw-saas/src/scheduled_task/handlers.rs +++ b/crates/zclaw-saas/src/scheduled_task/handlers.rs @@ -10,8 +10,8 @@ use crate::error::SaasResult; use crate::auth::types::AuthContext; use super::{types::*, service}; -/// POST /api/scheduler/tasks — 创建定时任务 -// @reserved - no frontend caller +/// POST /api/v1/scheduler/tasks — 创建定时任务 + pub async fn create_task( State(state): State, Extension(ctx): Extension, @@ -39,8 +39,8 @@ pub async fn create_task( Ok((StatusCode::CREATED, Json(resp))) } -/// GET /api/scheduler/tasks — 列出定时任务 -// @reserved - no frontend caller +/// GET /api/v1/scheduler/tasks — 列出定时任务 + pub async fn list_tasks( State(state): State, Extension(ctx): Extension, @@ -49,8 +49,8 @@ pub async fn list_tasks( Ok(Json(tasks)) } -/// GET /api/scheduler/tasks/:id — 获取单个定时任务 -// @reserved - no frontend caller +/// GET /api/v1/scheduler/tasks/:id — 获取单个定时任务 + pub async fn get_task( State(state): State, Extension(ctx): Extension, @@ -60,8 +60,8 @@ pub async fn get_task( Ok(Json(task)) } -/// PATCH /api/scheduler/tasks/:id — 更新定时任务 -// @reserved - no frontend caller +/// PATCH /api/v1/scheduler/tasks/:id — 更新定时任务 + pub async fn update_task( State(state): State, Extension(ctx): Extension, @@ -72,8 +72,8 @@ pub async fn update_task( Ok(Json(task)) } -/// DELETE /api/scheduler/tasks/:id — 删除定时任务 -// @reserved - no frontend caller +/// DELETE /api/v1/scheduler/tasks/:id — 删除定时任务 + pub async fn delete_task( State(state): State, Extension(ctx): Extension, diff --git a/crates/zclaw-saas/src/scheduled_task/mod.rs b/crates/zclaw-saas/src/scheduled_task/mod.rs index 606921e..f20a9fd 100644 --- a/crates/zclaw-saas/src/scheduled_task/mod.rs +++ b/crates/zclaw-saas/src/scheduled_task/mod.rs @@ -10,6 +10,6 @@ use crate::state::AppState; /// 定时任务路由 (需要认证) pub fn routes() -> axum::Router { axum::Router::new() - .route("/api/scheduler/tasks", get(handlers::list_tasks).post(handlers::create_task)) - .route("/api/scheduler/tasks/:id", get(handlers::get_task).patch(handlers::update_task).delete(handlers::delete_task)) + .route("/api/v1/scheduler/tasks", get(handlers::list_tasks).post(handlers::create_task)) + .route("/api/v1/scheduler/tasks/:id", get(handlers::get_task).patch(handlers::update_task).delete(handlers::delete_task)) } diff --git a/desktop/src/components/ChatArea.tsx b/desktop/src/components/ChatArea.tsx index f1c5e35..a182b84 100644 --- a/desktop/src/components/ChatArea.tsx +++ b/desktop/src/components/ChatArea.tsx @@ -67,7 +67,7 @@ export function ChatArea() { const [input, setInput] = useState(''); const [pendingFiles, setPendingFiles] = useState([]); - const [searchOpen, setSearchOpen] = useState(false); const [searchOpen, setSearchOpen] = useState(false); + const [searchOpen, setSearchOpen] = useState(false); const scrollRef = useRef(null); const textareaRef = useRef(null); const messageRefs = useRef>(new Map());