mirror of
				https://gitlab.com/comunic/comunicapiv3
				synced 2025-10-30 23:24:42 +00:00 
			
		
		
		
	Remove all movies
This commit is contained in:
		| @@ -17,6 +17,12 @@ pub fn get_list_user(user_id: &UserID) -> ResultBoxError<Vec<Movie>> { | ||||
|         .exec(db_to_movie) | ||||
| } | ||||
|  | ||||
| /// Get all movies | ||||
| pub fn get_all() -> ResultBoxError<Vec<Movie>> { | ||||
|     database::QueryInfo::new(MOVIES_TABLE) | ||||
|         .exec(db_to_movie) | ||||
| } | ||||
|  | ||||
| /// Get information about a single movie | ||||
| pub fn get_info(movie_id: u64) -> ResultBoxError<Movie> { | ||||
|     database::QueryInfo::new(MOVIES_TABLE) | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| use comunic_server::controllers::server; | ||||
| use comunic_server::data::config::{conf, Config}; | ||||
| use comunic_server::helpers::database; | ||||
| use comunic_server::helpers::{database, movies_helper}; | ||||
|  | ||||
| #[actix_rt::main] | ||||
| async fn main() -> std::io::Result<()> { | ||||
| @@ -15,6 +15,12 @@ async fn main() -> std::io::Result<()> { | ||||
|     // Connect to the database | ||||
|     database::connect(&conf().database).expect("Could not connect to database!"); | ||||
|  | ||||
|     // TODO : remove after application | ||||
|     // Remove all movies | ||||
|     for movie in movies_helper::get_all().unwrap() { | ||||
|         movies_helper::delete(&movie).unwrap(); | ||||
|     } | ||||
|  | ||||
|     // Start the server | ||||
|     server::start_server(conf()).await | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user