(
&self,
plugin_id: u64,
update_plugin: UpdatePluginMeta,
)
| 804 | } |
| 805 | |
| 806 | pub async fn update_plugin_meta( |
| 807 | &self, |
| 808 | plugin_id: u64, |
| 809 | update_plugin: UpdatePluginMeta, |
| 810 | ) -> ConfigStoreResult<Plugin> { |
| 811 | let res = sqlx::query_as!( |
| 812 | DbPlugin, |
| 813 | r#"UPDATE plugins SET |
| 814 | name = COALESCE($2, plugins.name), |
| 815 | short_description = COALESCE($3, plugins.short_description), |
| 816 | long_description = COALESCE($4, plugins.long_description), |
| 817 | is_official = COALESCE($5, plugins.is_official), |
| 818 | author_id = COALESCE($6, plugins.author_id), |
| 819 | is_public = COALESCE($7, plugins.is_public), |
| 820 | is_published = COALESCE($8, plugins.is_published), |
| 821 | discord_thread_id = COALESCE($9, plugins.discord_thread_id) |
| 822 | WHERE id = $1 |
| 823 | RETURNING id, |
| 824 | created_at, |
| 825 | name, |
| 826 | short_description, |
| 827 | long_description, |
| 828 | is_published, |
| 829 | is_official, |
| 830 | plugin_kind, |
| 831 | current_version_number, |
| 832 | script_published_source, |
| 833 | script_published_version_updated_at, |
| 834 | script_dev_source, |
| 835 | script_dev_version_updated_at, |
| 836 | author_id, |
| 837 | is_public, |
| 838 | discord_thread_id, |
| 839 | installed_guilds, |
| 840 | installed_guilds_updated_at"#, |
| 841 | plugin_id as i64, |
| 842 | update_plugin.name, |
| 843 | update_plugin.short_description, |
| 844 | update_plugin.long_description, |
| 845 | update_plugin.is_official, |
| 846 | update_plugin.author_id.map(|v| v as i64), |
| 847 | update_plugin.is_public, |
| 848 | update_plugin.is_published, |
| 849 | update_plugin.discord_thread_id.map(|v| v as i64), |
| 850 | ) |
| 851 | .fetch_one(&self.pool) |
| 852 | .await?; |
| 853 | |
| 854 | let images = self.get_plugin_images_with_pool(plugin_id).await?; |
| 855 | |
| 856 | Ok(PluginAndImages(res, images).into()) |
| 857 | } |
| 858 | |
| 859 | pub async fn batch_update_plugins_stats(&self) -> ConfigStoreResult<()> { |
| 860 | sqlx::query!( |
no test coverage detected