1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-01-14 14:37:44 +00:00

Can delete all the conversation messages of a user

This commit is contained in:
Pierre HUBERT 2021-01-21 18:36:53 +01:00
parent 64b9497cc5
commit 99db58bde2
2 changed files with 12 additions and 0 deletions

View File

@ -321,6 +321,9 @@ pub fn delete(user_id: &UserID) -> ResultBoxError {
// Delete all user movies
movies_helper::delete_all_user(user_id)?;
// Delete all conversation messages
conversations_helper::delete_all_user_messages(user_id)?;
// TODO : continue work here
Ok(())

View File

@ -260,6 +260,15 @@ pub fn export_all_user_messages(user_id: &UserID) -> ResultBoxError<Vec<Conversa
.exec(db_to_conversation_message)
}
/// Delete all the messages of a given user
pub fn delete_all_user_messages(user_id: &UserID) -> ResultBoxError {
for msg in &export_all_user_messages(user_id)? {
delete_message(msg)?;
}
Ok(())
}
/// Get the entire list of messages of a given conversation
pub fn get_all_messages(conv_id: u64) -> ResultBoxError<Vec<ConversationMessage>> {
database::QueryInfo::new(CONV_MESSAGES_TABLE)