(
params: HashMap<String, String>,
store: Store,
)
| 7 | use handle_errors::Error; |
| 8 | |
| 9 | pub async fn get_questions( |
| 10 | params: HashMap<String, String>, |
| 11 | store: Store, |
| 12 | ) -> Result<impl warp::Reply, warp::Rejection> { |
| 13 | if !params.is_empty() { |
| 14 | let pagination = extract_pagination(params)?; |
| 15 | let res: Vec<Question> = store.questions.read().await.values().cloned().collect(); |
| 16 | let res = &res[pagination.start..pagination.end]; |
| 17 | Ok(warp::reply::json(&res)) |
| 18 | } else { |
| 19 | let res: Vec<Question> = store.questions.read().await.values().cloned().collect(); |
| 20 | Ok(warp::reply::json(&res)) |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | pub async fn update_question( |
| 25 | id: String, |
nothing calls this directly
no test coverage detected