(
State(state): State<AppState>,
Extension(current_guild): Extension<CurrentUserGuild>,
Path(GuildScriptPathParams { script_id }): Path<GuildScriptPathParams>,
)
| 242 | } |
| 243 | |
| 244 | pub async fn delete_guild_script( |
| 245 | State(state): State<AppState>, |
| 246 | Extension(current_guild): Extension<CurrentUserGuild>, |
| 247 | Path(GuildScriptPathParams { script_id }): Path<GuildScriptPathParams>, |
| 248 | ) -> ApiResult<impl IntoResponse> { |
| 249 | let script = state |
| 250 | .db |
| 251 | .get_script_by_id(current_guild.id, script_id) |
| 252 | .await |
| 253 | .map_err(|err| { |
| 254 | error!(%err, "failed fetching guild script"); |
| 255 | ApiErrorResponse::InternalError |
| 256 | })?; |
| 257 | |
| 258 | state |
| 259 | .db |
| 260 | .del_script(current_guild.id, script.name.clone()) |
| 261 | .await |
| 262 | .map_err(|err| { |
| 263 | error!(%err, "failed deleting guild script"); |
| 264 | ApiErrorResponse::InternalError |
| 265 | })?; |
| 266 | |
| 267 | Ok(Json(script)) |
| 268 | } |
| 269 | |
| 270 | pub async fn update_script_plugin( |
| 271 | State(state): State<AppState>, |
nothing calls this directly
no test coverage detected