mirror of
				https://gitlab.com/comunic/comunicapiv3
				synced 2025-11-04 01:24:04 +00:00 
			
		
		
		
	Can delete all the movies of a user
This commit is contained in:
		@@ -318,6 +318,9 @@ pub fn delete(user_id: &UserID) -> ResultBoxError {
 | 
				
			|||||||
    // Delete all the likes created by the user
 | 
					    // Delete all the likes created by the user
 | 
				
			||||||
    likes_helper::delete_all_user(user_id)?;
 | 
					    likes_helper::delete_all_user(user_id)?;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Delete all user movies
 | 
				
			||||||
 | 
					    movies_helper::delete_all_user(user_id)?;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // TODO : continue work here
 | 
					    // TODO : continue work here
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Ok(())
 | 
					    Ok(())
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -43,6 +43,15 @@ pub fn delete(movie: &Movie) -> ResultBoxError {
 | 
				
			|||||||
        .exec()
 | 
					        .exec()
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/// Delete all the movies of a user
 | 
				
			||||||
 | 
					pub fn delete_all_user(user_id: &UserID) -> ResultBoxError {
 | 
				
			||||||
 | 
					    for movie in &get_list_user(user_id)? {
 | 
				
			||||||
 | 
					        delete(movie)?;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Ok(())
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// Turn a database entry into a movie object
 | 
					/// Turn a database entry into a movie object
 | 
				
			||||||
fn db_to_movie(row: &database::RowResult) -> ResultBoxError<Movie> {
 | 
					fn db_to_movie(row: &database::RowResult) -> ResultBoxError<Movie> {
 | 
				
			||||||
    Ok(Movie {
 | 
					    Ok(Movie {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user