update plugin dev source
(
State(state): State<AppState>,
Extension(session): Extension<LoggedInSession>,
Extension(plugin): Extension<Plugin>,
Json(body): Json<UpdatePluginDevSourceRequest>,
)
| 230 | |
| 231 | // update plugin dev source |
| 232 | pub async fn update_plugin_dev_source( |
| 233 | State(state): State<AppState>, |
| 234 | Extension(session): Extension<LoggedInSession>, |
| 235 | Extension(plugin): Extension<Plugin>, |
| 236 | Json(body): Json<UpdatePluginDevSourceRequest>, |
| 237 | ) -> ApiResult<impl IntoResponse> { |
| 238 | if let Err(err) = validate(&body, &()) { |
| 239 | return Err(ApiErrorResponse::ValidationFailed(err)); |
| 240 | } |
| 241 | |
| 242 | if plugin.author_id != session.session.user.id { |
| 243 | return Err(ApiErrorResponse::NoAccessToPlugin); |
| 244 | } |
| 245 | |
| 246 | let plugin = state |
| 247 | .db |
| 248 | .update_script_plugin_dev_version(plugin.id, body.new_source) |
| 249 | .await |
| 250 | .map_err(|err| { |
| 251 | error!(?err, "failed updating plugin"); |
| 252 | ApiErrorResponse::InternalError |
| 253 | })?; |
| 254 | |
| 255 | Ok(Json(plugin)) |
| 256 | } |
| 257 | |
| 258 | // publish plugin version |
| 259 | #[derive(Deserialize)] |
nothing calls this directly
no test coverage detected