(
state: State<AppState>,
Path(id): Path<i32>,
mut cookies: Cookies,
form: Form<post::Model>,
)
| 166 | } |
| 167 | |
| 168 | async fn update_post( |
| 169 | state: State<AppState>, |
| 170 | Path(id): Path<i32>, |
| 171 | mut cookies: Cookies, |
| 172 | form: Form<post::Model>, |
| 173 | ) -> Result<PostResponse, (StatusCode, String)> { |
| 174 | let form = form.0; |
| 175 | |
| 176 | MutationCore::update_post_by_id(&state.conn, id, form) |
| 177 | .await |
| 178 | .expect("could not edit post"); |
| 179 | |
| 180 | let data = FlashData { |
| 181 | kind: "success".to_owned(), |
| 182 | message: "Post successfully updated".to_owned(), |
| 183 | }; |
| 184 | |
| 185 | Ok(post_response(&mut cookies, data)) |
| 186 | } |
| 187 | |
| 188 | async fn delete_post( |
| 189 | state: State<AppState>, |
nothing calls this directly
no test coverage detected