mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2025-07-15 19:58:05 +00:00
Deprecate old movies system
This commit is contained in:
@ -11,7 +11,6 @@ use crate::api_data::conversation_message_api::ConversationMessageAPI;
|
||||
use crate::api_data::entities_constructor::EntitiesConstructor;
|
||||
use crate::api_data::friend_api::FriendAPI;
|
||||
use crate::api_data::group_api::GroupApi;
|
||||
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;
|
||||
@ -32,7 +31,6 @@ pub struct AccountExportAPI {
|
||||
comments: Vec<CommentAPI>,
|
||||
likes: Vec<UserLikeAPI>,
|
||||
survey_responses: Vec<SurveyResponseAPI>,
|
||||
movies: Vec<MovieAPI>,
|
||||
all_conversation_messages: Vec<ConversationMessageAPI>,
|
||||
conversations_list: Vec<ConversationAPI>,
|
||||
conversations_messages: HashMap<u64, Vec<ConversationMessageAPI>>,
|
||||
@ -51,7 +49,6 @@ 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),
|
||||
all_conversation_messages: ConversationMessageAPI::for_list(&export.all_conversation_messages),
|
||||
conversations_list: ConversationAPI::for_list(&export.conversations),
|
||||
conversations_messages: export.conversation_messages
|
||||
|
@ -31,7 +31,6 @@ pub mod group_member_api;
|
||||
pub mod friend_api;
|
||||
pub mod friendship_status_api;
|
||||
pub mod post_api;
|
||||
pub mod movie_api;
|
||||
pub mod survey_choice_api;
|
||||
pub mod survey_api;
|
||||
pub mod comment_api;
|
||||
|
@ -1,38 +0,0 @@
|
||||
//! # Movie API information
|
||||
//!
|
||||
//! @author Pierre Hubert
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::data::movie::Movie;
|
||||
use crate::utils::user_data_utils::user_data_url;
|
||||
|
||||
#[derive(Serialize)]
|
||||
#[allow(non_snake_case)]
|
||||
pub struct MovieAPI {
|
||||
id: u64,
|
||||
uri: String,
|
||||
url: String,
|
||||
userID: u64,
|
||||
name: String,
|
||||
file_type: String,
|
||||
size: usize,
|
||||
}
|
||||
|
||||
impl MovieAPI {
|
||||
/// Construct a new instance of movie
|
||||
pub fn new(m: &Movie) -> MovieAPI {
|
||||
MovieAPI {
|
||||
id: m.id,
|
||||
uri: m.uri.clone(),
|
||||
url: user_data_url(m.uri.as_str()),
|
||||
userID: m.user_id.id(),
|
||||
name: m.name.clone(),
|
||||
file_type: m.file_type.clone(),
|
||||
size: m.size,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn for_list(l: &Vec<Movie>) -> Vec<MovieAPI> {
|
||||
l.iter().map(Self::new).collect()
|
||||
}
|
||||
}
|
@ -4,12 +4,11 @@
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::api_data::comment_api::CommentAPI;
|
||||
use crate::api_data::movie_api::MovieAPI;
|
||||
use crate::api_data::survey_api::SurveyAPI;
|
||||
use crate::data::error::ResultBoxError;
|
||||
use crate::data::post::{Post, PostKind};
|
||||
use crate::data::user::UserID;
|
||||
use crate::helpers::{comments_helper, likes_helper, movies_helper, posts_helper, survey_helper};
|
||||
use crate::helpers::{comments_helper, likes_helper, posts_helper, survey_helper};
|
||||
use crate::helpers::likes_helper::LikeType;
|
||||
use crate::utils::user_data_utils::user_data_url;
|
||||
|
||||
@ -38,10 +37,6 @@ pub struct PostAPI {
|
||||
link_description: Option<String>,
|
||||
link_image: Option<String>,
|
||||
|
||||
// Movie specific
|
||||
video_id: Option<u64>,
|
||||
video_info: Option<MovieAPI>,
|
||||
|
||||
// Countdown timer specific
|
||||
time_end: Option<u64>,
|
||||
|
||||
@ -82,10 +77,6 @@ impl PostAPI {
|
||||
link_description: None,
|
||||
link_image: None,
|
||||
|
||||
// Movie specific
|
||||
video_id: None,
|
||||
video_info: None,
|
||||
|
||||
// Countdown timer-specific
|
||||
time_end: None,
|
||||
|
||||
@ -120,11 +111,6 @@ impl PostAPI {
|
||||
post.link_image = link.image.clone();
|
||||
}
|
||||
|
||||
PostKind::POST_KIND_MOVIE(movie_id) => {
|
||||
post.video_id = Some(*movie_id);
|
||||
post.video_info = Some(MovieAPI::new(&movies_helper::get_info(*movie_id)?))
|
||||
}
|
||||
|
||||
PostKind::POST_KIND_COUNTDOWN(time_end) => post.time_end = Some(*time_end),
|
||||
|
||||
PostKind::POST_KIND_SURVEY =>
|
||||
|
Reference in New Issue
Block a user