diff --git a/TODO.md b/TODO.md index 2320463..9a212a7 100644 --- a/TODO.md +++ b/TODO.md @@ -1,4 +1,5 @@ make details rework UX add to make it more readable make image work on .projects +mettre en place des test unitaire coté rust refactor the code diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index c76b80b..a3a209d 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -120,7 +120,6 @@ fn extract_filename(path: &str) -> Result> { * Copies the logo to the .projects folder * @ return Result> (should return the path to the logo or an error) */ - */ fn copy_logo(project: &Project) -> Result> { let logo_path = match &project.logo { Some(path) => path, @@ -139,11 +138,11 @@ fn copy_logo(project: &Project) -> Result> { Ok(dest_path.to_path_buf()) } -#[tauri::command] /** * Returns the project with the given id * @ return Option (should return the project with the given id or None if the project is not found) */ +#[tauri::command] fn get_project(id: u32) -> Option { let projects = get_projects(); @@ -156,10 +155,10 @@ fn get_project(id: u32) -> Option { None // Return None if the project with the given id is not found } -#[tauri::command] /** * Deletes the project with the given id */ +#[tauri::command] async fn delete_project(id: u32) { let mut projects = get_projects(); projects.retain(|project| project.id != id); @@ -169,11 +168,11 @@ async fn delete_project(id: u32) { } } -#[tauri::command] /** * Returns a vector of all projects * @ return Vec (should return a vector of all projects) */ +#[tauri::command] fn get_projects() -> Vec { let file_path = get_file_path(); match read_projects(&file_path) {