mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2024-11-22 13:29:21 +00:00
Delete all forez presence of a group when deleting a group
This commit is contained in:
parent
36ecabb729
commit
c177c2c2f6
@ -31,6 +31,13 @@ pub fn delete_all_user(user_id: &UserID) -> Res {
|
||||
.exec()
|
||||
}
|
||||
|
||||
/// Delete all the presences of a given group
|
||||
pub fn delete_all_group(group_id: &GroupID) -> Res {
|
||||
database::DeleteQuery::new(FOREZ_PRESENCE_TABLE)
|
||||
.cond_group_id("group_id", group_id)
|
||||
.exec()
|
||||
}
|
||||
|
||||
/// Update the presences of a user
|
||||
pub fn update(group_id: &GroupID, user_id: &UserID, list: Vec<Presence>) -> Res {
|
||||
let previous_presences = get_user_presences(group_id, user_id)?;
|
||||
|
@ -9,7 +9,7 @@ use crate::data::group_id::GroupID;
|
||||
use crate::data::group_member::{GroupMember, GroupMembershipLevel};
|
||||
use crate::data::new_group::NewGroup;
|
||||
use crate::data::user::UserID;
|
||||
use crate::helpers::{conversations_helper, database, likes_helper, notifications_helper, posts_helper};
|
||||
use crate::helpers::{conversations_helper, database, forez_presence_helper, likes_helper, notifications_helper, posts_helper};
|
||||
use crate::helpers::likes_helper::LikeType;
|
||||
use crate::utils::date_utils::time;
|
||||
|
||||
@ -505,6 +505,9 @@ pub fn delete(group_id: &GroupID) -> ResultBoxError {
|
||||
// Delete all conversations related with the group
|
||||
conversations_helper::delete_all_group_conversations(group_id)?;
|
||||
|
||||
// Delete all Forez presences related with the group
|
||||
forez_presence_helper::delete_all_group(group_id)?;
|
||||
|
||||
// Delete all group members
|
||||
database::DeleteQuery::new(GROUPS_MEMBERS_TABLE)
|
||||
.cond_group_id("groups_id", group_id)
|
||||
|
Loading…
Reference in New Issue
Block a user