(conn: Connection<Db>, id: i32)
| 122 | #[openapi(tag = "POST")] |
| 123 | #[delete("/<id>")] |
| 124 | async fn delete(conn: Connection<Db>, id: i32) -> R<Option<String>> { |
| 125 | let db = conn.into_inner(); |
| 126 | |
| 127 | let cmd = Mutation::delete_post(&db, id); |
| 128 | match cmd.await { |
| 129 | Ok(_) => Ok(Json(Some("Post successfully deleted.".to_string()))), |
| 130 | Err(e) => { |
| 131 | let m = error::Error { |
| 132 | err: "Error deleting post".to_string(), |
| 133 | msg: Some(e.to_string()), |
| 134 | http_status_code: 400, |
| 135 | }; |
| 136 | Err(m) |
| 137 | } |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | /// # delete all posts |
| 142 | #[openapi(tag = "POST")] |
nothing calls this directly
no test coverage detected