(&self, session_id: &str)
| 80 | } |
| 81 | |
| 82 | pub async fn get(&self, session_id: &str) -> Vec<TodoInfo> { |
| 83 | if let Some(ref db) = self.db { |
| 84 | if let Ok(items) = db.list_for_session(session_id).await { |
| 85 | return items |
| 86 | .into_iter() |
| 87 | .map(|item| TodoInfo { |
| 88 | content: item.content, |
| 89 | status: item.status, |
| 90 | priority: item.priority, |
| 91 | }) |
| 92 | .collect(); |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | let state = self.state.read().await; |
| 97 | state.get(session_id).cloned().unwrap_or_default() |
| 98 | } |
| 99 | |
| 100 | pub async fn clear(&self, session_id: &str) { |
| 101 | if let Some(ref db) = self.db { |
no test coverage detected