mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2024-11-22 21:39:21 +00:00
Finish movie deletion implementation
This commit is contained in:
parent
2cc8e7da04
commit
3ee2e1843a
@ -7,6 +7,7 @@ use crate::data::error::ResultBoxError;
|
||||
use crate::data::movie::Movie;
|
||||
use crate::data::user::UserID;
|
||||
use crate::helpers::{database, posts_helper};
|
||||
use crate::utils::user_data_utils::user_data_path;
|
||||
|
||||
/// Get the list of movies of the current
|
||||
pub fn get_list_user(user_id: &UserID) -> ResultBoxError<Vec<Movie>> {
|
||||
@ -32,9 +33,14 @@ pub fn does_user_has(user_id: &UserID, movie_id: u64) -> ResultBoxError<bool> {
|
||||
pub fn delete(movie: &Movie) -> ResultBoxError {
|
||||
posts_helper::delete_all_with_movie(movie)?;
|
||||
|
||||
// TODO : continue implementation
|
||||
let movie_path = user_data_path(movie.uri.as_ref());
|
||||
if movie_path.exists() {
|
||||
std::fs::remove_file(movie_path)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
database::DeleteQuery::new(MOVIES_TABLE)
|
||||
.cond_u64("ID", movie.id)
|
||||
.exec()
|
||||
}
|
||||
|
||||
/// Turn a database entry into a movie object
|
||||
|
Loading…
Reference in New Issue
Block a user