(todo: String, pool: &SqlitePool)
| 14 | } |
| 15 | |
| 16 | pub async fn create_task(todo: String, pool: &SqlitePool) -> Result<(), &'static str> { |
| 17 | let new_task = NewTask { description: todo }; |
| 18 | Task::insert(new_task, pool) |
| 19 | .await |
| 20 | .map(|_| ()) |
| 21 | .map_err(|_| "Error inserting task") |
| 22 | } |
| 23 | |
| 24 | pub async fn toggle_task(id: i32, pool: &SqlitePool) -> Result<(), &'static str> { |
| 25 | Task::toggle_with_id(id, pool) |