destroy verb: CLI + admin socket + dashboard button; purges state + approvals
This commit is contained in:
parent
c7b50aa5b7
commit
b711296460
8 changed files with 92 additions and 4 deletions
|
|
@ -132,6 +132,18 @@ impl Approvals {
|
|||
)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Mark every pending approval for `agent` as failed (returns rows affected).
|
||||
/// Used by `destroy` to clear the queue of an agent that no longer exists.
|
||||
pub fn fail_pending_for_agent(&self, agent: &str, note: &str) -> Result<usize> {
|
||||
let conn = self.conn.lock().unwrap();
|
||||
let n = conn.execute(
|
||||
"UPDATE approvals SET status = 'failed', resolved_at = ?1, note = ?2
|
||||
WHERE agent = ?3 AND status = 'pending'",
|
||||
params![now_unix(), note, agent],
|
||||
)?;
|
||||
Ok(n)
|
||||
}
|
||||
}
|
||||
|
||||
fn row_to_approval(row: &rusqlite::Row<'_>) -> rusqlite::Result<Approval> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue