pub async fn count_alerts(
pool: &Pool<MySql>,
status: Option<&str>,
severity: Option<&str>,
org_id: Option<i64>,
app_id: Option<i64>,
) -> Result<i64>
Expand description
Counts the total number of alerts in the database with optional filtering.
This function retrieves the total count of alerts that match the provided filter criteria, which is useful for pagination and reporting purposes.
§Arguments
pool
- Database connection pool for executing the querystatus
- Optional filter for alert statusseverity
- Optional filter for alert severityorg_id
- Optional filter for organization IDapp_id
- Optional filter for application ID
§Returns
Ok(i64)
- Successfully retrieved count of alertsErr(anyhow::Error)
- Failed to count alerts