mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2025-06-21 00:45:18 +00:00
Return the number of friends of a user
This commit is contained in:
@ -15,4 +15,12 @@ pub fn are_friend(user_one: UserID, user_two: UserID) -> ResultBoxError<bool> {
|
||||
.cond_i64("ID_personne", user_one)
|
||||
.cond_i64("ID_amis", user_two)
|
||||
.cond_i64("actif", 1))? > 0)
|
||||
}
|
||||
|
||||
/// Count the number of friends of a user
|
||||
pub fn count_friends(user_id: UserID) -> ResultBoxError<usize> {
|
||||
QueryInfo::new(FRIENDS_TABLE)
|
||||
.cond_i64("ID_amis", user_id)
|
||||
.cond_u32("actif", 1)
|
||||
.exec_count()
|
||||
}
|
Reference in New Issue
Block a user