(
id: String,
store: Store,
question: Question,
)
| 22 | } |
| 23 | |
| 24 | pub async fn update_question( |
| 25 | id: String, |
| 26 | store: Store, |
| 27 | question: Question, |
| 28 | ) -> Result<impl warp::Reply, warp::Rejection> { |
| 29 | match store.questions.write().await.get_mut(&QuestionId(id)) { |
| 30 | Some(q) => *q = question, |
| 31 | None => return Err(warp::reject::custom(Error::QuestionNotFound)), |
| 32 | } |
| 33 | |
| 34 | Ok(warp::reply::with_status("Question updated", StatusCode::OK)) |
| 35 | } |
| 36 | |
| 37 | pub async fn delete_question( |
| 38 | id: String, |