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