(
params: HashMap<String, String>,
store: Store,
)
| 126 | } |
| 127 | |
| 128 | async fn get_questions( |
| 129 | params: HashMap<String, String>, |
| 130 | store: Store, |
| 131 | ) -> Result<impl warp::Reply, warp::Rejection> { |
| 132 | if !params.is_empty() { |
| 133 | let pagination = extract_pagination(params)?; |
| 134 | let res: Vec<Question> = store.questions.read().await.values().cloned().collect(); |
| 135 | let res = &res[pagination.start..pagination.end]; |
| 136 | Ok(warp::reply::json(&res)) |
| 137 | } else { |
| 138 | let res: Vec<Question> = store.questions.read().await.values().cloned().collect(); |
| 139 | Ok(warp::reply::json(&res)) |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | async fn add_question( |
| 144 | store: Store, |
nothing calls this directly
no test coverage detected