From a92eaa2286f9c9c847bf6e6e5cd6c165c7a92774 Mon Sep 17 00:00:00 2001 From: Mark Pitblado Date: Wed, 6 Nov 2024 06:49:11 -0800 Subject: [PATCH] feat: finish description implementation --- src/api.rs | 5 +++++ src/app.rs | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/api.rs b/src/api.rs index 711ef29..d501e6a 100644 --- a/src/api.rs +++ b/src/api.rs @@ -49,6 +49,7 @@ pub async fn create_new_task( instance_url: &str, api_key: &str, task_title: &str, + description: Option<&str>, priority: Option, ) -> Result<(), Box> { let client = Client::new(); @@ -58,6 +59,10 @@ pub async fn create_new_task( "title": task_title }); + if let Some(desc) = description { + task_data["description"] = json!(desc); + } + if let Some(priority_value) = priority { task_data["priority"] = json!(priority_value); } diff --git a/src/app.rs b/src/app.rs index 75feda2..9a229e5 100644 --- a/src/app.rs +++ b/src/app.rs @@ -151,14 +151,13 @@ impl App { match key.code { KeyCode::Enter => { if !self.new_task_title.trim().is_empty() { - // Use the parser to extract the task title, priority, and label titles let parsed_task = parse_task_input(&self.new_task_title); - // Create the new task with the parsed title, priority, and labels if let Err(err) = create_new_task( instance_url, api_key, &parsed_task.title, + parsed_task.description.as_deref(), parsed_task.priority, ) .await