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

Delete all posts of user

This commit is contained in:
Pierre HUBERT 2021-01-21 18:17:38 +01:00
parent 5a7e356265
commit ffbb81bade
2 changed files with 12 additions and 0 deletions

View File

@ -309,6 +309,9 @@ pub fn delete(user_id: &UserID) -> ResultBoxError {
// Delete all user comments
comments_helper::delete_all_user(user_id)?;
// Delete all user posts
posts_helper::delete_all_user(user_id)?;
// TODO : continue work here
Ok(())

View File

@ -466,6 +466,15 @@ pub fn delete_all_group(group_id: &GroupID) -> ResultBoxError {
Ok(())
}
/// Delete all the posts of a given user
pub fn delete_all_user(user_id: &UserID) -> ResultBoxError {
for post in &export_all_posts_user(user_id)? {
delete(&post)?;
}
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)