//! # Notifications helper //! //! @author Pierre Hubert use crate::constants::database_tables_names::NOTIFICATIONS_TABLE; use crate::data::error::ResultBoxError; use crate::data::user::UserID; use crate::helpers::database; /// Count the number of unread notifications pub fn count_unread(user_id: &UserID) -> ResultBoxError { database::QueryInfo::new(NOTIFICATIONS_TABLE) .cond_user_id("dest_user_id", user_id) .cond_legacy_bool("seen", false) .exec_count() .map(|c| c as u64) }