Function count_unread_user_notifications

Source
pub async fn count_unread_user_notifications(
    pool: &Pool<MySql>,
    user_id: i64,
) -> Result<i64>
Expand description

Counts unread notifications for a user.

This function retrieves the count of unread notifications for a specific user, which is useful for displaying notification badges or alerts.

§Arguments

  • pool - Database connection pool for executing the query
  • user_id - ID of the user whose unread notifications to count

§Returns

  • Ok(i64) - Successfully retrieved count of unread notifications
  • Err(anyhow::Error) - Failed to count notifications