Function acknowledge_alert

Source
pub async fn acknowledge_alert(
    pool: &Pool<MySql>,
    alert_id: i64,
    user_id: i64,
    notes: Option<&str>,
    update_status: bool,
) -> Result<AlertAcknowledgment>
Expand description

Acknowledges an alert by a specific user.

This function creates an acknowledgment record for the alert and optionally updates the alert status to ‘acknowledged’ if it’s currently ‘active’.

§Arguments

  • pool - Database connection pool for executing the query
  • alert_id - ID of the alert to acknowledge
  • user_id - ID of the user acknowledging the alert
  • notes - Optional notes about the acknowledgment
  • update_status - Whether to update the alert status to ‘acknowledged’

§Returns

  • Ok(AlertAcknowledgment) - Successfully created acknowledgment
  • Err(anyhow::Error) - Failed to acknowledge alert