1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2024-11-26 07:19:22 +00:00

Continue to deprecate old movie system

This commit is contained in:
Pierre HUBERT 2021-02-13 11:26:06 +01:00
parent 3a22c89b87
commit 9949f1dccf
3 changed files with 0 additions and 32 deletions

View File

@ -22,7 +22,6 @@ pub mod global_search_result;
pub mod friend;
pub mod friendship_status;
pub mod post;
pub mod movie;
pub mod survey;
pub mod comment;
pub mod new_survey;

View File

@ -1,14 +0,0 @@
//! # Movie information
//!
//! @author Pierre Hubert
use crate::data::user::UserID;
pub struct Movie {
pub id: u64,
pub user_id: UserID,
pub name: String,
pub uri: String,
pub file_type: String,
pub size: usize,
}

View File

@ -8,7 +8,6 @@ use crate::constants::database_tables_names::POSTS_TABLE;
use crate::data::error::{ExecError, ResultBoxError};
use crate::data::group_id::GroupID;
use crate::data::group_member::GroupMembershipLevel;
use crate::data::movie::Movie;
use crate::data::post::{Post, PostAccessLevel, PostFile, PostKind, PostPageKind, PostVisibilityLevel, PostWebLink};
use crate::data::post::PostKind::{POST_KIND_COUNTDOWN, POST_KIND_IMAGE, POST_KIND_PDF, POST_KIND_SURVEY, POST_KIND_WEBLINK, POST_KIND_YOUTUBE};
use crate::data::user::UserID;
@ -470,22 +469,6 @@ pub fn delete_all_user(user_id: &UserID) -> ResultBoxError {
Ok(())
}
/// Get all the posts that use of movie
pub fn get_posts_for_movie(m: &Movie) -> ResultBoxError<Vec<Post>> {
database::QueryInfo::new(POSTS_TABLE)
.cond_u64("idvideo", m.id)
.exec(db_to_post)
}
/// Delete all the posts associated with a movie
pub fn delete_all_with_movie(m: &Movie) -> ResultBoxError {
for post in get_posts_for_movie(m)? {
delete(&post)?;
}
Ok(())
}
/// Turn a post into a database entry
fn db_to_post(res: &database::RowResult) -> ResultBoxError<Post> {
let user_id = if res.get_u64("ID_amis")? == 0 {