MCPcopy Create free account
hub / github.com/Botloader/botloader / delete_plugin_image

Function delete_plugin_image

components/webapi/src/routes/plugins.rs:599–619  ·  view source on GitHub ↗
(
    Extension(session): Extension<LoggedInSession>,
    State(state): State<AppState>,
    Extension(plugin): Extension<Plugin>,
    Path(ImageParam { image_id }): Path<ImageParam>,
)

Source from the content-addressed store, hash-verified

597}
598
599pub 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)]
622pub struct PluginImagesParam {

Callers

nothing calls this directly

Calls 1

delete_plugin_imageMethod · 0.80

Tested by

no test coverage detected