1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2024-12-27 22:18:51 +00:00

Add movies to export

This commit is contained in:
Pierre HUBERT 2020-07-14 07:48:05 +02:00
parent 49c98e902a
commit 1a7018b5e3
3 changed files with 9 additions and 1 deletions

View File

@ -4,6 +4,7 @@
use serde::Serialize;
use crate::api_data::comment_api::CommentAPI;
use crate::api_data::movie_api::MovieAPI;
use crate::api_data::post_api::PostAPI;
use crate::api_data::survey_response_api::SurveyResponseAPI;
use crate::api_data::user_info::APIUserInfo;
@ -20,6 +21,7 @@ pub struct AccountExportAPI {
comments: Vec<CommentAPI>,
likes: Vec<UserLikeAPI>,
survey_responses: Vec<SurveyResponseAPI>,
movies: Vec<MovieAPI>,
}
impl AccountExportAPI {
@ -32,6 +34,7 @@ impl AccountExportAPI {
comments: CommentAPI::for_list(&export.comments, &curr_user_id.as_option())?,
likes: UserLikeAPI::for_list(&export.likes),
survey_responses: SurveyResponseAPI::for_list(&export.survey_responses),
movies: MovieAPI::for_list(&export.movies),
};
Ok(export)

View File

@ -7,6 +7,7 @@ use crate::data::post::Post;
use crate::data::survey_response::SurveyResponse;
use crate::data::user::User;
use crate::data::user_like::UserLike;
use crate::data::movie::Movie;
pub struct AccountExport {
pub user: User,
@ -14,4 +15,5 @@ pub struct AccountExport {
pub comments: Vec<Comment>,
pub likes: Vec<UserLike>,
pub survey_responses: Vec<SurveyResponse>,
pub movies: Vec<Movie>,
}

View File

@ -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};
use crate::helpers::{comments_helper, database, likes_helper, posts_helper, survey_helper, user_helper, movies_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};
@ -199,6 +199,9 @@ pub fn export(user_id: &UserID) -> ResultBoxError<AccountExport> {
comments: comments_helper::export_all_user(user_id)?,
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)?,
//TODO : add other fields
};
Ok(data)