mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2025-01-14 22:47:44 +00:00
Can delete all the conversation messages of a user
This commit is contained in:
parent
64b9497cc5
commit
99db58bde2
@ -321,6 +321,9 @@ pub fn delete(user_id: &UserID) -> ResultBoxError {
|
|||||||
// Delete all user movies
|
// Delete all user movies
|
||||||
movies_helper::delete_all_user(user_id)?;
|
movies_helper::delete_all_user(user_id)?;
|
||||||
|
|
||||||
|
// Delete all conversation messages
|
||||||
|
conversations_helper::delete_all_user_messages(user_id)?;
|
||||||
|
|
||||||
// TODO : continue work here
|
// TODO : continue work here
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -260,6 +260,15 @@ pub fn export_all_user_messages(user_id: &UserID) -> ResultBoxError<Vec<Conversa
|
|||||||
.exec(db_to_conversation_message)
|
.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
|
/// Get the entire list of messages of a given conversation
|
||||||
pub fn get_all_messages(conv_id: u64) -> ResultBoxError<Vec<ConversationMessage>> {
|
pub fn get_all_messages(conv_id: u64) -> ResultBoxError<Vec<ConversationMessage>> {
|
||||||
database::QueryInfo::new(CONV_MESSAGES_TABLE)
|
database::QueryInfo::new(CONV_MESSAGES_TABLE)
|
||||||
|
Loading…
Reference in New Issue
Block a user