(
State(state): State<Arc<ServerState>>,
Path(id): Path<String>,
Json(req): Json<ArchiveSessionRequest>,
)
| 537 | } |
| 538 | |
| 539 | async fn archive_session( |
| 540 | State(state): State<Arc<ServerState>>, |
| 541 | Path(id): Path<String>, |
| 542 | Json(req): Json<ArchiveSessionRequest>, |
| 543 | ) -> Result<Json<SessionInfo>> { |
| 544 | let mut sessions = state.sessions.lock().await; |
| 545 | let info = if req.archive.unwrap_or(true) { |
| 546 | let updated = sessions |
| 547 | .set_archived(&id, None) |
| 548 | .ok_or_else(|| ApiError::SessionNotFound(id.clone()))?; |
| 549 | session_to_info(&updated) |
| 550 | } else { |
| 551 | let session = sessions |
| 552 | .get(&id) |
| 553 | .ok_or_else(|| ApiError::SessionNotFound(id.clone()))?; |
| 554 | session_to_info(session) |
| 555 | }; |
| 556 | drop(sessions); |
| 557 | persist_sessions_if_enabled(&state).await; |
| 558 | Ok(Json(info)) |
| 559 | } |
| 560 | |
| 561 | #[derive(Debug, Deserialize)] |
| 562 | pub struct SetTitleRequest { |
nothing calls this directly
no test coverage detected