feat(milestones): add POST /api/milestones endpoint and resolve collapsible_if warnings (TD-fc685b13-d9c2-4a57-ac4d-5228a71a2ec0)
This commit is contained in:
1 parent
8f924b793a
commit
d792b50343
6 files changed
+47
-31
No files matched your search
@@ -355,6 +355,25 @@ pub fn create_router(app_state: Arc<AppState>) -> Router {
|
||||
let json = state_clone.project.milestones.read_with(|items| serde_json::to_string(items).unwrap_or_else(|_| "[]".to_string()));
|
||||
([(axum::http::header::CONTENT_TYPE, "application/json")], json)
|
||||
}
|
||||
})
|
||||
.post({
|
||||
let state_clone = app_state.handler.state.clone();
|
||||
move |axum::Json(payload): axum::Json<serde_json::Value>| async move {
|
||||
use crate::router::McpTool;
|
||||
let handler = crate::handlers::tasks::MilestonesHandler;
|
||||
match handler.execute(payload, state_clone).await {
|
||||
Ok(msg) => (
|
||||
axum::http::StatusCode::OK,
|
||||
axum::Json(serde_json::json!({ "status": "success", "message": msg })),
|
||||
)
|
||||
.into_response(),
|
||||
Err(e) => (
|
||||
axum::http::StatusCode::BAD_REQUEST,
|
||||
axum::Json(serde_json::json!({ "status": "error", "message": e.to_string() })),
|
||||
)
|
||||
.into_response(),
|
||||
}
|
||||
}
|
||||
}),
|
||||
)
|
||||
.route(
|
||||
|
||||
Reference in new issue
Block a user