1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-06-21 00:45:18 +00:00

Can send friendship request

This commit is contained in:
2020-06-30 10:06:53 +02:00
parent 91d12bb061
commit baf568142d
3 changed files with 37 additions and 1 deletions

View File

@ -61,7 +61,16 @@ fn get_list(friend_query: &GetFriendsQuery) -> ResultBoxError<Vec<Friend>> {
query.exec(db_to_friend)
}
/// Check out wheterher a user has sent a request to another user
/// Send a new friendship request
pub fn send_request(user_id: &UserID, target_user: &UserID) -> ResultBoxError {
database::InsertQuery::new(FRIENDS_TABLE)
.add_user_id("ID_personne", target_user)
.add_user_id("ID_amis", user_id)
.add_legacy_bool("actif", false)
.insert_drop_result()
}
/// Check out whether a user has sent a request to another user
pub fn sent_request(user_id: &UserID, target_user: &UserID) -> ResultBoxError<bool> {
database::QueryInfo::new(FRIENDS_TABLE)
.cond_user_id("ID_personne", target_user)