mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2025-06-21 00:45:18 +00:00
Export all conversation messages
This commit is contained in:
@ -6,7 +6,7 @@ use crate::data::error::{ExecError, ResultBoxError};
|
||||
use crate::data::new_account::NewAccount;
|
||||
use crate::data::user::UserID;
|
||||
use crate::data::user_token::UserAccessToken;
|
||||
use crate::helpers::{comments_helper, database, likes_helper, posts_helper, survey_helper, user_helper, movies_helper};
|
||||
use crate::helpers::{comments_helper, conversations_helper, database, likes_helper, movies_helper, posts_helper, survey_helper, user_helper};
|
||||
use crate::helpers::database::{DeleteQuery, InsertQuery, QueryInfo};
|
||||
use crate::utils::crypt_utils::{crypt_pass, rand_str};
|
||||
use crate::utils::date_utils::{mysql_date, time};
|
||||
@ -200,6 +200,7 @@ pub fn export(user_id: &UserID) -> ResultBoxError<AccountExport> {
|
||||
likes: likes_helper::export_all_user(user_id)?,
|
||||
survey_responses: survey_helper::export_all_user_responses(user_id)?,
|
||||
movies: movies_helper::get_list_user(user_id)?,
|
||||
all_conversation_messages: conversations_helper::export_all_user_messages(user_id)?,
|
||||
|
||||
//TODO : add other fields
|
||||
};
|
||||
|
@ -253,6 +253,13 @@ pub fn get_user_messages_for_conversations(conv_id: u64, user_id: &UserID) -> Re
|
||||
.exec(db_to_conversation_message)
|
||||
}
|
||||
|
||||
/// Export all the messages of a given user on all conversations
|
||||
pub fn export_all_user_messages(user_id: &UserID) -> ResultBoxError<Vec<ConversationMessage>> {
|
||||
database::QueryInfo::new(CONV_MESSAGES_TABLE)
|
||||
.cond_user_id("user_id", user_id)
|
||||
.exec(db_to_conversation_message)
|
||||
}
|
||||
|
||||
/// 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)
|
||||
|
Reference in New Issue
Block a user