feat: add delete_conversation and delete_project REST API endpoints#194
feat: add delete_conversation and delete_project REST API endpoints#194
Conversation
Fixes #193 - Delete discussion not working in web mode. Both delete_conversation and delete_project were available as Tauri commands (desktop mode) but had no corresponding Rocket route handlers in the web server, causing these operations to fail silently in web mode. Changes: - Import Rocket's delete macro for HTTP DELETE route support - Add DELETE /api/conversations/<chat_id> endpoint with URL decoding - Add POST /api/delete-project endpoint with DeleteProjectRequest struct - Register both new routes in the Rocket mount configuration
📝 WalkthroughWalkthroughTwo new API endpoints were added to enable conversation and project deletion via REST API. The DELETE /conversations/<chat_id> endpoint deletes conversations by ID, and the POST /delete-project endpoint removes projects using a project_id from the request body. Route registration was updated in the Rocket framework configuration. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Fixes #193 — Delete discussion not working in web mode.
Both
delete_conversationanddelete_projectwere available as Tauri commands (desktop mode) but had no corresponding Rocket route handlers in the web server, causing these operations to fail in web mode.Changes
Single file modified:
crates/server/src/main.rs(+33 lines, -1 line)deletemacro for HTTP DELETE route supportDELETE /api/conversations/<chat_id>endpoint with URL decoding (matchesapiClient.delete()inwebApi.ts)POST /api/delete-projectendpoint withDeleteProjectRequeststruct (matchesapiClient.post()inwebApi.ts)How It Was Broken
delete_conversationdelete_projectProjectDetail.tsxProjects.tsxapi.tsapi.tswebApi.ts(DELETE)webApi.ts(POST)backend/lib.rsbackend/lib.rscommands/mod.rscommands/mod.rsThe frontend, API interface, web API client, and backend logic all existed — only the Rocket HTTP route handlers were missing, breaking the bridge in web mode.
Verification
cargo build --workspace— ✅ cleancargo clippy --package server -- -D warnings— ✅ zero warningsSummary by CodeRabbit