(
store: Store,
params: HashMap<String, String>,
)
| 181 | } |
| 182 | |
| 183 | async fn add_answer( |
| 184 | store: Store, |
| 185 | params: HashMap<String, String>, |
| 186 | ) -> Result<impl warp::Reply, warp::Rejection> { |
| 187 | let answer = Answer { |
| 188 | id: AnswerId("1".to_string()), |
| 189 | content: params.get("content").unwrap().to_string(), |
| 190 | question_id: QuestionId(params.get("questionId").unwrap().to_string()), |
| 191 | }; |
| 192 | |
| 193 | store |
| 194 | .answers |
| 195 | .write() |
| 196 | .await |
| 197 | .insert(answer.id.clone(), answer); |
| 198 | |
| 199 | Ok(warp::reply::with_status("Answer added", StatusCode::OK)) |
| 200 | } |
| 201 | |
| 202 | #[tokio::main] |
| 203 | async fn main() { |
nothing calls this directly
no test coverage detected