pub async fn add_alert_history(
pool: &Pool<MySql>,
alert_id: i64,
action: &str,
performed_by: Option<i64>,
notes: Option<&str>,
previous_state: Option<Value>,
new_state: Option<Value>,
) -> Result<AlertHistory>
Expand description
Adds a custom history entry for an alert.
This function allows adding arbitrary history records for an alert, which is useful for tracking manual interventions or system actions that don’t fit into predefined categories.
§Arguments
pool
- Database connection pool for executing the queryalert_id
- ID of the alertaction
- Description of the action being recordedperformed_by
- Optional ID of the user who performed the actionnotes
- Optional notes about the actionprevious_state
- Optional JSON data representing the state before the actionnew_state
- Optional JSON data representing the state after the action
§Returns
Ok(AlertHistory)
- Successfully created history recordErr(anyhow::Error)
- Failed to create history record