pub async fn get_alerts_needing_escalation(
pool: &Pool<MySql>,
org_id: Option<i64>,
hours_threshold: i64,
) -> Result<Vec<Alert>>Expand description
Retrieves alerts that need escalation based on age and status.
This function identifies alerts that have been active for longer than a specified threshold period without being acknowledged or resolved, which may indicate they need to be escalated to ensure appropriate attention.
§Arguments
pool- Database connection pool for executing the queryorg_id- Optional organization ID to filter alertshours_threshold- Age in hours after which an alert should be considered for escalation
§Returns
Ok(Vec<Alert>)- List of alerts needing escalationErr(anyhow::Error)- Failed to fetch alerts