Remove JSONified overrides when sqlx feature is enabled, where it makes sense
This commit is contained in:
parent
0c7c1c917a
commit
c0de926086
|
@ -41,13 +41,7 @@ use super::{option_arc_rwlock_ptr_eq, option_vec_arc_rwlock_ptr_eq};
|
|||
/// See <https://discord-userdoccers.vercel.app/resources/channel#channels-resource>
|
||||
pub struct Channel {
|
||||
pub application_id: Option<Snowflake>,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub applied_tags: Option<sqlx::types::Json<Vec<String>>>,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub applied_tags: Option<Vec<String>>,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub available_tags: Option<sqlx::types::Json<Vec<Tag>>>,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub available_tags: Option<Vec<Tag>>,
|
||||
pub bitrate: Option<i32>,
|
||||
#[serde(rename = "type")]
|
||||
|
@ -55,9 +49,7 @@ pub struct Channel {
|
|||
pub created_at: Option<chrono::DateTime<Utc>>,
|
||||
pub default_auto_archive_duration: Option<i32>,
|
||||
pub default_forum_layout: Option<i32>,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub default_reaction_emoji: Option<sqlx::types::Json<DefaultReaction>>,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
// DefaultReaction could be stored in a separate table. However, there are a lot of default emojis. How would we handle that?
|
||||
pub default_reaction_emoji: Option<DefaultReaction>,
|
||||
pub default_sort_order: Option<i32>,
|
||||
pub default_thread_rate_limit_per_user: Option<i32>,
|
||||
|
|
|
@ -8,7 +8,9 @@ use serde::{Deserialize, Serialize};
|
|||
use crate::types::Shared;
|
||||
use serde_aux::field_attributes::deserialize_option_number_from_string;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Default, Copy, PartialOrd, Ord, Hash)]
|
||||
#[derive(
|
||||
Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Default, Copy, PartialOrd, Ord, Hash,
|
||||
)]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum UserStatus {
|
||||
|
@ -26,7 +28,9 @@ impl std::fmt::Display for UserStatus {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Default, Copy, PartialOrd, Ord, Hash)]
|
||||
#[derive(
|
||||
Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Default, Copy, PartialOrd, Ord, Hash,
|
||||
)]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum UserTheme {
|
||||
|
@ -44,9 +48,6 @@ pub struct UserSettings {
|
|||
pub animate_stickers: u8,
|
||||
pub contact_sync_enabled: bool,
|
||||
pub convert_emoticons: bool,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub custom_status: Option<sqlx::types::Json<CustomStatus>>,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub custom_status: Option<CustomStatus>,
|
||||
pub default_guilds_restricted: bool,
|
||||
pub detect_platform_accounts: bool,
|
||||
|
@ -54,20 +55,10 @@ pub struct UserSettings {
|
|||
pub disable_games_tab: bool,
|
||||
pub enable_tts_command: bool,
|
||||
pub explicit_content_filter: u8,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub friend_source_flags: sqlx::types::Json<FriendSourceFlags>,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub friend_source_flags: FriendSourceFlags,
|
||||
pub gateway_connected: Option<bool>,
|
||||
pub gif_auto_play: bool,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub guild_folders: sqlx::types::Json<Vec<GuildFolder>>,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub guild_folders: Vec<GuildFolder>,
|
||||
#[cfg(feature = "sqlx")]
|
||||
#[serde(default)]
|
||||
pub guild_positions: sqlx::types::Json<Vec<String>>,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
#[serde(default)]
|
||||
pub guild_positions: Vec<String>,
|
||||
pub inline_attachment_media: bool,
|
||||
|
@ -77,9 +68,6 @@ pub struct UserSettings {
|
|||
pub native_phone_integration_enabled: bool,
|
||||
pub render_embeds: bool,
|
||||
pub render_reactions: bool,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub restricted_guilds: sqlx::types::Json<Vec<String>>,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub restricted_guilds: Vec<String>,
|
||||
pub show_current_game: bool,
|
||||
pub status: Shared<UserStatus>,
|
||||
|
|
Loading…
Reference in New Issue