mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2025-06-22 01:15:16 +00:00
Continue to deprecate old movie system
This commit is contained in:
@ -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 {
|
||||
|
Reference in New Issue
Block a user