| 3627 | } |
| 3628 | |
| 3629 | async fn reply_question( |
| 3630 | State(state): State<Arc<ServerState>>, |
| 3631 | Path(id): Path<String>, |
| 3632 | Json(req): Json<ReplyQuestionRequest>, |
| 3633 | ) -> Result<Json<bool>> { |
| 3634 | let mut pending = QUESTION_REQUESTS.write().await; |
| 3635 | let question = pending |
| 3636 | .remove(&id) |
| 3637 | .ok_or_else(|| ApiError::NotFound(format!("Question request not found: {}", id)))?; |
| 3638 | drop(pending); |
| 3639 | |
| 3640 | state.broadcast( |
| 3641 | &serde_json::json!({ |
| 3642 | "type": "question.replied", |
| 3643 | "requestID": id, |
| 3644 | "sessionID": question.session_id, |
| 3645 | "answers": req.answers, |
| 3646 | }) |
| 3647 | .to_string(), |
| 3648 | ); |
| 3649 | Ok(Json(true)) |
| 3650 | } |
| 3651 | |
| 3652 | async fn reject_question( |
| 3653 | State(state): State<Arc<ServerState>>, |