(
State(state): State<AppState>,
headers: HeaderMap,
Query(params): Query<StructureQuery>,
)
| 271 | } |
| 272 | |
| 273 | async fn get_structure( |
| 274 | State(state): State<AppState>, |
| 275 | headers: HeaderMap, |
| 276 | Query(params): Query<StructureQuery>, |
| 277 | ) -> Result<Json<Value>, AppError> { |
| 278 | let project = require_project(&state, &headers)?; |
| 279 | let depth = params.depth.unwrap_or(0); |
| 280 | let detail = params.detail.unwrap_or(0); |
| 281 | |
| 282 | if detail > 0 { |
| 283 | let result = structure::get_structure_with_detail( |
| 284 | &project.root, |
| 285 | &project.file_tree, |
| 286 | &project.symbol_table, |
| 287 | depth, |
| 288 | detail, |
| 289 | ); |
| 290 | let preview = format!("{} files (L{})", result.file_count, detail); |
| 291 | record_history(&state, session_id(&headers).as_deref(), "GET", "/structure", &preview); |
| 292 | Ok(Json(serde_json::to_value(result).unwrap())) |
| 293 | } else { |
| 294 | let result = structure::get_structure(&project.file_tree, depth); |
| 295 | let preview = format!("{} files", result.file_count); |
| 296 | record_history(&state, session_id(&headers).as_deref(), "GET", "/structure", &preview); |
| 297 | Ok(Json(serde_json::to_value(result).unwrap())) |
| 298 | } |
| 299 | } |
| 300 | |
| 301 | #[derive(Deserialize)] |
| 302 | struct DefineRequest { |
nothing calls this directly
no test coverage detected