mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-08-16 00:21:55 +02:00
Return a delete count from the delete-all response helpers
`response delete` had to run its own list first just to report how many it removed, which duplicated the query the helper already does. Both helpers now return the count instead. `cmd_delete_all_http_responses` was returning the helper's value directly, so it keeps its `()` result explicitly and the frontend contract is unchanged.
This commit is contained in:
@@ -117,13 +117,8 @@ fn delete(ctx: &CliContext, id: &str, yes: bool) -> CommandResult {
|
||||
println!("Aborted");
|
||||
return Ok(());
|
||||
}
|
||||
// The delete helpers return no count, so take one first to report honestly.
|
||||
let count = ctx
|
||||
.db()
|
||||
.list_http_responses_for_request(id, None)
|
||||
.map_err(|e| format!("Failed to list responses: {e}"))?
|
||||
.len();
|
||||
ctx.db()
|
||||
.delete_all_http_responses_for_request(id, &UpdateSource::Sync)
|
||||
.map_err(|e| format!("Failed to delete responses: {e}"))?;
|
||||
println!("Deleted {count} responses for request {id}");
|
||||
@@ -137,10 +132,6 @@ fn delete(ctx: &CliContext, id: &str, yes: bool) -> CommandResult {
|
||||
}
|
||||
let count = ctx
|
||||
.db()
|
||||
.list_http_responses(&workspace_id, None)
|
||||
.map_err(|e| format!("Failed to list responses: {e}"))?
|
||||
.len();
|
||||
ctx.db()
|
||||
.delete_all_http_responses_for_workspace(&workspace_id, &UpdateSource::Sync)
|
||||
.map_err(|e| format!("Failed to delete responses: {e}"))?;
|
||||
println!("Deleted {count} responses for workspace {workspace_id}");
|
||||
|
||||
Reference in New Issue
Block a user