(&self, parent_id: &str)
| 341 | } |
| 342 | |
| 343 | pub async fn list_children(&self, parent_id: &str) -> Result<Vec<Session>, DatabaseError> { |
| 344 | let rows = sqlx::query_as::<_, SessionRow>( |
| 345 | r#"SELECT |
| 346 | id, project_id, parent_id, slug, directory, title, version, share_url, |
| 347 | summary_additions, summary_deletions, summary_files, summary_diffs, |
| 348 | revert, permission, |
| 349 | usage_input_tokens, usage_output_tokens, usage_reasoning_tokens, |
| 350 | usage_cache_write_tokens, usage_cache_read_tokens, usage_total_cost, |
| 351 | status, created_at, updated_at, time_compacting, time_archived |
| 352 | FROM sessions WHERE parent_id = ? |
| 353 | ORDER BY created_at DESC"#, |
| 354 | ) |
| 355 | .bind(parent_id) |
| 356 | .fetch_all(&self.pool) |
| 357 | .await |
| 358 | .map_err(|e| DatabaseError::QueryError(e.to_string()))?; |
| 359 | |
| 360 | Ok(rows.into_iter().map(|r| r.into_session()).collect()) |
| 361 | } |
| 362 | } |
| 363 | |
| 364 | fn status_to_string(status: &SessionStatus) -> &'static str { |
nothing calls this directly
no test coverage detected