mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2024-11-26 15:29:21 +00:00
Can delete all the movies of a user
This commit is contained in:
parent
b8e9a4c95d
commit
64b9497cc5
@ -318,6 +318,9 @@ pub fn delete(user_id: &UserID) -> ResultBoxError {
|
||||
// Delete all the likes created by the user
|
||||
likes_helper::delete_all_user(user_id)?;
|
||||
|
||||
// Delete all user movies
|
||||
movies_helper::delete_all_user(user_id)?;
|
||||
|
||||
// TODO : continue work here
|
||||
|
||||
Ok(())
|
||||
|
@ -43,6 +43,15 @@ pub fn delete(movie: &Movie) -> ResultBoxError {
|
||||
.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
|
||||
fn db_to_movie(row: &database::RowResult) -> ResultBoxError<Movie> {
|
||||
Ok(Movie {
|
||||
|
Loading…
Reference in New Issue
Block a user