(
Extension(session): Extension<LoggedInSession>,
State(state): State<AppState>,
Extension(plugin): Extension<Plugin>,
Path(ImageParam { image_id }): Path<ImageParam>,
)
| 597 | } |
| 598 | |
| 599 | pub async fn delete_plugin_image( |
| 600 | Extension(session): Extension<LoggedInSession>, |
| 601 | State(state): State<AppState>, |
| 602 | Extension(plugin): Extension<Plugin>, |
| 603 | Path(ImageParam { image_id }): Path<ImageParam>, |
| 604 | ) -> ApiResult<EmptyResponse> { |
| 605 | if plugin.author_id != session.session.user.id { |
| 606 | return Err(ApiErrorResponse::NoAccessToPlugin); |
| 607 | } |
| 608 | |
| 609 | state |
| 610 | .db |
| 611 | .delete_plugin_image(plugin.id, image_id) |
| 612 | .await |
| 613 | .map_err(|err| { |
| 614 | tracing::error!(%err, "failed deleting plugin image"); |
| 615 | ApiErrorResponse::InternalError |
| 616 | })?; |
| 617 | |
| 618 | Ok(EmptyResponse) |
| 619 | } |
| 620 | |
| 621 | #[derive(Deserialize)] |
| 622 | pub struct PluginImagesParam { |
nothing calls this directly
no test coverage detected