mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2025-06-21 00:45:18 +00:00
Add the method /notifications/count_all_news
This commit is contained in:
@ -238,6 +238,15 @@ pub fn get_status(user_id: &UserID, friend_id: &UserID) -> ResultBoxError<Friend
|
||||
Ok(status)
|
||||
}
|
||||
|
||||
/// Count the number of friendship requests of a user
|
||||
pub fn count_requests(user_id: &UserID) -> ResultBoxError<u64> {
|
||||
database::QueryInfo::new(FRIENDS_TABLE)
|
||||
.cond_user_id("ID_personne", user_id)
|
||||
.cond_legacy_bool("actif", false)
|
||||
.exec_count()
|
||||
.map(|r| r as u64)
|
||||
}
|
||||
|
||||
/// Turn a database entry into a Friend structure
|
||||
fn db_to_friend(row: &database::RowResult) -> ResultBoxError<Friend> {
|
||||
Ok(Friend {
|
||||
|
Reference in New Issue
Block a user