(state: Data<&AppState>, form: Form<post::Model>)
| 31 | |
| 32 | #[handler] |
| 33 | async fn create(state: Data<&AppState>, form: Form<post::Model>) -> Result<impl IntoResponse> { |
| 34 | let form = form.0; |
| 35 | let conn = &state.conn; |
| 36 | |
| 37 | MutationCore::create_post(conn, form) |
| 38 | .await |
| 39 | .map_err(InternalServerError)?; |
| 40 | |
| 41 | Ok(StatusCode::FOUND.with_header("location", "/")) |
| 42 | } |
| 43 | |
| 44 | #[handler] |
| 45 | async fn list(state: Data<&AppState>, Query(params): Query<Params>) -> Result<impl IntoResponse> { |