(
&self,
plugin_id: u64,
new_source: String,
)
| 962 | } |
| 963 | |
| 964 | pub async fn publish_script_plugin_version( |
| 965 | &self, |
| 966 | plugin_id: u64, |
| 967 | new_source: String, |
| 968 | ) -> ConfigStoreResult<Vec<Id<GuildMarker>>> { |
| 969 | let plugin = sqlx::query_as!( |
| 970 | DbPlugin, |
| 971 | r#"UPDATE plugins SET |
| 972 | script_published_source = $2, |
| 973 | script_published_version_updated_at = now(), |
| 974 | current_version_number = current_version_number +1 |
| 975 | WHERE id = $1 |
| 976 | RETURNING id, |
| 977 | created_at, |
| 978 | name, |
| 979 | short_description, |
| 980 | long_description, |
| 981 | is_published, |
| 982 | is_official, |
| 983 | plugin_kind, |
| 984 | current_version_number, |
| 985 | script_published_source, |
| 986 | script_published_version_updated_at, |
| 987 | script_dev_source, |
| 988 | script_dev_version_updated_at, |
| 989 | author_id, |
| 990 | is_public, |
| 991 | discord_thread_id, |
| 992 | installed_guilds, |
| 993 | installed_guilds_updated_at |
| 994 | "#, |
| 995 | plugin_id as i64, |
| 996 | new_source, |
| 997 | ) |
| 998 | .fetch_one(&self.pool) |
| 999 | .await?; |
| 1000 | |
| 1001 | struct Row { |
| 1002 | guild_id: i64, |
| 1003 | } |
| 1004 | |
| 1005 | let updated_guilds = sqlx::query_as!( |
| 1006 | Row, |
| 1007 | "UPDATE guild_scripts SET original_source = $2, plugin_version_number = $3 WHERE \ |
| 1008 | plugin_id = $1 AND plugin_auto_update RETURNING guild_id", |
| 1009 | plugin_id as i64, |
| 1010 | new_source, |
| 1011 | plugin.current_version_number, |
| 1012 | ) |
| 1013 | .fetch_all(&self.pool) |
| 1014 | .await?; |
| 1015 | |
| 1016 | Ok(updated_guilds |
| 1017 | .into_iter() |
| 1018 | .map(|v| Id::new(v.guild_id as u64)) |
| 1019 | .collect()) |
| 1020 | } |
| 1021 |
no outgoing calls
no test coverage detected