pub async fn update_alert_status(
pool: &Pool<MySql>,
id: i64,
new_status: &str,
user_id: Option<i64>,
notes: Option<&str>,
) -> Result<Alert>
Expand description
Updates the status of an alert.
This function changes the status of an alert and records the change in the alert history table. It can mark alerts as acknowledged, resolved, or auto-resolved based on system or user actions.
§Arguments
pool
- Database connection pool for executing the queryid
- Unique identifier of the alert to updatenew_status
- New status for the alert (active, acknowledged, resolved, auto_resolved)user_id
- Optional ID of the user who performed the actionnotes
- Optional notes about the status change
§Returns
Ok(Alert)
- Successfully updated alertErr(anyhow::Error)
- Failed to update alert