(req: &mut Request, depot: &mut Depot, res: &mut Response)
| 126 | |
| 127 | #[handler] |
| 128 | async fn delete(req: &mut Request, depot: &mut Depot, res: &mut Response) -> Result<()> { |
| 129 | let state = depot |
| 130 | .obtain::<AppState>() |
| 131 | .ok_or_else(StatusError::internal_server_error)?; |
| 132 | let conn = &state.conn; |
| 133 | let id = req.param::<i32>("id").unwrap_or_default(); |
| 134 | |
| 135 | Mutation::delete_post(conn, id) |
| 136 | .await |
| 137 | .map_err(|_| StatusError::internal_server_error())?; |
| 138 | |
| 139 | Redirect::found("/").render(res); |
| 140 | Ok(()) |
| 141 | } |
| 142 | |
| 143 | #[tokio::main] |
| 144 | pub async fn main() { |
nothing calls this directly
no test coverage detected